| By Berndt Hamboeck | Article Rating: |
|
| April 1, 2002 12:00 AM EST | Reads: |
6,596 |
WAP stands for Wireless Application Protocol and is based on Wireless Markup Language (WML), which is closely related to Hypertext Markup Language (HTML). WAP enables you to quickly and easily deliver information and services to mobile users. It's independent from any other mobile or network standard and is compatible with all popular mobile communication networks.
WAP is a communications protocol and application environment that can be built on any operating system, including PalmOS, EPOC, Windows CE, FLEXOS, OS/9, and JavaOS. It even provides service interoperability between different device families. The WAP Forum defines this protocol and believes everyone should have access to these specifications to develop WAP applications.
The WAP Forum
An industry association with over 500 members, the WAP Forum has developed this de facto world standard for wireless information and telephony services on digital mobile phones and other wireless terminals. Their primary goal is to bring together companies from all segments of the wireless industry value chain to ensure product interoperability and growth of the wireless market.
WAP Forum members represent over 90% of the global handset market: carriers, subscribers, leading infrastructure providers, software developers, and other organizations that provide solutions to the wireless industry (you can find a list on the WAP Forum Web site).
What Can You Do with It?
You can build a lot of applications with WAP, but keep in mind that you're transferring data to mobile phones and that WML is designed for the constraints of small narrowband devices. These constraints include:
Possible WAP applications are:
- Paying your bills
- Checking your bank account and wiring money
- Reading and sending e-mail
- Staying informed about the stock market
- Checking weather, traffic, and events calendars
- Navigating the Net
- Automating your house
- Developing customer service
- Creating a mobile organizer
Usually a Web page is a file (document) stored on a Web server that's sent to a Web browser when requested. In WAP, the documents are called decks and are stored on Web servers. Each deck contains one or more cards, the contents of which are displayed in the WAP browser window, although the display window is scrollable. On the Web the markup language for documents is usually HTML; in WAP, it's WML. WML inherits most of its syntactic constructs from XML. The two might look very similar, and for this article we'll pretend they are, but there are some important differences.
Your Web browser will usually talk to a Web server directly to ask for a certain page. In WAP there's another device involved, a WAP gateway. This device sits somewhere on the network between your WAP device and the Web server and helps the Web server send data to the WAP device and vice versa.
Although the WAP gateway has very little intelligence, it converts the WML code to a smaller format, to save time, before the code is sent to the WAP browser. This also means that WML documents must have correct syntax (see Listing 1).
XML is case-sensitive and WML inherits this characteristic. No case folding is performed when parsing a WML deck. This implies that all WML tags and attributes are case sensitive as well as any enumerated attribute values.
In a WML file the header is important. The first character received by the WAP gateway must be the < character that starts the line <?xml version="1.0">. Any other character will break the card.
The <wml> tag you see is the "deck." In WML, a deck is the container for one or more cards. The deck provides necessary information about the document type, markup language, and navigational templates for the cards incorporated in it.
In WML, a card is the page that's displayed to the user and it must be contained in a WML deck.
Notice the <p> and </p> tags. The <p> tags are typically used to begin a new paragraph and most WML tags must be closed, in this case with a </p>. Between the paragraph we want two input fields displayed to the user, one for the user's name and one for the password.
The do element provides a general mechanism for the user to act upon the current card. In our case we want to verify the entered data through the Struts framework.
Now copy Listing 1 and paste it into your favorite text editor. Save the file and call it login.wml. Notice the .wml file extension; this is the common file extension for WML files. Now we'll look at this file in a WAP browser. Pick a software-based browser (the UP.SDK is highly recommended). M3Gate can also open and display WML decks that are stored on your local computer, which means you can test them without placing them on a Web server (see Figures 1 and 2).
The WAP components in the chain between you and the Web server and the WAP gateway and the WML browser are, as previously mentioned, very strict when it comes to syntax errors. If there are any problems, strip the code down to the bare minimum. This is especially true for the first two lines of code that are the "XML" and "DTD" definitions; if you type the code in manually there's lots of room for error.
If you're testing the code with a WML software browser such as an M3Gate or UP.Simulator that doesn't involve the WAP gateway (you can configure a UP.Simulator to do so), it might work even with some errors, but it won't work on a real WAP device. The WAP gateway is a lot stricter than the emulators.
We now know how to write a WAP application by hand, but there are several other ways to do this. I'll present two other options: using Struts in Sybase EAServer and using iAnywhere Wireless Server.
Using Struts for WAP
Struts offers some simple tags to do very complex cards and decks. See Listing 2 for the Struts code in our example. It tells EAServer that the context for this page is text/vnd.wap.wml and that EAServer shouldn't send text/HTML back to the client. It's important that the WAP client gets what it expects - WML.
The Success Page (success.jsp)
<%@page contentType="text/vnd.wap.wml" %>
<wml>
<card title="Login">
<P>
Logon succeeded
</P>
</card>
</wml>
The Failure Page (failure.jsp)
<%@page contentType="text/vnd.wap.wml" %>
<P>
</card>
<wml>
<card title="Login">
Logon failed
</P>
</wml>
Using PowerJ
We have to set up PowerJ the same way we did in my last article (PBDJ, Vol. 9 issue 3) so we can use the same (simple) business logic and not have to change anything in the Action class or the bean.
The Jaguar package that you deploy to should be called struts-wap. We need two tag libraries: struts-wml and struts-logic (see Figure 3). Your workspace should look like this (see Figure 4).
We have our JSP pages and WAR target. Be sure to add the files for the tag libraries (struts-logic.tld and struts-wml.tld) and the WML classes (strutswap.jar). After deploying, try it using a WAP emulator (see Figure 5).
iAnywhere Wireless Server
iAnywhere Wireless Server provides a comprehensive infrastructure for developing and deploying always-available enterprise applications. It's a midtier server that provides access to enterprise DataStores, and enables the development of applications for mobile and wireless clients as well as traditional desktop and laptop clients.
iAnywhere Wireless Server includes three server components:
1. Synchronization Server: Smart client application clients can synchronize with enterprise DataStores in a transaction-based model.
2. Application Server: A J2EE-based application server provides content delivery services, application management services such as user authentication and session management, and enterprise data access. It's the central hub for the execution of business logic.
3. Message Server: J2EE-based messaging provides interapplication message delivery as well as server-initiated synchronization for mobile clients.
To keep it simple, in our example, EAServer uses additional components. You can easily integrate iAWS into the Sybase Enterprise Portal for a single sign-on. Our logon example would be coded using iAWS (see Listing 3).
The example would be compiled and deployed into EAServer as a servlet. In fact, it already comes with iAWS. The interesting thing is that iAWS notes the sorts of clients you have. This means you'll get a valid output if your client is a browser and also if it's a mobile device. This is done through device identification. iAWS can identify the client browser and the device making the request and customize the output for that particular device. This can be implemented at a coarse level by providing WML, HDML, or HTML, or at a finer level by adapting the content to the browser screen size (see Figures 6 and 7).
Resources
Published April 1, 2002 Reads 6,596
Copyright © 2002 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Berndt Hamboeck
Berndt Hamboeck is a senior consultant for BHITCON (www.bhitcon.net). He's a CSI, SCAPC8, EASAC, SCJP2, and started his Sybase development using PB5. You can reach him under admin@bhitcon.net.
- Why SOA Needs Cloud Computing - Part 1
- Cloud Expo and The End of Tech Recession
- The Transition to Cloud Computing: What Does It Mean For You?
- A Rules Engine Built in PowerBuilder
- Sybase Named “Silver Sponsor” of iPhone Developer Summit
- How PowerBuilder Got Its Groove Back
- The Cloud Has Cross-Border Ambitions
- Ulitzer Named "New Media" Partner of Greatly Anticipated iStrategy Event in Berlin
- Risks and Enterprise Mobility?
- Steps for Success in Enterprise Mobility?
- Are Mobile Luddites Resisting Mobility?
- Hot Event in Santa Clara Becomes Cool with the iPhone
- The Difference Between Web Hosting and Cloud Computing
- Sybase CTO to Speak at 4th International Cloud Computing Expo
- Why SOA Needs Cloud Computing - Part 1
- Cloud Expo and The End of Tech Recession
- The Transition to Cloud Computing: What Does It Mean For You?
- Five Reasons to Choose a Private Cloud
- Seeding The Cloud: The Future of Data Management
- The Threat Behind the Firewall
- Economy Drives Adoption of Virtual Lab Technology
- Tips for Efficient PaaS Application Design
- A Rules Engine Built in PowerBuilder
- Sybase Named “Silver Sponsor” of iPhone Developer Summit
- Where Are RIA Technologies Headed in 2008?
- PowerBuilder History - How Did It Evolve?
- The Top 250 Players in the Cloud Computing Ecosystem
- Custom Common Dialogs Using SetWindowsHookEx
- DDDW Tips and Tricks
- OLE - Extending the Capabilities of PowerBuilder
- DataWindow.NET How To: Data Entry Form
- Book Excerpt: Sybase Adaptive Server Anywhere
- Sybase ASE 12.5 Performance and Tuning
- Working with SOA & Web Services in PowerBuilder
- Office 2003 Toolbar: A New Look For Your Old PowerBuilder App
- Dynamically Creating DataWindow Objects


































