在处理JAX-WS Web服务中的附件时,我需要一些帮助。我必须根据现有的WSDL创建Web服务。
在一种方法中,我必须处理SWA附件(将文件保存到磁盘)。这是包含附件信息的请求的一部分:
<ns3:attachments>
<ns0:attachment href="cid:123456" contentId="cid:123456" action="add" name="example.txt" type="text/plain" len="199" />
</ns3:attachments>
以下是示例HTTP请求:
MIME-Version: 1.0
Content-Type: Multipart/Related; boundary=------=_Part_11_22559283.1574169251187; type=text/xml;
start="<http://test-service.com>"
Content-Description: This is the optional message description.
Content-Location: http://test-service.com/
------=_Part_11_22559283.1574169251187
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-ID: <ROOTPART@SOAPUI.ORG>
<?xml version='1.0' ?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
..
<ns0:attachment href="cid:123456" contentId="cid:123456" action="add" name="example.txt" type="text/plain" len="199" />
..
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
------=_Part_11_22559283.1574169251187
Content-Type: text/plain
Content-Transfer-Encoding: binary
Content-ID: <123456>
Content-Disposition: attachment; name="soapui-log4j.xml"; filename="soapui-log4j.xml"
...binary content of txt file...
------=_Part_11_22559283.1574169251187
如何将example.txt文件保存到磁盘?我必须使用SWA(而不是SWA参考)。