on 02-10-2012 10:31 AM
Hi
I am using a SOAP sender adapter and testing it from SOAP UI. The format that is generated from the web service is
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<sap:SALES_ORDER xmlns:sap="http://XYZ.org/">
<sap:HEADER>
<sap:BATCH_ID>XYZ</sap:BATCH_ID>
<sap:CREATE_DT>XYZ</sap:CREATE_DT>
This format when processed in SOAP UI gave error which its not giving for other files. Clearly I need to remove this sap: tag, I can't use XML anonymizer as it is SOAP adapter and I can't select do not use soap env...Could anyone provide me Java/xslt code for the same..I tried all the codes on sdn but none of them worked.
Regards,
Another thing is that when I replaced all of the sap: tags from the file using CTRL+H the file got processed successfully..therefore all the tags sap: which are generated from the Web Service in the whole file should be removed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
SImple Java mapping, that should help
import java.io.InputStream;
import java.io.OutputStream;
import com.sap.aii.mapping.api.*;
import org.w3c.dom.*;
public class DeleteCDATA_DOM_mapping extends AbstractTransformation {
public void traceXML(Node n,int i)
{ AbstractTrace trace = getTrace();
trace.addInfo(i+"$"+n.getNodeName());
trace.addInfo(i+"$"+n.getNodeValue());
trace.addInfo(i+"$"+n.getNodeType()+"");
};
public void traceNL(NodeList nl)
{ for (int i=0 ; i<nl.getLength();i++)
{
traceXML(nl.item(i),i);
}
};
public void transform(TransformationInput in, TransformationOutput out)
throws StreamTransformationException {
AbstractTrace trace = getTrace();
try {
InputStream is0=in.getInputPayload().getInputStream();
StringBuffer out1 = new StringBuffer();
byte[] b = new byte[4096];
for (int n; (n = is0.read(b)) != -1;) {
out1.append(new String(b, 0, n,"UTF-8"));
}
String sss=out1.toString();
sss=sss.replaceAll("<sap:", "<");
sss=sss.replaceAll("</sap:", "<");
OutputStream os = out.getOutputPayload().getOutputStream();
os.write(sss.getBytes("UTF-8"));
} catch (Exception e) {
throw new StreamTransformationException(
"Exception in DeleteCDATA_DOM_mapping JAVA mapping 😞 "
+ e.getMessage());
}
}
}
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.