on 08-16-2011 9:29 AM
Hi Experts,
I have a query regarding creating Output XML in SAP PI 7.1. I am using the below command
out.getOutputPayload().getOutputStream().write(outDoc.toString().getBytes("UTF-8"));
Where out is the TransformationOutput parameter and outDoc is an output XML not the String.So, I have used toString() here.
But, when we have imported it in PI7.1 the output is not creating but the entire program is running successfully.
Th error to create output XML in PI7.1 is as below.
Unable to display tree view; Error when parsing an XML document (Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 5b, 23, 64 (:main:, row:1, col:3))
Kindly let me know.
Regards,
Aniruddha
Hi Ninad,
Thanks for your interest in the post, it is a file to mdm scenario, where the entire mapping is wriiten in Java map.
We have tested the Java program in NWDS with main() and it has worked successfully.But, when I changed the main with transform and tested it in PI7.1 with the required changes I am getting that error
Unable to display tree view; Error when parsing an XML document (Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 5b, 23, 64 (:main:, row:1, col:3))
But, I have addeed trace in different level and all are coming means the program is running, only in case of
getTrace().addInfo("Before passing XML to String");
out.getOutputPayload().getOutputStream().write(outDoc.toString().getBytes("UTF-8"));
getTrace().addInfo("After passing XML to String");
Both the getTrace() is showing in PI7.1.
Trace Output:
Records Created - 1
Before passing XML to String
After passing XML to String
END APPLICATION TRACE ***
Java mapping hcl/com/XmlValidation completed. (executeStep() of hcl.com.XmlValidation).
Execution of mapping on server took 564 milliseconds Executed successfully
only the changed syntax is I am using toString() on outDoc as outDoc is an Document type not the String Type.Actaully, I have manipulate the input as an XML not as a String or Stream.
Regards,
Aniruddha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Your Output of the Mapping program is not in Proper XML.
Test the mapping in Operation mapping test tab.
and see the mapping output by clicking on the SRC tab of result window.
Then try to copy the output content and check whether the output is a well formed XML or not(Means all the start tag has proper end tag)
Remove the line
out.getOutputPayload().getOutputStream().write(outDoc.toString().getBytes("UTF-8"));
and replace with try & catch block inside the transform method at the end for that....
public void transform(TransformationInput input, TransformationOutput output)
throws StreamTransformationException{
try{
OutputStream out = output.getOutputPayload().getOutputStream();
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
transformer.setOutputProperty("indent", "yes");
DOMSource source = new DOMSource(document);
StreamResult result = new StreamResult(out);
transformer.transform(source, result);
}catch(Exception e){
e.printStackTrace();
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
> outDoc.toString()
> and outDoc is an output XML not the String.So, I have used toString() here.
This does not work. Choose anther option to create a String from Document type.
Check this blog:
/people/thorsten.nordholmsbirk/blog/2006/08/10/using-jaxp-to-both-parse-and-emit-xml-in-xi-java-mapping-programs
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
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.