11.07.2015 Views

WEB-ENABLE POWERBUILDER APPS WITH SYBASE EASERVER ...

WEB-ENABLE POWERBUILDER APPS WITH SYBASE EASERVER ...

WEB-ENABLE POWERBUILDER APPS WITH SYBASE EASERVER ...

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

FIGURE 3J2EE TaglibsWe now know how to write a WAP applicationby hand, but there are several other waysto do this. I’ll present two other options: usingStruts in Sybase EAServer and using iAnywhereWireless Server.Using Struts for WAPStruts offers some simple tags to do verycomplex cards and decks. See Listing 2 for theStruts code in our example. It tells EAServer thatthe context for this page is text/vnd.wap.wmland that EAServer shouldn’t send text/HTMLback to the client. It’s important that the WAPclient gets what it expects – WML.and laptop clients.iAnywhere Wireless Server includes threeserver components:1. Synchronization Server: Smart client applicationclients can synchronize with enterpriseDataStores in a transaction-based model.2. Application Server: A J2EE-based applicationserver provides content delivery services,application management services suchas user authentication and session management,and enterprise data access. It’s the centralhub for the execution of business logic.3. Message Server: J2EE-based messaging providesinterapplication message delivery aswell as server-initiated synchronization formobile clients.The Success Page (success.jsp)Logon succeededThe Failure Page (failure.jsp)To keep it simple, in our example, EAServeruses additional components. You can easilyintegrate iAWS into the Sybase EnterprisePortal for a single sign-on. Our logon examplewould be coded using iAWS (see Listing 3).The example would be compiled anddeployed into EAServer as a servlet. In fact, italready comes with iAWS. The interesting thingis that iAWS notes the sorts of clients you have.This means you’ll get a valid output if your clientis a browser and also if it’s a mobile device. ThisLogon failedFIGURE 4JSP pages and WAR targetNow copy Listing 1 and paste it into yourfavorite text editor. Save the file and call itlogin.wml. Notice the .wml file extension; this isthe common file extension for WML files. Nowwe’ll look at this file in a WAP browser. Pick a software-basedbrowser (the UP.SDK is highly recommended).M3Gate can also open and displayWML decks that are stored on your local computer,which means you can test them without placingthem on a Web server (see Figures 1 and 2).The WAP components in the chain betweenyou and the Web server and the WAP gatewayand the WML browser are, as previously mentioned,very strict when it comes to syntaxerrors. If there are any problems, strip the codedown to the bare minimum. This is especiallytrue for the first two lines of code that are the“XML” and “DTD” definitions; if you type thecode in manually there’s lots of room for error.If you’re testing the code with a WML softwarebrowser such as an M3Gate or UP.Simulatorthat doesn’t involve the WAP gateway(you can configure a UP.Simulator to do so), itmight work even with some errors, but it won’twork on a real WAP device. The WAP gateway isa lot stricter than the emulators.Using PowerJWe have to set up PowerJ the same way we didin my last article (PBDJ, Vol. 9 issue 3) so we canuse the same (simple) business logic and not haveto change anything in the Action class or the bean.The Jaguar package that you deploy toshould be called struts-wap. We need two taglibraries: struts-wml and struts-logic (seeFigure 3). Your workspace should look like this(see Figure 4).We have our JSP pages and WAR target. Besure to add the files for the tag libraries (strutslogic.tldand struts-wml.tld) and the WMLclasses (strutswap.jar). After deploying, try itusing a WAP emulator (see Figure 5).iAnywhere Wireless ServeriAnywhere Wireless Server provides a comprehensiveinfrastructure for developing anddeploying always-available enterprise applications.It’s a midtier server that provides accessto enterprise DataStores, and enables thedevelopment of applications for mobile andwireless clients as well as traditional desktopFIGURE 5WAP emulator30 PBDJ volume9 issue4www.SYS-CON.COM/pbdj/

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!