1

我正在使用 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">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\n&lt;operationResult version=&quot;2.0.1&quot;&gt;\n\t&lt;returnCode&gt;&lt;![CDATA[0]]&gt;&lt;/returnCode&gt;\n&lt;/operationResult&gt;\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.

在响应的开始,但只有那个进来。

4

0 回答 0