Yes, from your script you will call the code wizard function "qie.parseMtomContent()". This will parse the content for you and return an easy to work with XML structure with the data.
To parse the MTOM content for the sample message above and place it as your new XML message you would execute the following script:
// parse mtom content, and place in new XML message
var mtomContent = qie.parseMtomContent(source.getNode('/'));
message = qie.createXMLMessage(mtomContent);
The message will now be an XML message that looks like this:
<mtomContent>
<part name="QveraGeneratedRootContentId_0">
<partType>Content-Type: application/json</partType>
<content-type>application/json</content-type>
<content>eyJjb250ZW50RGF0YSI6Im5vdGhpbmcifQ0=</content>
</part>
<part name="QveraGeneratedRootContentId">
<partType>Content-Type: application/xml</partType>
<content-type>application/xml</content-type>
<content>PGNvbnRlbnREYXRhPjwvY29udGVudERhdGE$DQ==</content>
</part>
</mtomContent>
To cycle each of the parts, you will run a for loop on the different parts like this:
// cycle content parts
var parts = message.getAllNodes('/mtomContent/part');
for (var currentPart = 0; currentPart < parts.length; currentPart++) {
var part = qie.parseXMLString(parts[currentPart]);
qie.debug('Part: ' + part.toString());
var content = qie.base64Decode(part.getNode('/part/content'));
qie.debug('Content: ' + content);
}
This will log out each part individually, and then log out the content for that part.
See also:
Handling HTTP requests and responses
Making Requests via qie.callRESTWebService()