我正在尝试获取内容/保存网络服务返回的zip文件。但是,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
我希望这对某人有所帮助...... 我只是在凌乱的字符之前删除了所有标记代码/mime type 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>