16
Thu, May
6 New Articles

Wireless Web Services with Mobile Internet Toolkit

Development Tools / Utilities
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times
The Web is going wireless. Hardware and information service vendors are rushing to be the first to introduce compelling new wireless devices that are basically unplugged desktops. Wireless telephony, of course, has already become ubiquitous in the business world. The Wireless Application Protocol (WAP) was the first de facto standard for wireless data phones, digital mobile phones, and other wireless devices capable of transmitting and receiving digital data. Newer standards, such as General Packet Radio Service (GPRS), and new, more capable hardware will eventually render WAP obsolete--perhaps sooner rather than later. In the meantime, WAP has garnered a wide range of support from information service providers and has been shown to be an effective, if limited, application platform. Today, WAP-based mobile phones with integrated microbrowsers are widely available, allowing users to check email and perform light-duty Web-browsing tasks. With the right tools, application developers can leverage WAP and other wireless Web protocols today and possibly avoid the problems future obsolescence will bring.

WAP with a Microsoft Spin

Microsoft was an early and active member of the WAP Forum, the industry consortium responsible for the standard. Microsoft aims its WAP interest at providing software products and services for the mobile Internet market. The intent is for those products to transitionally support both HTTP access and WAP access to Microsoft's core Windows services. As part of the .NET developer initiative, Microsoft has released the Mobile Internet Toolkit (or simply, MIT), which addresses many of the issues raised when attempting to target a wireless application for both WAP and more traditional Web platforms. MIT provides application developers with a programming interface that targets both platforms.

WAP was designed to enable a Web-like experience given the limited capabilities and bandwidth of wireless telephone technology. The low-power displays of mobile phones only allow a few lines of text and simple graphics to be displayed, and the digital data link is usually rated at no more than 9.6 or 14.4 Kbps for most service providers. WAP defines a client/server applications protocol, similar in many respects to the Web's HTTP. HTTP is designed to operate over TCP/IP-based networks, whereas WAP is designed to work with most wireless telephony networks, such as code division multiple access (CDMA) and global system for mobile communications (GSM). HTML is the markup language used by most HTTP-based browsers. WAP defines its own markup language, Wireless Markup Language (WML), for formatting text on WAP devices. Though there are several differences, at a higher level, WAP and HTTP share most of the traditional client/server Web-browsing concepts.

The MIT abstracts these concepts into a single, server-based application interface. At runtime, MIT components can distinguish the request signatures of WAP and HTTP client platforms and provide the correct content format on the fly.

MIT Web Controls Do the Hard Work
MIT components are Web controls. The .NET framework has extended the Active Server Pages (ASP) concept with the notion of server-side controls defined as templates on a Web page. When a page is requested, the ASP.NET engine expands the page's Web controls into content that can be rendered on a browser. The controls themselves may invoke application logic when rendered. Server-side ASP scripts are also used to wire-up server controls to application components. The simple MIT page in Figure 1 contains a single control to display a message. The code shows the static message "Hello!" on the browser. You could easily customize the message with a simple script, as in Figure 2. When browsing Figure 2 with a certain popular desktop browser, the message "Hello IE user!" is shown.

<%@ Page Inherits = "System.Mobile.UI.MobilePage" %>
<%@ Register TagPrefix = "Mobile" Namespace="System.Mobile.UI" %>

  


Figure 1: This simple MIT page displays "Hello!"

<%@ Page Inherits="System.Mobile.UI.MobilePage" %>
<%@ Register TagPrefix="Mobile" Namespace="System.Mobile.UI" %>



protected void Page_Load(Object sender, EventArgs e){
    if (!IsPostBack)
        MyLabel.Text = "Hello " + Request.Browser["Browser"] + 
            " user!";
}




    
        Text="This will be overwritten in Page_Load" />


Figure 2: A slight customization of the code in Figure 1 determines the browser in use.

Note the first line of the pages in these examples includes the directive Page Inherits="System.Mobile.Ui.MobilePage". This means the page inherits the events, properties, and methods of the MobilePage class. In Listing 2, C# code has been added to handle the MobilePage's Load event. This code will be called when the ASP.NET engine accesses the page. The code uses the Request property of the MobilePage to obtain the name of the browser being used and inserts this information into the Text property of the MyLabel control.

Although the pages in Figures 1 and 2 bear little resemblance to valid HTML, the pages produce valid HTML when accessed via HTTP. The "magic" is that the pages also produce valid WML when accessed by a WAP device. The Mobile:Form control is an abstraction of the page or form constructs of HTML and the card construct of WML. In WML, a card is similar to a page when rendered. However, several WML cards may comprise a single WML page, thus MIT applications often contain several Mobile:Form controls on a single page. The Mobile:Label control models a simple text string, which can be static as in Figure 1 or manipulated by code as in the Page_Load handler of Figure 2.

A MIT Application

ASP.NET and MIT provide numerous other Web controls and objects for building complete, robust applications. Using the MIT, the XML classes of the .NET framework, and one of my own Component Object Model (COM) components, I built a small, three-tiered, browser-based application that supports WAP and HTTP. The source code for this application can be downloaded from the MC Press Web site (see the sidebar at the end of this article for details). The application allows the user to query for a certain part number using the browser. The COM component accesses a file on an AS/400, providing availability information about the part. The Mobile:ObjectList control is then used to display the information in various ways and even allows WAP phones to dial the store where the part is available. Figures 3 and 4 show the application in action. These figures illustrate the differences between a MIT control's rendering on a WAP phone and an HTTP browser.

http://www.mcpressonline.com/articles/images/2002/GoodwinV200.png
Figure 3: The WAP/WML emulator tool from Openwave Systems displays the results of a query using the example application.


http://www.mcpressonline.com/articles/images/2002/GoodwinV201.png

Figure 4: The same results as in Figure 3 are rendered with Internet Explorer in HTML. (Click figure to enlarge.)

Using MIT, I created a single Web application that transparently supports both HTTP and WAP. Not only was I not required to discern the requesting client browser capabilities in the code, I also did not have to write a single line of WML. You may have noticed, however, that the HTML browser display in Figure 4 looks plain and slightly compressed. MIT controls are designed to be rendered on small displays such as Pocket PCs and mobile phones. Therefore, MIT controls produce compact content that is often embedded into a series of hyperlinked lists. These compact presentations suit WML browsers nicely, but they may be unreasonable for use in standard Web browsers. In fact, the MIT controls don't directly address many common Web page display elements, such as HTML tables, probably because tables can't be adequately formatted on mobile devices. MIT does support certain advanced formatting features not used in this simple application, such as stylesheets, to allow page designers to influence rendering on particular platforms.

MIT is an excellent tool for developers who need to create compact wireless Web applications quickly using the rich set of .NET classes and existing components.

Microsoft has done the heavy lifting to support WAP and HTTP simultaneously, allowing the programmer to concentrate on the application. Although Microsoft has not committed to new wireless applications protocols, it seems reasonable that it could easily extend MIT to new wireless platforms in the future.

Walter Goodwin is a software engineer at Amalgamated Software of North America (ASNA) in San Antonio, Texas, where he currently develops distributed systems software for enterprise platform developers. You can reach Walter at This email address is being protected from spambots. You need JavaScript enabled to view it..

References and Related Materials



Sidebar: Developing with Mobile Internet Toolkit

To get started with MIT and the general .NET Framework, you must be running Windows NT (with Service Pack 6a), Windows 2000 (with Service Pack 2), or Windows XP Professional. Before loading MIT, the .NET Framework Software Development Kit (SDK) should be installed. The .NET Framework includes ASP.NET, the XML classes, and all the general .NET Framework classes. You can download the .NET Framework SDK from the Microsoft Developer Network Web site, but be aware that the download is currently 131 MB. The Framework SDK is also available bundled with Microsoft's most recent IDE product, Visual Studio .NET. None of the code in the sample application was created with Visual Studio .NET, but it does contain many new tools, such as the Web Forms Designer, helpful for creating ASP.NET applications.

After the Framework has been installed, the MIT can be installed. MIT is a much smaller download (see References and Related Materials). Once installed, the MIT documentation page can be viewed with Internet Explorer (the document is named StartHere.htm, and it should be in the directory where MIT was installed).

When developing ASP.NET applications, note that ASP.NET files have the .aspx extension to distinguish the files from traditional ASP pages. The provided sample application has one ASP.NET file, PartSearch.aspx, containing the control templates and script code. This simple text file can be viewed with any text editor. The file should be installed into an Internet Information Server virtual directory, so that the file is accessible to a Web browser. For example, you should be able to access the file at http://localhost/locator/PartsSearch.aspx, where localhost is your machine name, and locator is the virtual directory containing the file.

PartsSearch.aspx is divided into three sections similar to the short examples of Figures 1 and 2: a header with <% %> page directives, a BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$0.00 Raised:
$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: