cancel
Showing results for 
Search instead for 
Did you mean: 

Invalid XML characters on Proxy interface

Former Member
0 Kudos

Hello,

We have an SRM to PI proxy interface. Occasionally we are getting special characters coming from SRM vendor catalogs which are sent OK from SRM but PI rejects due to invalid XML characters.

So in SXMB_MONI we occasionally get errors like:

com.sap.aii.utilxi.misc.api.BaseRuntimeException:An invalid XML character (Unicode: 0xffff) was found in the element content of the document.

I see 3 possible approaches...

1) Make SRM validate its XML before sending to PI (maybe not possible, depends on another team)

2) Make PI Validate and not accept if XML is not valid (Can PROXY interface enforce this?)

3) Make PI run a module or Java mapping to strip out any invalid characters before sending onward

I'm looking for experience in which approach is probably best (or perhaps something I haven't thought of).

-Many thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Aaron,

In a perfect world you would want the source system to sort out their own issues & not make it someone else's problem but we we know this isn't a perfect world 🙂

How is the 3rd party catalog integrated with SRM, using OCI? If it is then it could be a codepage issue, see SAP Note 949031.

If the above is not feasible, you are left with very few options. In your case, is it a show stopper if the description data contains special characters, i.e. the message must error out according to a business rule?

You won't be able to do any sort of validation and stop it before it reaches PI through proxy communication. You're probably on left with some Java to do on PI (e.g. UDF if it's just a description field that needs to be stripped on specials chars) and let the message carry on on it's merry way.

Regards, Trevor

Answers (1)

Answers (1)

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi Aron,

When you receiving special characters means it is problem with data at SRM level, so check with SRM team about possiblity of sending special characters, if they say data not correct then      SRM team has to handle that ,they have to make sure to send valid data.

If SRM point of view data correct then proxy logic has to handle that or you need to handle it in PI as you mentioned. Java mapping is a  right option if yor are recining special characters for multiple fields.

PI internally handles some of the special characters while mapping execution.

Regards,

Raj

Former Member
0 Kudos

Hi Raj, thanks for the perspective.

Our SRM team doesn't mind much about the content as it is coming from external vendors part descriptions. Why the external vendors insert the characters is for anyone's guess. So maybe option 1 is off the table.

What did you mean by your last sentence:

PI internally handles some of the special characters while mapping execution.

Do you know how to enforce that the XML is well formed before PI accepts it from the sending system?  (option 2)

Option 3 will be my last resort.

rajasekhar_reddy14
Active Contributor
0 Kudos

What did you mean by your last sentence:

PI internally handles some of the special characters while mapping execution

When PI receives a message from Sender system,if XML payload has any special characters then it doesnot mean that XML document not valid, but while mapping execution PI throws an error.But PI handles most of the special characters and it avoids mapping failures.

In your case PI is unble to handle it, better to handle using java mapping.

Regards,

Raj

former_member201264
Active Contributor
0 Kudos

Hi Myers,

If you get always same special charecter in a particular field always, then you can handle with UDF.

Regards,

Sreeni.

stefan_grube
Active Contributor
0 Kudos

I have heard this a lot, that people responsible for a sender interface refuse to make sure that the outgoing XML message is well formed. You could of course mention the XML specification, but if you need a quick solution, you better write a Java mapping which runs before your actual message mapping and removes all FFFF characters. The Java code would be only a couple of lines. Figure out how the FFFF character is representated (something like ) and work with the replaceString method of the String class.

Former Member
0 Kudos

Thank you for the response Stefan. I'm thinking this Java mapping is what I must do.

I was really hoping someone would know of a way to enforce the inbound XML to be well formed before PI accepts it over the Proxy interface.

Unfortunately this particular character is not the only one. It has happened about 5 times now over the past year and it has been come down to various characters.

For future reference, here are some examples from Stack Overflow which we could put into a Java mapping:

http://stackoverflow.com/questions/4237625/removing-invalid-xml-characters-from-a-string-in-java

Former Member
0 Kudos

Hi Sreeni, thanks for the suggestion but I don't think UDF will work here because in graphical mapping PI tries parse the whole XML message before letting me run a function on a particular field. I think Java mapping will let us around that.