qie.parseMultipartContent¶
Signature: qie.parseMultipartContent(content)
Returns: XML Message parsedContent - the parsed content as an XML Message
When calling a soap web service with the 'fullResponse' option, then this call is used to parse all of the Multipart parts into an XML message.
Note
This option will parse the MTOM content into an XML message with each content in it's own part.
Note
See this KB article for an in-memory walkthrough.
Parameters¶
| Type | Name | Description | Default |
|---|---|---|---|
| String or byte[] | content | the content String or byte[] from web service call |
Example¶
// Examples of how to use parseMultipartContent
// Example: content as String
var multipartResponseData = `
--boundary
Content-Disposition: form-data; name="testBinary"; filename="testFile.txt"
Content-Type: application/text
This is a test
--boundary
Content-Disposition: form-data; name="textTest"
Content-Type: text/plain; charset=ISO-8859-1
This is the content
--boundary--
`;
var xmlMessage = qie.parseMultipartContent(
multipartResponseData // content - multipart response content as String
); // XML Message
// Example: content as byte[]
var nativeJSByteArray = [
45,45,98,111,117,110,100,97,114,121,13,10,
67,111,110,116,101,110,116,45,68,105,115,112,111,115,105,116,105,111,110,58,32,102,111,114,109,45,100,97,116,97,59,32,110,97,109,101,61,34,116,101,120,116,84,101,115,116,34,13,10,
67,111,110,116,101,110,116,45,84,121,112,101,58,32,116,101,120,116,47,112,108,97,105,110,13,10,
13,10,
84,104,105,115,32,105,115,32,116,104,101,32,99,111,110,116,101,110,116,13,10,
45,45,98,111,117,110,100,97,114,121,45,45
];
var javaBytes = java.nio.ByteBuffer.allocate(nativeJSByteArray.length);
for (var i = 0; i < nativeJSByteArray.length; i++) {
javaBytes.put(nativeJSByteArray[i]);
}
var multipartResponseBytes = javaBytes.array();
var xmlMessageFromBytes = qie.parseMultipartContent(
multipartResponseBytes // content - multipart response content as byte[]
); // XML Message