WebSphere WebSphere Application Server Network Deployment, Version 6.1.x Operating Systems: AIX, HP-UX, i5/OS, Linux, Solaris, Windows, z/OS

SOAP Messages with Attachments: WSDL examples

Example

The following example WSDL illustrates a simple operation that has one attachment called attch:

<binding name="MyBinding" type="tns:abc" >
  <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
  <operation name="MyOperation">
    <soap:operation soapAction=""/>
    <input>
      <mime:multipartRelated>
        <mime:part>
          <soap:body parts="part1 part2 ..." use="encoded" namespace="http://mynamespace"
            encodingStyle="http://schemas.xmlsoap.org/soap/encoding"/>
        </mime:part>
        <mime:part>
          <mime:content part="attch" type="text/html"/>
        </mime:part>
      </mime:multipartRelated>
    </input>
  </operation>
</binding>
In this type of WSDL extension:
  • There must be a part attribute (in this example attch) on the input message for the operation (in this example MyOperation). There can be other input parts to MyOperation that are not attachments.
  • In the binding input there must either be a <soap:body> tag or a <mime:multipartRelated> tag, but not both.
  • For MIME messages, the <soap:body> tag is inside a <mime:part> tag. There must only be one <mime:part> tag that contains a <soap:body> tag in the binding input and that must not contain a <mime:content> tag as well, because a content type of text/xml is assumed for the <soap:body> tag.
  • There can be multiple attachments in a MIME message, each described by a <mime:part> tag.
  • Each <mime:part> tag that does not contain a <soap:body> tag contains a <mime:content> tag that describes the attachment itself. The type attribute inside the <mime:content> tag is not checked or used by the service integration bus. It is there to suggest to the application using the service integration bus what the attachment contains. Multiple <mime:content> tags inside a single <mime:part> tag means that the back end service expects a single attachment with a type specified by one of the <mime:content> tags inside that <mime:part> tag.
  • The parts="..." attribute inside the <soap:body> tag is assumed to contain the names of all the SOAP parts in the message, but not the attachment parts. If there are only attachment parts, specify parts="" (empty string). If you omit the parts attribute altogether, then the service integration bus assumes ALL parts including the attachments - which causes the attachments to appear twice.

In your WSDL you might have defined a schema for the attachment (for instance as a binary[]). The service integration technologies silently ignore this mapping and treat the attachment as a Data Handler.

You do not need to mention unreferenced attachments in the WSDL bindings.

Related concepts
SOAP with attachments - a definition
Related tasks
Locating an attachment using swaref
Supporting bound attachments: WSDL examples
Related reference
Mapping of SDO data graphs for Web services messages

Task topic

Terms of use | Feedback


Timestamp icon Last updated: 26 February 2009
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.pmc.nd.multiplatform.doc/tasks/tjw_attach_wsdl.html

Copyright IBM Corporation 2004, 2009. All Rights Reserved.
This information center is powered by Eclipse technology. (http://www.eclipse.org)