我正在使用 Python 和 Suds 来使用 SOAP Web 服务,有时,当响应数据太大时,它会将响应格式切换为WS-Attachment
. 它应该是完整的 MIME 消息,但相反,我只得到“边界”部分,如下所示:
------=_Part_2_27050467.1235668849951
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: binary
Content-Id: <0F082AF1DAF83B3077B1867B4FC8AAA6>
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:runReportResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://axis2.ws.jasperserver.jaspersoft.com">
<runReportReturn xsi:type="xsd:string"><?xml version="1.0" encoding="UTF-8"?>\n<operationResult version="2.0.1">\n\t<returnCode><![CDATA[0]]></returnCode>\n</operationResult>\n
</runReportReturn>
</ns1:runReportResponse>
</soapenv:Body>
</soapenv:Envelope>
------=_Part_2_27050467.1235668849951
Content-Type: application/pdf
Content-Transfer-Encoding: binary
Content-Id: <report>
%PDF-1.4\n%âãÏÓ\n1 0 obj <</Filter/FlateDecode/Length 29>>stream\nx+är\ná26S°00S\bIár\rá\näâ
如何正确提取响应的两个部分?Python 的电子邮件模块类都不能很好地处理这些数据,他们都认为这是一个大字符串。我期待类似的东西:
MIME-Version: 1.0
Content-Type: Multipart/Related; boundary=_Part_2_27050467.1235668849951; type=text/xml;
start="<some@domain.com>"
Content-Description: This is the optional message description.
在响应的开始,但只有那个进来。