使用 swaref 来查找附件

使用此任务以通过检索消息 URI 并从所检索值的开头移除 cid: 来查找消息附件。

关于此任务

Web Services-Interoperability (WS-I) Attachments Profile V1.0 消息使用带有附件引用的 SOAP (swaref) 来引用附件时,swaref 可能会引用绑定或非绑定附件,并且 swaref 可能会多次引用单个附件。为了使您能够找到正确的附件,服务集成技术将消息中编码的 URI 值存储在消息体的 SDO 数据图中。

当将 swaref 类型的元素(或属性)的值存储在数据图中时,服务集成技术将存储消息实例中的完整 URI。因此,检索 URI 时,应移除位于所检索到的值开头的 cid:,以便找到所引用的附件的内容标识。

示例

以下示例说明如何使用 swaref 元素的值来查找正确的附件。此示例使用 Web Services-Interoperability (WS-I) Attachments Profile V1.0 的 4.4 节中的 RPC/文字 WSDL 和 SOAP 消息:

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");

指示主题类型的图标 任务主题



时间戳记图标 最近一次更新时间: last_date
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=tjw_attach_locate
文件名:tjw_attach_locate.html