If there is merge of two mesages will get the mutilmap added automatically to the xml. In somecases, it is not required to be present in the xml for further processing. So implemented the groovy script and removed it.
import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
import java.io.*;
def Message processData(Message message) {
//Body
def body = message.getBody(java.lang.String) as String;
body = body.replaceAll("<multimap:Messages xmlns:multimap=", "");
body = body.replaceAll("\"http://sap.com/xi/XI/SplitAndMerge\">", "");
body = body.replaceAll("<multimap:Message1>","");
body = body.replaceAll("</multimap:Message1></multimap:Messages>", "");
//Depends on your requirement, add this below line
// body = body.replaceAll("\\<\\?xml(.+?)\\?\\>", "").trim();
message.setBody(body);
return message;
}
<?xml version="1.0" encoding="UTF-8"?>
<Root>
${in.body}
</Root>
Groovy Script:
import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
import java.io.*;
def Message processData(Message message) {
//Body
def body = message.getBody(java.lang.String) as String;
body = body.replaceAll("<multimap:Messages xmlns:multimap=", "");
body = body.replaceAll("\"http://sap.com/xi/XI/SplitAndMerge\">", "");
body = body.replaceAll("<multimap:Message1>","");
body = body.replaceAll("</multimap:Message1></multimap:Messages>", "");
//Depends on your requirement, add this below line
// body = body.replaceAll("\\<\\?xml(.+?)\\?\\>", "").trim();
message.setBody(body);
return message;
}
If required in content modifier, add the body below:
<?xml version="1.0" encoding="UTF-8"?>
<Root>
${in.body}
</Root>
No comments:
Post a Comment