WSDL

Now you know that messages are passed around in a SOAP XML format. But how do you know the format in which the Web Service XML message should be sent? Is it the same for all Web Services? Where are these services located to establish contact and what methods do the services allow? Here Web Services Definition Language (WSDL) comes into the picture. WSDL also is an XML-based language.

WSDL is used to describe and locate Web Services. It defines the format of the information sent to the user. WSDL mainly defines the information needed from the invoking client when the client invokes a service, and the way in which the user will provide the required information. However, unlike SOAP, WSDL is not yet a W3C standard. Sound knowledge of XML and XML Schema is essential to work with WSDL.

As in SOAP, an XML message defined in WSDL consists of the following elements:

  • Types This field defines the data types that will be used by the Web Service. WSDL uses XML syntax to maintain data neutrality.

  • Message This element defines the data elements of an operation. Any message can contain more than one part.

  • PortType The Web Service is defined by this element. Therefore, PortType is considered to be the most important element. This element defines the operations a Web Service can perform and the messages involved.

  • Binding This element defines the element type and the protocol to be used for that kind of an element.

The PortType element describes the type of operations. WSDL defines four types of operations:

  • One-way These operations can send a request but cannot expect a response.

  • Request-response This kind of an operation sends requests and gets corresponding responses.

  • Notification With this type of operation, a request or message is sent, but the system does not await a response.

  • Solicit-response A request or message sent will wait for a response.

In short, when you send a one-way request, there will be only one message element for the sending message. Also, the operation element will have only one child element for the input variable of the message. However, for a request-response operation, there will be two messages, one for the request and one for the response defined in the WSDL, and both input and output variables will be defined.

An example of a WSDL document is

 <message name="getTermRequest">     <part name="term" type="xs:string"/> </message> <message name="getTermResponse">    <part name="value" type="xs:string"/> </message> <portType name="glossaryTerms">   <operation name="getTerm">       <input message="getTermRequest"/>       <output message="getTermResponse"/>   </operation> </portType> 

Limitations of WSDL

The limitations of WSDL are

  • WSDL requires in-depth knowledge of XML and XML Schema. The syntax tends to get very difficult.

  • There is no standard for the options that each WSDL toolkit supports. There are differences in the encoding, types derived by restriction, and the SOAP Action header overloading.

  • Good client development using WSDL would require turning XML Schema definitions into useful stubs, which is a difficult task.



Sams Teach Yourself BEA WebLogic Server 7. 0 in 21 Days
Sams Teach Yourself BEA WebLogic Server 7.0 in 21 Days
ISBN: 0672324334
EAN: 2147483647
Year: 2002
Pages: 339

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net