WAS v8.5 > Administer applications and their environment > Administer web services - Bus enabled web services > Enable web services through the service integration bus > Passing SOAP messages with attachments through the service integration bus

Locating an attachment using swaref

Use this task to locate message attachments by retrieving the message URI and removing cid: from the beginning of the retrieved value. When a Web Services-Interoperability (WS-I) Attachments Profile v1.0 message uses a SOAP with attachments reference (swaref) to refer to an attachment, the swaref might refer to either bound or non-bound attachments, and the swaref might refer to a single attachment several times. To enable you to locate the correct attachment, service integration technologies stores the value of the URI that is encoded in the message within the SDO data graph for the message body.

When storing the value of an element (or attribute) of type swaref in the data graph, service integration technologies stores the complete URI from the message instance. Therefore when we retrieve the URI you remove cid: from the beginning of the retrieved value to find the Content ID of the referenced attachment.


Example

The following example shows how to use the value of a swaref element to locate the correct attachment. This example uses the RPC/Literal WSDL and SOAP message from section 4.4 of Web Services-Interoperability (WS-I) Attachments Profile v1.0:

DataObject infoNode = graph.getRootObject().getDataObject("info");
String contentId = infoNode.getString("body/ClaimDetail/ClaimForm");

// Cut off the "cid:" part of the string
contentId = contentId.substring(4);

// Locate the value of the attachment
DataObject attachmentEntry =
    infoNode.getDataObject("attachments[contentId=" + contentId + "]");
byte[] data = attachmentEntry.getBytes("data");


Related concepts:

SOAP with attachments: A definition


Reference:

Map of SDO data graphs for web services messages


Related information:

SOAP Messages with Attachments: WSDL examples
Supporting bound attachments: WSDL examples


+

Search Tips   |   Advanced Search