Hello Experts
We are sending Customer Invoice, Accounting and Delivery data IDOCs via XML to a SOAP receiver channel webservice. The data contains some special characters (which should not be present in XML data) as indicated in the following paragraph:
Note: - quote ("), apostrophe ('), ampersand (&), less than (<), greater than (>) are special characters in XML. They should not be present in data per W3.org standards. http://www.w3.org/TR/REC-xml/
The Webservice requires specific strings containing the special characters which exist in some of the Material Descriptions of the Customer Data. This is to be processed by Stored Procedures which cannot process them unless the special characters are formatted as the following examples show:
Examples:
&' (Translates to &' )
&" (Translates to &" )
I have created a UDF (shown below the signature) which creates some promising output in the Message Mapping test, however once it reaches the Payload it "converts" and although I have tried various combinations, the closest I have been able to get is shown below. :
&amp;apos;
&&apos;
It seems that because of the embedded conversion PI performs it may not be possible to send the desired strings as shown in the Example above.
In addition, the required (or ideal) solution should not operate on a field basis but on the entire Payload and would not apply the conversion to the XML tags, but to the data portion of the Payload only.
I am wondering if any of you experts have run in to a similar requirement and what you may have done to solve it? I am hoping that perhaps I may have missed something obvious, such as a character combination that does the trick.
(Some comments I have heard so far is this is better done on the ECC or on the Webservice side, feedback on this would also be valuable, Thanks)
Thanks in advance for your knowledgeable and valued feedback.
Jim
QuestRoi.com
UDF:
String Change_Var = var1;
if (Change_Var.contains("'") || Change_Var.contains("\""))
{
Change_Var = Change_Var.replaceAll("'", "&'");
//Change_Var = Change_Var.replaceAll(" &apos; ", " \\\\&apos; ");
Change_Var = Change_Var.replaceAll("\"", "&"");
//Change_Var = Change_Var.replaceAll(" &quot; ", " \\\\&quot; ");
}
return Change_Var;