As discussed in the case study, the individual bookstores use the Office XP-based solution to maintain their daily transactions. The following steps discuss the transactions that take place at the bookstores of JB Book Sellers.
Calling Web Services from an Office XP Application
Before you call Web services from an Office XP application, you need to create a Microsoft Access application. Therefore, it's necessary to add the support for the Web service. The Microsoft Access application contains an OrderDetails form. The form is shown in Figure.
The OrderDetails Form
As you can see, the OrderDetails form contains text boxes that accept user input for ZIP Code, E-mail, Credit Card, and Card Type. The ZIP Code needs to be validated against the state and the city, as specified by the user. The e-mail address needs to be verified and, finally, the credit card number needs to be checked for Mod 10 compliance. When the credit card number is validated, the card type is detected and filled in the text box.
You can use the existing Web services to perform the preceding tasks. You can search for information about these Web services in the UDDI directory. As you know, however, UDDI is too cluttered with false and junk data.
NoteWeb sites such as SalCentral and XMethods are commonly used sites for searching information about Web services and their features.
Adding Reference to a Web Service
To call a Web service from an Office XP application, perform the following steps:
The Office's Internal VBA Editor
Notice that installing the Web services toolkit has resulted in a change in the Add Web Services References option in the Tools menu.
The Add Web Services References Option
This window is similar to the Add Web Reference dialog box in Visual Studio .NET that is used to add a Web reference to a Web service from a .NET application.
Note:This dialog box allows you to search for various UDDIs of a service by using business or service types or keywords.
Note :If the Web service that is found is grayed out, it implies that a Web method of the Web service returns a complex type variable, which Office XP doesn't support.
The Web Service References Tool in this case creates a class module with the name clsws_CreditCardValidator. The code for the clsws_ CreditCardValidator file contains two sections. The first part contains comments that describe the details of the class module. The next section discusses the instructions to declare and instantiate this class in the code. The code for the class module is shown in the following example:
Next, two internal class variables are initialized to the SoapClient proxy object and the URL of the .wsdl file, respectively. This SoapClient proxy object is used to exchange XML Web service calls between the client application and the Web server.
Note :The SoapClient proxy class variable is prefixed with sc_, whereas the name of the variable initialized to the URL is always c_WSDL_URL.
The code for the class variables is as follows:
The preceding code creates a SoapClient object and initializes it with the URL of the Web service represented by the proxy class. However, if your application accesses the Web through a proxy server, you need to add the following code that provides the credentials for authentication by the proxy server or the corporate firewall:
Next, the Class_Terminate event is used to deallocate memory to resources that are no longer used. For example, when the SoapClient proxy object is no longer used, its memory is deallocated by using the Class_Terminate event, as shown in the following code:
In the preceding code, the CreditCardValidatorErrorHandler subroutine is used to handle the errors generated by the Web server hosting the Web service. As you can see, the name of the subroutine contains the keyword ErrorHandler preceded by the name of the Web service, CreditCardValidator.
Finally, declare the methods in the Web service. It is important to note that Web methods created by the Web Service References Tool are always public, prefixed with wsm_ followed by the Web method name, and list input parameters with a data type prefix followed by the Web method parameter.
The code that the Web Service References Tool generates for the Web methods is as follows:
Adding Code to the Validate Credit Card Button
After you add a reference to the Credit Card validation Web service, add the following code for the Validate Credit Card button:
The preceding code creates an instance of the proxy class. First, the code checks whether the credit card number is a valid number and retrieves the card type. Then it displays the card type in the Card Type text box.
Adding a Web Service to Validate the E-Mail
Similarly, you can add references to the Web services that validate the e-mail address.
After you have created the proxy for the mxchecker Web service, you can call its methods, as shown in the following code:
Adding a Web Service to Validate the ZIP Code
To enable validation of the ZIP Code, a Web service at http:// services. pagedownweb. com/ZipCodes.asmx?WSDL offers methods that accept a ZIP Code and state or a ZIP Code and city as parameters. This Web service returns True or False after validation. The code for invoking the Web service at the click of a button is shown in the following sample:
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.