WSDL anatomy
WSDL files are written in XML. To learn more about XML, see Web services: Resources for learning.
A WSDL contains the following parts...
- Web service interface definition
This is where the elements are contained, as well as the namespaces.
- Web service implementation
This is where you find the definition of the service and ports.
A WSDL file describes a Web service with the following elements...
portType
The description of the operations and their associated messages. PortTypes define abstract operations
<portType name="EightBall"> <operation name="getAnswer"> <input message="ebs:IngetAnswerRequest"/> <output message="ebs:OutgetAnswerResponse"/> </operation> </portType>
message
The description of parameters (input and output) and return values
<message name="IngetAnswerRequest"> <part name="meth1_inType" type="ebs:questionType"/> </message> <message name="OutgetAnswerResponse"> <part name="meth1_outType" type="ebs:answerType"/> </message>
types
The schema for describing XML complex types used in the messages
<types> <xsd:schema targetNamespace="..."> <xsd:complexType name="questionType"> <xsd:element name="question" type="string"/> </xsd:complexType> <xsd:complexType name="answerType"> ... </types>
binding
Bindings describe the protocol used to access a service, as well as the data formats for the messages defined by a particular portType
<binding name="EightBallBinding" type="ebs:EightBall"> <soap:binding style="rpc" transport="schemas.xmlsoap.org/soap/http"> <operation name="ebs:getAnswer"> <soap:operation soapAction="urn:EightBall"/> <input> <soap:body namespace="urn:EightBall" ... /> ...The remaining parts, services and ports, indicate where you can find the WSDL.
Service
Contains the Web service name and a list of the ports.
Ports
Contains the location of the Web service and the binding to used to access the service.<service name="EightBall"> <port binding="ebs:EightBallBinding" name="EightBallPort"> <soap:address location="localhost:8080/axis/EightBall"/> </port> </service>