cancel
Showing results for 
Search instead for 
Did you mean: 

Invalid XML character error from mapping

Former Member
0 Kudos

Hi,

We are getting below mapping error:

Received XI System Error. ErrorCode: EXCEPTION_DURING_EXECUTE ErrorText: null ErrorStack: Runtime exception occurred during application mapping com/sap/xi/tf/_MM_MappingRespone~; com.sap.aii.utilxi.misc.api.BaseRuntimeException:Character reference "&#x0" is an invalid XML character.

This happens when we receive response from stored procedure with one of the fields "ErrorCode" having value as "��������������������". This value should have been a blank which represents success (accept) of the message.

The PRG program did not initialized the field resulting in invalid characters being returned. However client want to handle this in PI instead of changing the legacy program as currently this is production and current java client is able to handle this.

In PI mapping, we have three target fields that needs to be mapped based on the value from ErrorCode. And whenever we receive above mentioned invalid characters, mapping is getting failed at runtime. However it works fine from Test tab of mapping editor in ESR.

Please provide any inputs/thoughts on how to handle these characters in PI during mapping.

Regards,

N@v!n

Accepted Solutions (1)

Accepted Solutions (1)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Your response message contains invalid xml characters. You can do java mapping at the beginning to handle this invalid characters and then do the mapping. You might want to see this link for handling part. BTW, why do the target systems sends & , "" characters.

http://codeidol.com/csharp/csharpckbk2/XML/Handling-Invalid-Characters-in-an-XML-String/

You also write simple UDF and use string replace method to handle this too (if the fields are few)

Example  pass string variable s

s.replace("&","&amp");

EDIT

Former Member
0 Kudos

Hi Baskar,

Thanks for your quick reply. Its bug in the current PRG program, where field was not not initialized resulting in invalid characters being returned. However client doesn't want to change the that program which is in production and wants handle this in PI.

I have tried with standard function replaceString. I am still getting the same error "Character reference "&#x0" is an invalid XML character."

Looks like java mapping is the only option available. I have never done java mapping. Can you please provide sample code for java mapping for this requirement.

Regards,

N@v!n


Former Member
0 Kudos

Hi,

Doesn't PI supposed to handle special characters as <, >, ", ', & that come in messages from different systems? We will write java code if it is necessary, but trying to understand why this is not handled by PI by default as this sounds like common/basic requirement while processing messages.

I would really like to get this done by standard way possible. Please let me know any ideas/thoughts.

Regards,

N@v!n

baskar_gopalakrishnan2
Active Contributor
0 Kudos

>I would really like to get this done by standard way possible. Please let me know any ideas/thoughts.

Another possible way is to use CDATA tag in the xml. Please search SCN for CDATA to get idea about handling special characters.

Answers (0)