cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

JAVA mapping error in SAP PI

banersu
Participant
0 Likes
1,252

Hi team,

I am encountering an issue while running  java mapping.My sccenarion is like below:

Third party webservice(Soap Adapter)->PI->Database server(JDBC stored procedure is being used).

in RWB ,I have found an error like 'Fatal parsing error'.while checking i have found that the error is coming on reponse mapping which is basically a java mapping followed by graphical mapping.

I have tested the response xml log and found the same error log in test tab of java mapping.

Please find att ached screenshpot and the response xml files below by which I have tested:

Step 1>Response mapping Tab:

Step 2:Running with the below response files in test tab:

Please find the code snippet from where the below error is faced this is a SAX parser code :

                public void transform(TransformationInput in, TransformationOutput out)

                                                throws StreamTransformationException {

                                setSAXParserFactory();

                                final String err = "Fatal parsing error.";

                                try {

                                                // Prepare input, output and parser

                                                Writer outputWriter = new BufferedWriter(new OutputStreamWriter(out

                                                                                .getOutputPayload().getOutputStream(), charEncoding));

                                                SAXEventHandler saxEventHandler = new SAXEventHandler(outputWriter);

                                                SAXParser parser = parserFactory.newSAXParser();

                                                // Parse XML

                                                parser

                                                                                .parse(in.getInputPayload().getInputStream(),

                                                                                                                saxEventHandler);

                                                outputWriter.close();

                                } catch (Exception e) {

                                                e.printStackTrace();

                                                getTrace().addDebugMessage(e.getMessage());

                                                throw new StreamTransformationException(err, e);

                                }

                }

need your advice whhy the error is coming .

View Entire Topic
manoj_khavatkopp
Active Contributor
0 Likes

Hi Suparna,

So by seeing your JDBC payload it looks like you are trying to read the only filed content from DB field isOutputXML which has an  XML content .

But as Stefan mentioned SAX parser is unable to handle this  , so instead of this you can write a simple java mapping just with some string functions which will retrieve content from that field only.

Br,

Manoj

banersu
Participant
0 Likes

Could you please guide me why  the issue is encountered while testing.

is it a data issue??

manoj_khavatkopp
Active Contributor
0 Likes

So as you  mentioned the error is only for a particular message so it could be data issue which may have an invalid XML character to verify this copy the payload from moni and  you may check in any online hex editor whether it contains any invalid character.