Read XML from Multipart/Related payload

I need to extract only xml payload and Content-Type of XML payload  from MTOM request. Can someone please help how I can do this with Javascript?

@dchiesa1 : Could you please suggest?

0 1 136
1 REPLY 1

I think you are asking for advice on how to parse or manipulate an MTOM/XOP message within an Apigee proxy.

In the general case, You cannot parse or manipulate an MTOM message from within a JavaScript callout. The reason for that is that JavaScript logic will always coerce content to a string value, and the attachment - which is often a PDF, PNG Image, or other binary payload - is not a string. So you cannot get the content correctly.

I recommend the existing Java callout that handles MTOM/XOP .  I'm not exactly clear what you want to do, but that callout can extract the attachment into an accessible variable.  It can also transform the attachment (convert to base64-encoded and embedded) or just retrieve the XML wrapper. Check the README for details.