Designing a WSDL Client, Discovering Web Services (cont.)

Authoring the Service Invocation Request
After parsing the complete WSDL file, load it into a WSDLClient object. As shown in Figure 4, each <operation> becomes an object of the Operation class and each <message> element becomes an object of the Parameter class. The Operation class is also capable of coordinating with SOAP and HTTP classes to send method invocation calls.

 
Figure 6. One object of the WSDLClient holds several Operation objects. Each Operation object holds input and output Parameter objects.

Take a look at the following three methods of the Operation class:

  • SetValue()
  • Send()
  • GetBody()

These three methods provide an easy way of authoring SOAP service invocation requests for any Operation object. Once the WSDL files are parsed and their data structures (which are essentially Operation objects that contain Parameter objects) are loaded, call the setValue() method of the Operation class to provide parameter values. To send the SOAP method invocation request, call the send() method of the Operation class. Internally, the Send() method uses the getBody() method to author the SOAP Body. It then sends the request, waits for the SOAP response, and returns it when received. There's no need to worry about SOAP request authoring because the WSDL client hides SOAP-related functionality from its users.

Using the Applet Container
Listing 5 is an applet-based container for the WSDL client. It represents the GUI shown in Figure 3.

To test this applet:

  1. Type the URL of the WSDL file in the text box labeled "Enter WSDL file URL". For example type http://www.mywebservice.com/mywsdl.wsdl.
  2. Type the SOAP server address in text box labeled "Enter SOAP server URL". For example type http://www.mywebservice.com/soap. This information may also be contained within the WSDL file (within the SOAP:address element). In that case, entering the full URL is optional.
  3. Press the "Download WSDL" button. This populates the method list with service method names.
  4. Select a method from the methods list for making a call. The parameters required are shown in the parameter window.
  5. Enter the parameter values in the parameter window.
  6. Press the "Invoke Method" button. This executes the call. The server response of your call is shown in the output window.

Bilal Siddiqui is an Electronics Engineer, an XML consultant, and the co-founder of WaxSys, a company focused on simplifying e-Business. He is a technology evangelist and frequently-published technical author. You can contact Bilal at bsiddiqui@waxsys.com.

Resources for this Article
W3C WDSL Specifications
W3C SOAP Specifications
kXML from Enhydra.org
Good Overview Article on SOAP from Sun
PerfectXML.com: Good Tutorials and Articles
An Interesting Open Source Java-based Implementation of a UDDI Registry
Using UDDI as a Search Engine
Building Web Services with Java: Making Sense of XML, SOAP, WSDL and UDDI from SAMS


Back to the Introduction

In this Article
Introduction WSDL Parsing Strategy
Processing the WSDL File Authoring the Service Invocation Request
 





FEATURE SOFTWARE:
dtSearch Web
Add power searching to your web site.
Buy Now!

Encrypt It
Encrypt and Decrypt Data, Passwords and Files within your application.
Buy Now!

Standards Organizations and Web Service Coalitions

Key Platforms

Pure-Play Web Services Vendors

Web Service Technologies or Components

From Sun.com

For Further Reading

Discussion Groups
Java Web Services
.NET Web Services

Back to the Special Report

Java Zone

2001 Special Report: Judging Java

TALK BACK
What's your reaction to this article: "Wow! Free reusable WSDL code!" or "Who cares?" Are you actively building Web services in Java now? Do you think WSDL is a reasonable way to describe Web services? Should Sun support Web services as an integral component of J2EE, or is it too soon to tell? Let us know in the Java Web Services discussion group.


Sponsored Links

Advertising Info  |   Member Services  |   Contact Us  |   Help  |   Feedback  |   Site Map
Jupiterweb networks

internet.comearthweb.comDevx.comClickZ

Search Jupiterweb:

Jupitermedia Corporation has four divisions:
JupiterWeb, JupiterResearch, JupiterEvents, and JupiterImages

Copyright 2004 Jupitermedia Corporation All Rights Reserved.
Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Jupitermedia Corporate Info | Newsletters | Tech Jobs | E-mail Offers

Copyright Information/Privacy Statement