Hi
The easiest solution will be , write an simple java map for your response mapping.
Please provide your target structure , if you need any help on the java mapping.
Sample code:
Response message from web service
Image may be NSFW.
Clik here to view.
target msg:
Image may be NSFW.
Clik here to view.
java code:
package com.sap;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import com.sap.aii.mapping.api.AbstractTransformation;
import com.sap.aii.mapping.api.StreamTransformationException;
import com.sap.aii.mapping.api.TransformationInput;
import com.sap.aii.mapping.api.TransformationOutput;
publicclass populateResponseMessage extends AbstractTransformation {
publicvoid transform(TransformationInput arg0, TransformationOutput arg1)
throws StreamTransformationException {
try {
DocumentBuilderFactory tfactory = DocumentBuilderFactory
.newInstance();
DocumentBuilder tbuilder = tfactory.newDocumentBuilder();
Document doc = tbuilder.parse(arg0.getInputPayload()
.getInputStream());
Document newdoc = tbuilder.newDocument();
Element root = (Element) newdoc.createElementNS(
"urn:sap-com:document:sap:rfc:functions",
"ns1:ZTEST_FAULT_MESSAGE_DATA.Response");
newdoc.appendChild(root);
NodeList nlList = doc.getElementsByTagName("ConversionRateResult");
if (nlList.getLength() != 0 && nlList != null) {
Node data = nlList.item(0);
String sourceval = data.getTextContent();
Element rate = (Element) newdoc.createElement("RATE");
rate.setTextContent(sourceval);
root.appendChild(rate);
}
Transformer transformer = TransformerFactory.newInstance()
.newTransformer();
Source source = new DOMSource(newdoc);
Result output = new StreamResult(arg1.getOutputPayload().getOutputStream());
transformer.transform(source, output);
} catch (Exception e) {
e.printStackTrace();
}
}// end of transform
}