 |
| |
| 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.
|
|
|
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!
|
|
|