To create a mobile application that consumes the Web service, add a new Mobile ASP.NET application project to the solution. The opening screen of the application will contain links that redirect a user to the Reservation.aspx, ViewReservation.aspx, ModifyReservation.aspx, and CancelReservation.aspx pages. You will learn to create these pages in the following sections.
Because this application will consume the Web services that you have created, add a Web reference to the Web service. After you have created links to the preceding pages, the MobileWebform1.aspx page should look like Figure. The figure shows the MobileWebform1.aspx page in the Internet Explorer window.
The Opening Page of the Mobile Application.
Note?/td>In this chapter, you will be using Internet Explorer to view and debug the mobile application. However, you can also use a mobile phone emulator.
The Opening Page of the Mobile Application in a Mobile Emulator.
The code for the ASP.NET application in the mobileWebform1.aspx file is as shown:
The MakeReservations Page
The mobile application contains a MakeReservations page that allows a user to make reservations. In addition, this page allows the user to specify the data required to make a reservation. The data that the user needs to enter in the MakeReservations page is shown in the following list:
Tip?/td>In a mobile application, the user should type as little as possible because it is difficult to enter lengthy pieces of text into a mobile phone. Therefore, instead of using text boxes, try to use other user-interface controls, such as option buttons, list boxes, and so on.
Adding Controls to the MakeReservations Page
The MakeReservations page contains three Panel controls. Initially, only Panel1 is visible. The first panel contains all user-interface elements, which allows the user to specify the data as discussed in the previous list. In addition, Panel1 contains a Button control, which the user needs to click after specifying the required data. Clicking on the Button control invokes the GetRate() Web method. The Panel1 control is displayed in Figure.
Panel1 of the Reservation.aspx Page in Design View.
When the GetRate() method returns a value, Panel1 becomes invisible and the control is passed to Panel2. The Panel2 control displays the fare that is charged to the customer. Figure shows the Panel2 control in Design view.
Panel2 of the Reservation.aspx Page in Design View.
The Panel2 control allows a user to either return to Panell or click on the Make Reservation button to make a reservation. Clicking on this button invokes the MakeReservation() Web method. This method displays the third panel control, Panel3, which allows the user to return to the opening screen. The Panel3 control is displayed in Figure.
Panel3 of the Reservation.aspx Page in Design View
Adding Code to the MakeReservations Page
After you add controls to the form, you need to add the code to the MakeReservations page. The code for the MakeReservations page follows:
The preceding code snippets from the Reservation.aspx.vb file specify the action that takes place whenever an event occurs on the page. For example, when the page loads, the page makes a call to the GetVehicleTypes() Web method and populates the list box with the values that the method returns. To do this, you need to create an instance of the Web service proxy class, which would have been created when you added a Web reference to the Web service. This is done by declaring an instance in the class as shown in the following code snippet:
Next, initialize the ws object in the Page_Load event handler and call the GetVehicleTypes() Web method as shown in the following code:
After you add the code to the Page_Load event handler, the entire code for the Reservation.aspx.vb file is as shown:
The CancelReservation Page
A user can cancel a reservation in the CancelReservation page. To do this, the user needs to specify the name and the key value. The CancelReservation page looks like Figure.
The CancelReservation Page.
The code listing of the CancelReservation.aspx page is as shown:
The CancelReservation page contains a Cancel Reservation button. When a user clicks on this button, the CancelReservation() Web method is called. The code for the CancelReservati on.aspx.vb page is as shown:
The ModifyReservation Page
In the ModifyReservation page, you can modify the details of a reservation. However, before you modify the details of a reservation, you first need to retrieve a specified record. To do this, add two TextBox controls that accept the name of a customer and the customer key. In addition, add a Button control that retrieves the record from the database.
After you add the controls, modify the code for the ModifyReservation page as shown in the following code sample:
When a user clicks on the Button control in the ModifyReservation page, the details of the reservation are displayed. You can make the desired changes to the data and click on the Save Data button. The modifications that you make are saved to the database. The code for the ModifyReservation.aspx.vb page is as shown:
The ViewReservation Page
The ViewReservation page allows you to view the details of a specified reservation. For this, you need to specify the customer name and customer key. The code for the ViewReservation page is as follows:
When the user specifies the required information and clicks on the Get Reservations Details button, the reservation details are shown in the Panel2 control of the ViewReservation page. The code for the ViewReservation.aspx.vb page is as follows:
With this, the mobile application is ready.
XML Related Interview Questions
|Soap Tool Interview Questions||HTML Interview Questions|
|PHP Interview Questions||ASP.NET Interview Questions|
|PHP5 Interview Questions||Java Interview Questions|
|CSS Interview Questions||XSLT Interview Questions|
|Java XML Interview Questions||XMLHttpRequest (XHR) Interview Questions|
|ebXML Interview Questions||XML DOM Interview Questions|
|XML-RPC Interview Questions||XSD Interview Questions|
|Soap Web Services Interview Questions||XSL Interview Questions|
|Xml Publisher Interview Questions|
Basics Of Xml
Basics Of Web Services
Introduction To Soap
Introduction To Uddi
Introduction To Wsdl
Creating A Web Service Using The Microsoft Soap Toolkit
Building Web Applications On The .net Platform
Creating An Asp.net Web Service
Creating A Web Service From An Interface
Introduction To The Atl Server
Creating A Web Service Using The Atl Server Library
Design And Creation Of The Knowledge Share Web Service
Introduction To Java Xml Technologies
Developing Java Web Services
Design And Creation Of A Web Service Using The Ibm Toolkit
Introduction To Mobile Applications
Creating A Mobile Application That Consumes A Web Service
Web Services Development With Jdeveloper
Creating Web Services Using Perl
Integration Of Xml Web Services With The Office Xp And Sql
Server 2000 Toolkits
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.