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

Get the <Message> Element (cont.)
Similarly, there is a <message> element whose name attribute value matches the message attribute of <output> element. These message attribute values of <input> and <output> elements are actually referring to <message> elements. Each <message> element will have one or more <part> elements. Each part has name and type attributes. Think of each <part> as variable declarations in Java. Together, these <part> elements can be used to specify user-defined data types for messages.

Why match the name attribute value of <message> element with the message attribute value of <input> and <output> elements? Because <input> and <output> elements use their corresponding <message> elements to define what data types will actually travel over the Internet via SOAP. The <message> elements define the data types for the messages. Without finding the matching <message> element, you will not know what data types the Web service is expecting from you and what you can expect from the Web service in return.

WSDL uses messages to send "parameters" and "operation" (method) calls. Any number of messages and return (output) messages can be sent with a method invocation call.

 
Figure 5. The response from the WSDL implementation/SOAP server.

WSDL Parsing Strategy
The parsing should go something like this:

  • Find the <service> element and get the <binding>, <portType> element names as well as the SOAP server address.
  • Jump to the <binding> element by matching the binding name that was found in the <service> element, and get the SOAP action attribute value.
  • Find the <operation> element within the <binding> element and get its name, encoding style, and namespace values.
  • Jump to the <portType> element, by matching the portType name found in the <service> element, and get the <operation> element by matching the operation name found in <binding>.
  • Get the <operation> element's child <input> element and the "message" attribute value.
  • Jump to the <message> element by matching the name found in the <input> element.
  • Get the <part> elements found in the <message> element and retrieve the name and "type" attribute values from each <part>.
  • Repeat steps 5 to 7 for the <output> child element.
  • Repeat steps 3 to 7 for each <operation> element found in <binding>.

Parsing involves the use of Enhydra's kXML (refer to the parse() method in Listing 2). The complete WSDL file passes to a reader object, which then passes to an XMLParser object. The next step is to create a document object through this object. Calling the parse() method of the document loads the complete WSDL structure in DOM. Next, parse through the WSDL tags to construct the required operation and parameter objects.


Processing the WSDL File Authoring the Service Invocation Request

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