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:
The PortType element describes the type of operations. WSDL defines four types of operations:
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 WSDLThe limitations of WSDL are
|