Consuming SOAP + Attachment in CF

I am making a SOAP request with cfhttp due to SSL certificates to fetch a document. We have limited access to the server, so I'm not sure if we can configure the server to get the certificates added to the CF keystore. ( http://www.coldfusionmuse.com/index.cfm/2005/01/29/keystore )

Response returns a ByteArrayOutputStream that contains the contents of the soap message and the contents of the document ( http://www.w3.org/TR/SOAP-attachments ).

Does anyone know if ColdFusion supports any built-in methods to separate the two, IE throws it into a ColdFusion.Response object of some kind that is the result of using cfinvoke, or I need to vacuum my Java books and iterate through a ByteArray. to disable my content. Thank.

+2


source to share


1 answer


Once you have an array of bytes (using the toByteArray()

? Method ), you should be able to use CharsetEncode()

to convert those bytes to a ColdFusion string. You may have to trim the MIME segments yourself. For a segment with a SOAP envelope, you can parse this with XmlParse()

and handle it appropriately. Segments containing binary attachments you should be able to decode with BinaryDecode()

(and then do whatever you want with the resulting bits, such as save to a file or database).



+1


source







All Articles