Search code examples
wsdlabstraction

Why WSDL introduce wsdl:message?


Why WSDL introduces wsdl:message? And message parts?

What the advantage they could bring over the direct using of the XSD in the operations parameters (input, output, fault)?

How they (wsdl messages with wsdl message parts) can be more abstract then XSD?

Why it is not organized for example that way:

<operation name="GetEndorsingBoarder"> 
  <input type="xsd:string"/> 
  <output type="xsd:string, xsd:int, xsd:boolean"/> 
  <fault "type="xsd:string""/> 
</operation>

Solution

  • I got it:

    Messages not just specify operation's parameters.

    Messages and theirs parts are referred in the bindings. It should be possible to bind different parts differently:

    <message name="m1">
        <part name="body" element="tns:GetCompanyInfo"/>
    </message>
    
    <message name="m2">
        <part name="body" element="tns:GetCompanyInfoResult"/>
        <part name="docs" type="xsd:string"/>
        <part name="logo" type="tns:ArrayOfBinary"/>
    </message>
    
    <portType name="pt1">
        <operation name="GetCompanyInfo">
           <input message="m1"/>
           <output message="m2"/>
        </operation>
    </portType>
    
     <binding name="b1" type="tns:pt1">
            <operation name="GetCompanyInfo">
               <soap:operation soapAction="http://example.com/GetCompanyInfo"/>
               <input>
                   <soap:body use="literal"/>
               </input>
               <output>
                   <mime:multipartRelated>
                       <mime:part>
                           <soap:body parts="body" use="literal"/>
                       </mime:part>
                       <mime:part>
                           <mime:content part="docs" type="text/html"/>
                       </mime:part>
                       <mime:part>
                           <mime:content part="logo" type="image/gif"/>
                           <mime:content part="logo" type="image/jpeg"/>
                       </mime:part>
                   </mime:multipartRelated>
               </output>
            </operation>
        </binding>
    

    I have missed this since "non SOAP 'literal'" bindings are so uncommon.