Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The syntax of a WSDL suggests that it is a set of definitions where the definition element is at the root.

Lets Let us try to understand each element in a WSDL document using a HelloWorld.wsdl document. This is wsdl document which is automatically generated by Geronimo Eclipse Plugin(GEP). In the tutorials section we will learn how to generate it using Eclipse and GEP.
<code:title=HelloWorld.wsdl|borderStyle=solid}
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://webservices" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://webservices" xmlns:intf="http://webservices" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace="http://webservices" xmlns="http://www.w3.org/2001/XMLSchema">
<element name="hello">
<complexType/>
</element>
<element name="helloResponse">
<complexType/>
</element>
</schema>
</wsdl:types>

<wsdl:message name="helloRequest">

<wsdl:part element="intf:hello" name="parameters"/>

</wsdl:message>

<wsdl:message name="helloResponse">

<wsdl:part element="intf:helloResponse" name="parameters"/>

</wsdl:message>

<wsdl:portType name="HelloWorld">

<wsdl:operation name="hello">

<wsdl:input message="intf:helloRequest" name="helloRequest"/>

<wsdl:output message="intf:helloResponse" name="helloResponse"/>

</wsdl:operation>

</wsdl:portType>

<wsdl:binding name="HelloWorldSoapBinding" type="intf:HelloWorld">

<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

<wsdl:operation name="hello">

<wsdlsoap:operation soapAction=""/>

<wsdl:input name="helloRequest">

<wsdlsoap:body use="literal"/>

</wsdl:input>

<wsdl:output name="helloResponse">

<wsdlsoap:body use="literal"/>

</wsdl:output>

</wsdl:operation>

</wsdl:binding>

<wsdl:service name="HelloWorldService">

<wsdl:port binding="intf:HelloWorldSoapBinding" name="HelloWorld">

<wsdlsoap:address location="http://localhost:8080/SimpleWeb/services/HelloWorld"/>

</wsdl:port>

</wsdl:service>

</wsdl:definitions>

Code Block
  • <types>- Web Service is all about sending and receiving messages. The <types> element describes the various messages which will be used by the service. Basically it defines the various data types. As can be seen HelloWorld service uses hello and helloResponse as the two messages.
  • <message>- This element defines the various messages used by the web service. In our example we have two message name, helloRequest which is associated with hello data type and helloResponse which is associated with helloResponse data type as defined in the <types> element. Each message type has unique name which is suggested by <message name=""> tag. The <part element="" ...> suggests the data type associated with each message. <part> element can be considered as a parameter to a function call.
  • <portType>- This basically involves a set of operation and messages involved in each operation. <portType name=""> defines a unique name. In our example <wsdl:portType name="HelloWorld"> suggest a unique name. Each portType has an associated <operation name=""> element which suggest an operation name. In our example <wsdl:operation name="hello"> suggests an operation name. Each operation element can have <input>, <output> or both the tags accordingly it will be one-way, notification or request-response operation. Our example has <wsdl:input message="intf:helloRequest" name="helloRequest"/> which uses the helloRequest as the input message and <wsdl:output message="intf:helloResponse" name="helloResponse"/> which uses the helloResponse as the output message.
  • <bindings>-