3

我正在尝试获取内容/保存 webservice 返回的 zipfile 。但是,似乎 API 提供了以 Base64 二进制格式编码的文件,并根据 SOAP MTOM 标准包含在响应中。我已经尝试了 2 个小时的一些解决方法,因此我们将不胜感激任何帮助。响应如下所示:

--MIMEBoundaryurn_uuid_9ADB5E0C3BD2353F98133706376435374151
Content-Type: application/xop+xml; charset=utf-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <0.urn:uuid:9ADB5E0C3BD2353F98133706376435374152>
<?xml version='1.0' encoding='UTF-8'?><downloadFileResponse xmlns="http://www.pe.com/marketplace/services"><ack>Success</ack><version>1.1.0</version><timestamp>2012-05-15T06:36:04.353Z</timestamp><fileAttachment><Size>3204907</Size><Data><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:urn:uuid:FED4FAD1B1E74C8B391337063821260"/></Data></fileAttachment></downloadFileResponse>

--MIMEBoundaryurn_uuid_9ADB5E0C3BD2353F98133706376435374151
Content-Type: application/zip
Content-Transfer-Encoding: binary
Content-ID: <urn:uuid:FED4FAD1B1E74C8B391337063821260>
here is some messy code   ADASLKDAKDNAKJDNAKDNKJNDSAKDJNAKDJADA which is actually the file content itself
4

1 回答 1

1

我希望这对某人有所帮助......我只是在凌乱的字符之前删除了所有标记代码/mime 类型 xml 等,并将内容保存为 .zip 文件。这不是一个理想的解决方案,但它有效。

--MIMEBoundaryurn_uuid_9ADB5E0C3BD2353F98133706376435374151
Content-Type: application/xop+xml; charset=utf-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <0.urn:uuid:9ADB5E0C3BD2353F98133706376435374152>
<?xml version='1.0' encoding='UTF-8'?><downloadFileResponse xmlns="http://www.pe.com/marketplace/services"><ack>Success</ack><version>1.1.0</version><timestamp>2012-05-15T06:36:04.353Z</timestamp><fileAttachment><Size>3204907</Size><Data><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:urn:uuid:FED4FAD1B1E74C8B391337063821260"/></Data></fileAttachment></downloadFileResponse>

--MIMEBoundaryurn_uuid_9ADB5E0C3BD2353F98133706376435374151
Content-Type: application/zip
Content-Transfer-Encoding: binary
Content-ID: <urn:uuid:FED4FAD1B1E74C8B391337063821260>
于 2012-05-15T09:17:17.737 回答