我正在与SOAP API建立集成。另一面迫使我使用SWA(带有附件https://www.w3.org/TR/SOAP-attachments的SOAP)。我不能使用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 pars定义的attachemnts部分:
<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>