+

Search Tips   |   Advanced Search

Supporting bound attachments: WSDL examples

Use this task to see examples of WSDL fragments with Web Services-Interoperability (WS-I) Attachments Profile Version 1.0 encoding and SOAP Messages with Attachments encoding.

Web Services-Interoperability (WS-I) Attachments Profile Version 1.0 defines a convention for constructing the Content ID for a bound attachment. This convention encodes the message part name. Consequently, service integration technologies can recognize a bound attachment whether or not the SOAP body contains elements representing that message part. The convention for constructing a Content ID is as follows:

name=uuid@domain
where name is the name of the message part being used encoded, uuid is a globally unique identifier, and domain is a domain identifier (for example my.example.com).

This approach differs from the SOAP Messages with Attachments encoding scheme, which does not define a conventions for the Content ID but does use elements within the SOAP body to indicate that the message part is encoded as an attachment.

In order to distinguish between the cases, service integration technologies assumes that if a message attachment follows the Version 1.0 convention for constructing the Content ID, then it is a Version 1.0 message.


Example

The following WSDL fragment is for a bound attachment, with message instances that follow both styles:

<wsdl:binding name="BoundSoapBinding" type="intf:BoundPortType">
    <soap:binding style="rpc"
                  transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="bound">
      <soap:operation soapAction=""/>
      <wsdl:input>
        <mime:multipartRelated>
          <mime:part>
            <soap:body parts="stringIn" namespace="http://bound"
                       use="literal"/>
          </mime:part>
          <mime:part>
            <mime:content part="attachIn" type="text/xml"/>
          </mime:part>
        </mime:multipartRelated>
      </wsdl:input>

The following WSDL fragment is for a SOAP instance that uses Version 1.0 encoding. In this fragment, the message body contains no mention of the attachIn part, and the Content ID of the attachment identifies the part being used encoded.

--myBoundary
Content-Type: text/xml
Content-Transfer-Encoding: 7bit
Content-Id: <myStartID>

<SOAP-ENV:Envelope
 xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Body>
    <ns0:bound xmlns:ns0="http://bound">
      <stringIn>some string data</stringIn>
    </ns0:bound>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

--myBoundary
Content-Type: text/xml
Content-Transfer-Encoding: 7bit
Content-Id: <attachIn=someUUID@some.domain.name>

<someOtherXMLElement/>
--myBoundary--

The following WSDL fragment is for a SOAP instance that uses SOAP Messages with Attachments encoding. In this fragment, the message body does contain a reference to the bound attachment, and the Content ID of the attachment is not constrained.

--myBoundary
Content-Type: text/xml
Content-Transfer-Encoding: 7bit
Content-Id: <myStartID>

<SOAP-ENV:Envelope
 xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Body>
    <ns0:bound xmlns:ns0="http://bound">
      <stringIn>some string data</stringIn>
      <attachIn href="cid:notTheStart"/>
    </ns0:bound>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

--myBoundary
Content-Type: text/xml
Content-Transfer-Encoding: 7bit
Content-Id: <notTheStart>

<someOtherXMLElement/>
--myBoundary--

In the previous two cases there is sufficient information in the message to identify the bound attachment, and in both cases service integration technologies places a bound attachment entry in the attachments list, and places the data from the attachment into the body section of the data graph.


Related:

  • SOAP with attachments: A definition
  • Mapping of SDO data graphs for web services messages
  • Locating an attachment using swaref
  • SOAP Messages with Attachments: WSDL examples