Reputation: 2046
I'm making a SOAP request with cfhttp due to SSL certificates to retrieve a document. We have limited access to the server, so I'm not sure if we can adjust the server to get the certificats added to the CF keystore. (http://www.coldfusionmuse.com/index.cfm/2005/01/29/keystore)
The responseBody returns a ByteArrayOutputStream which holds the content of the soap message and document contents (http://www.w3.org/TR/SOAP-attachments).
Does anyone know if ColdFusion provides any built in methods to separate the two, IE cast it into a ColdFusion.Response object of some sort which is the result of using cfinvoke, or do I need to dust off my Java books and iterate through the ByteArray to strip out my content. Thanks.
Upvotes: 2
Views: 620
Reputation: 14816
Once you have the byte array (using the stream's toByteArray()
method?), you should be able to use the CharsetEncode()
function to convert those bytes into a ColdFusion string. You'll probably have to cut up the MIME segments yourself. For the segment with the SOAP envelope, you can parse that with XmlParse()
and deal with it appropriately. The segments containing the binary attachments you should be able to decode with BinaryDecode()
(and then do whatever you need to with the resulting bits, like save to a file or database).
Upvotes: 1