簡體   English   中英

php,如何從SOAP MTOM附件解碼/保存文件?

[英]php , How to decode / save a file from SOAP MTOM attachment?

我正在嘗試獲取內容/保存由Web服務返回的zipfile。 但是,似乎該API提供了以Base64 Binary格式編碼的文件,並根據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類型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>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM