【发布时间】:2020-03-07 01:22:07
【问题描述】:
我正在构建与 SOAP API 的集成。第二方面迫使我使用 SWA(带有附件的 SOAP https://www.w3.org/TR/SOAP-attachments)。我不能使用 MTOM。它也不是 SWA-Ref(?)。我用 Eclipse 和 Apache CXF 成功生成了 SOAP 客户端和 SOAP 服务器。简单消息与基本身份验证和 HTTPS 完美配合。
我需要处理附件。我的 SOAP 客户端必须发送文件,我的服务器必须接收和保存文件。 JAX-WS 可以处理 MIME 附件吗?
这是示例 SOAP 消息的一部分:
<ns3:attachments>
<ns0:attachment href="cid:5d1499240031a00380006998" contentId="cid:5d1499240031a00380006998" action="add" name="example.txt" type="text/plain" len="88" />
</ns3:attachments>
这是定义附件部分的 WSDL 解析:
<xs:complexType name="AttachmentType">
<xs:attribute name="href" type="xs:string" use="optional"/>
<xs:attribute name="contentId" type="xs:string" use="optional"/>
<xs:attribute name="action" type="xs:string" use="optional"/>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="type" type="xs:string" use="required"/>
<xs:attribute name="len" type="xs:int" use="optional"/>
<xs:attribute name="charset" type="xs:string" use="optional"/>
<xs:attribute name="upload.by" type="xs:string" use="optional"/>
<xs:attribute name="upload.date" type="xs:string" use="optional"/>
<xs:attribute name="attachmentType" type="xs:string" use="optional"/>
</xs:complexType>
<xs:complexType name="AttachmentsType">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="attachment" type="AttachmentType"/>
</xs:sequence>
</xs:complexType>
【问题讨论】:
标签: java soap jax-ws attachment