Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.sap.gateway.ip.core.customdev.util.Message;
- import java.util.HashMap;
- import java.io.*;
- import groovy.xml.*;
- def Message processData(Message message) {
- //Body
- def body = message.getBody(java.lang.String) as String;
- XmlUtil xmlUtil = new XmlUtil();
- def xml = new XmlParser().parseText(body)
- body = body.replaceAll("<multimap:Messages xmlns:multimap=\"http://sap.com/xi/XI/SplitAndMerge\">", "");
- body = body.replaceAll("<multimap:Messages>", "");
- body = body.replaceAll("</multimap:Messages>", "");
- body = body.replaceAll("<multimap:Message1>","");
- body = body.replaceAll("</multimap:Message1>", "");
- body = body.replaceAll("<ns1:queryResponse xmlns:ns1=\"http://sap.com/xi/PASEIN\">", "<positionUpsertResponse>");
- body = body.replaceAll("</ns1:queryResponse>", "</positionUpsertResponse>");
- def serialized = XmlUtil.serialize(body)
- serialized = serialized.replaceAll('<\\?xml version="1.0" encoding="UTF-8"\\?>', '<\\?xml version="1.0" encoding="UTF-8"\\?> \n')
- body = serialized;
- message.setBody(body);
- return message;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement