Marcus Junius Brutus
Marcus Junius Brutus

Reputation: 27286

WSDL - understanding message definitions

I am trying to understand the structure of wsdl definitions, looking at the example found here.

I get the service, portType and operation parts, it's at the messages where I have a problem "reading" the specification.

So, just focusing at a single message (multiply), and ignoring the rest, I see a structure like:

<wsdl:definitions..>
  <wsdl:types>
    <xsd:schema>

      <xsd:element name="multiply" type="tns:multiply"/>
      <xsd:complexType name="multiply">
          ...
      </xsd:complexType>

     </xsd:schema>
   </wsdl:types>
   ...
   <wsdl:message name="multiply">
      <wsdl:part element="tns:multiply" name="parameters"/>
   </wsdl:message>
   ...
   <wsdl:portType>
   ...
   </wsdl:portType> 
   <wsdl:service>
   ...
   </wsdl:service>
</wsdl:definitions>

Can anyone provide a sentence explaining what multiply is, beginning with: "multiply is a message that's ..." ??

Moreover, could somebody explain how many uses of the name "multiply" we have? I think there are multiple and we seem to avoid clashes through the use of XML namespaces and perhaps different "namespaces" for XML elements and types.

Upvotes: 0

Views: 2116

Answers (1)

John Saunders
John Saunders

Reputation: 161783

multiply is a message containing a single part, named parameters, consisting of the single element, tns:multiply. That element is of type tns:multiply.

I used XMLspy to fill this example out a bit:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
   xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
   xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
   xmlns:tns="http://new.webservice.namespace" targetNamespace="http://new.webservice.namespace">
    <wsdl:types>
        <xs:schema targetNamespace="http://new.webservice.namespace" elementFormDefault="qualified">
            <xs:complexType name="multiply">
                <xs:sequence>
                    <xs:element name="x" type="xs:int"/>
                    <xs:element name="y" type="xs:int"/>
                </xs:sequence>
            </xs:complexType>
            <xs:element name="multiply" type="tns:multiply"/>
        </xs:schema>
    </wsdl:types>
    <wsdl:message name="multiply">
        <wsdl:part name="parameters" element="tns:multiply"/>
    </wsdl:message>
    <wsdl:portType name="NewPortType">
        <wsdl:operation name="NewOperation">
            <wsdl:input message="tns:multiply"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="NewBinding" type="tns:NewPortType">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="NewOperation">
            <soap:operation soapAction="urn:#NewOperation"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="NewService">
        <wsdl:port name="NewPort" binding="tns:NewBinding">
            <soap:address location="No target address"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

This leads to the following SOAP request:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Body>
        <m:multiply xmlns:m="http://new.webservice.namespace">
            <m:x>0</m:x>
            <m:y>0</m:y>
        </m:multiply>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Upvotes: 1

Related Questions