简体   繁体   中英

Angular-CLI for file downloads using MTOM

Is there any way to implement a file download request in Angular-CLI from a SOAP Web Service that uses MTOM?

At first glance it seems that it should be supported and pretty simple to implement (on the server side it's very simple) but after searching all of Google for over a week now, we've come up with the big ZIP.

After all, it's only a multipart message (which neither yields any useful Google Hits for how to manage in Angular) with the soapEnvelope in the first part (which we need to parse to obtain certain information) and the binary file data in the second part.. like so..

--uuid:554fa566-3182-4242-b6c8-c9495056135c
Content-Type: application/xop+xml; charset=UTF-8; type="application/soap+xml"
Content-Transfer-Encoding: binary
Content-ID: <root.message@cxf.apache.org>

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> 
<soap:Body><ns2:downloadResponse xmlns:ns2="http://ws.XXX.XXX.XX/"> 
<return><errorCode>0</errorCode><document><xop:Include 
xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:caf7b6bc-d351- 
465b-8d83-7094e6cf20ad-6@cxf.apache.org"/></document></return> 
</ns2:downloadResponse></soap:Body></soap:Envelope>
--uuid:554fa566-3182-4242-b6c8-c9495056135c
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
Content-ID: <caf7b6bc-d351-465b-8d83-7094e6cf20ad-6@cxf.apache.org>
Content-Disposition: attachment;name="xxx.doc"

..BINARY DATA HERE..

This is a real example of the info sent to the client from our server.. the names have been changed to protect the innocent.

We're receiving it with responseType:'blob' specified in the POST and surprisingly PDFs will display with all this extraneous nonsense.. WORD, EXCEL and everything else will have what is seen above. Angular (better said debugging in Chrome) DOES have enough info from the blob to type the response as "multipart/related".. WHERE this comes from and WHAT to do with it is a mystery.

The Google folks REALLY have to have a simple solution for this.. Any takers?

And yes, we've considered base64 encoding within the SOAP envelope but we have to consider possibly VERY large (hundreds of MB) documents and THAT appears to be a NON-starter.

Any help in this matter would be greatly appreciated.

You could convert the response to string, remove the xml data and keep just the RAW on the response. It will be rendered with no problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM