cancel
Showing results for 
Search instead for 
Did you mean: 

Scenario SAP PI to ECC Proxy, character & not set to &

wilbertkarremans
Participant
0 Kudos

Hi all;

I have in my PI payload (7.30) this: <Street2><![CDATA[AT&amp;T Park]]></Street2>

I believe that is OK, original string AT&T Park.

I have a synchronous interface to SAP ECC using a proxy. The ABAP stores this data in a standard SAP table called ADRC.

However that data in the SAP table looks like AT&amp;T Park.

Do I have somewhere an incorrect configuration?
I read that the proxy might not support the W3C standard. Reference: http://scn.sap.com/thread/3679563

Who has experience with this?

Best regards;

Wilbert

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member207703
Active Participant
0 Kudos

Its better to remove CDATA from your XML. If invalid XML characters came properly like & come as &amp, then there is no use of CDATA there. Or ask your sender to send it & in CDATA. But its better to remove CDATA if all XML converted into proper format. Actually, CDATA are defined as blocks of text that are not parsed by the parser, but are otherwise recognized as markup. By using CDATA section, you are commanding the parser that the particular section of the document contains no markup and should be treated as regular text. So, data come as CDATA isn't parse and just send forward with content only as regular text, that's why &amp can't change into & as it's not parsed. Can you able to tell me one thing, which type of scenario you are using in this Synchronous flow.

engswee
Active Contributor
0 Kudos

Hi Wilbert

The content is wrapped in CDATA, as such all the content are treated as-is and won't be un-escaped.

The sending system should either:-

i) Send it without CDATA as follows - <Street2>AT&amp;T Park</Street2>

ii) Send it with CDATA as follows - <Street2><![CDATA[AT&T Park]]></Street2>

Regards

Eng Swee

wilbertkarremans
Participant
0 Kudos

Hi all;

My message contains multiple segments with a number of fields containing the CDATA tag.  My expectation was that the SAP XI adapter (server proxy) would convert the value &amp; back to &. Apparently this is not, so I  need to remove all CDATA tags. On the web I saw lots of suggestions. Is there a simple XLT to remove the CDATA tags? A code snapshot would help.

Regards;

Wilbert

engswee
Active Contributor
0 Kudos

Hi Wilbert

Firstly, the sending system is deviating from the correct usage of CDATA, which means XML special characters (like &) need not be escaped (into &amp;) within a CDATA section. You can read more about it below:-

http://stackoverflow.com/questions/2784183/what-does-cdata-in-xml-mean

The screenshot below shows a correct usage of CDATA by a public web service. All the special XML characters (like <, >, etc) are not escaped.

If you are in the position to influence change in the sending system, i.e. report a bug, then it's better that this be fixed on that side.

PI's behavior is consistent with the correct usage of CDATA. It would be impossible for PI to intelligently predict if a sending system is deviating from XML specifications and adjust accordingly.

Anyway, if you cannot get the sending system to fix it on their side, you would have to implement workarounds to account for such deviations.

I'm not that much of an XSLT person, so I'd suggest an alternative in Java instead. You can parse the whole payload as a string and use replaceAll() method to remove all the CDATA opening and closing tags, i.e.:-


content.replaceAll("<![CDATA[", "");

content.replaceAll("]]", "");

Regards

Eng Swee

Harish
Active Contributor
0 Kudos

Hi Wilbert,

are you using RFC destination for the connectivity between PI and SAP? If yes then please check if RFC connection is Unicode enabled.

regards,

Harish