22 srpna 2005

Knowledge base:Web Service Description Language - WSDL

WSDL is XML document which describes the web service. Specification is at http://www.w3.org/TR/wsdl. It consists of following parts

Type definition


<types>
<xsd:schema xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="p0" nillable="true" type="xsd:string"/>
<xsd:element name="string_Response" nillable="true" type="xsd:string"/>
</xsd:schema>
</types>

which defines 'p0' element and 'string_Response', both could contain any string.

Message definition

<message name="HelloService_hello_Request_Soap">
<part element="ns0:p0" name="p0">
</message>
<message name="HelloService_hello_Response_Soap">
<part element="ns0:string_Response" name="response"/>
</message>

This defines two types of messages. The part element attribute refers to the type definition of 'p0' and 'string_Response' elements defined in types section.

Port definition

<porttype name="HelloService">
<operation name="hello" parameterorder="p0">
<input message="tns:HelloService_hello_Request_Soap"/>
<output message="tns:HelloService_hello_Response_Soap"/>
</operation>
</porttype>

This defines the set of abstract operations and the abstract messages involved. message attribute refers to the previously defined 'messageHelloService_hello_Request_Soap' and 'HelloService_hello_Response_Soap' from message section.

binding definition

<binding name="HelloService" type="tns:HelloService">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="hello">
<soap:operation
style="document"/>
<input>
<soap:body parts="p0" use="literal"/>
</input>
<output>
<soap:body parts="response" use="literal"/>
</output>
</operation>
</binding>

This defines the message format and protocol details. The "document" style is used (also "rpc" is an option) and literal style in message body is used (also "encoded" is an option). An operation element specifies binding information for the operation with the same name within the portType.

Service definition

<service name="HelloService">
<port binding="tns:HelloService" name="HelloService">
<soap:address location="urn:unknown-location-uri"/>
</port>
</service>
Service groups ports. Each port defines an individual endpoint. Port with name "HelloService" refers to "HelloService" binding in 'binding' attribute.

Žádné komentáře: