on 09-24-2013 1:54 PM
Dear All,
I have developed a Java Mapping where I am parsing the payload of an incoming IDOC, generating a mail and sending it to the desired customer via the Mail Adapter. This scenario is working successfully but fails when there is a special character in the IDOC payload. I have modified the program so that the InputStream is converted to UTF-8 then I parse it to create the document object.
It works well when I test it from the Component Monitoring using a saved IDOC but fails when the same IDOC is triggered from the R/3.
The code I used to modify the InputStream is as follows:
InputStream ins = inputObj.getInputPayload().getInputStream();
Reader reader = new InputStreamReader(ins,"UTF-8");
InputSource is = new InputSource(reader);
is.setEncoding("UTF-8");
........
Document doc = dbuilder.parse(is);
Any suggestions
Thanks and Regards,
Rana Brata De
Hi Rana
Try this in the output
.getOutputStream().write(output.getBytes("UTF-8"));
Regards
Javi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rana,
Please provide the error description.
Regards,
Nabendu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nabendu,
In the Payloads for Request Message Mapping (sxi_monitor), I found the following messages -
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
An invalid character was found in text content. Error processing resource 'file:///C:/Users/rde/AppData/Local/Temp/16e93350...
and as a result the following error messages in the AE - Delivery of the message to the application using connection Mail_http://sap.com/xi/XI/System failed, due to: com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.aii.af.sdk.xi.srt.BubbleException: Failed to call the endpoint [null "null"]; nested exception caused by: com.sap.aii.af.sdk.xi.util.XMLScanException: Can't parse the document; nested exception caused by: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence.
Hi Mark,
I have found the characters which are causing the failure : 0xA0 and Ø (0xD8) .
They are from the following two data in the xml :
<TDLINE>HEAD CON. ROD MALE Ø 6MM -RH 2508808081 (2508808052)</TDLINE> and
<TDLINE>GASKET GACO OR3181 (2.62X45.69) 2513102062</TDLINE>
But I am unable to convert them to UTF-8 character.
Rana..
Hi Rana Brata,
Please ask the source system to stop sending these characters.
If the source system continues sending the characters then in the java mapping itself, before parsing you need to remove those. What is the version of PI you are working with. If possible could you upload the faulty source XML file.
Regards
Anupam
Hi,
please check if the RFC (T code Sm59) in ECC has Unicode checked.
Its an ABAP connection of Type 3 used to communicare with PI.
Ambrish
`
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
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.