on 02-22-2011 1:25 PM
Hello All,
Scenario:
SOAP -> PI -> RFC (calling BAPI_DOCUMENT_CREATE2)
The soap message contains some special characters in the description fields ex: "DESC <SDH>"
when I am map the request to this RFC - I place the description field inside CDATA Structure and the RFC Request will look like as follows:
<?xml version="1.0" encoding="UTF-8" ?>
<ns0:BAPI_DOCUMENT_CREATE2 xmlns:ns0="urn:sap-com:document:sap:rfc:functions">
<DOCUMENTDATA>
<DOCUMENTTYPE>DRW</DOCUMENTTYPE>
<DOCUMENTNUMBER>SDH_DOC_005</DOCUMENTNUMBER>
<DOCUMENTVERSION>00</DOCUMENTVERSION>
<DOCUMENTPART>000</DOCUMENTPART>
<STATUSEXTERN>IA</STATUSEXTERN>
<VALIDFROMDATE />
</DOCUMENTDATA>
<DOCUMENTDESCRIPTIONS>
<item>
<LANGUAGE>DE</LANGUAGE>
<DESCRIPTION><![CDATA[DESC <SDH>
-
EN
DESC <SDH>
]]>
This request is successfully executed by RFC - but when I go to R/3 and look for the result - in the document description it looks as follow:
DESC & ltSDH& gt
Note: I purposefully inserted the space after & - because this editor does
not allow me to write together!
Does anybody have solution to overcome this effect in SAP R/3- do I need any more mapping?
@ Stefan: As per your suggesstion - I am starting a new thread for this issue:
And below is your comment for the same issue on the other thread!
Of course it does. What do you expect when you use CDATA?
Open a new thread as this is some totally different as the original post.
Hello Stefan,
when I use CDATA - I expect that the XML parser will treat the content as string and won't parse them at all and it is as such passed to RFC Adapter and I expect that the result in R/3 should be "DESC <SDH>" - but it is not!
Best Regards,
Satish.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Stefan,
As you suggested, I tried without using CDATA in my request and it look like as follows:
<?xml version="1.0" encoding="UTF-8" ?>
<ns0:BAPI_DOCUMENT_CREATE2 xmlns:ns0="urn:sap-com:document:sap:rfc:functions">
<DOCUMENTDATA>
<DOCUMENTTYPE>DRW</DOCUMENTTYPE>
<DOCUMENTNUMBER>SDH_DOC_006</DOCUMENTNUMBER>
<DOCUMENTVERSION>00</DOCUMENTVERSION>
<DOCUMENTPART>000</DOCUMENTPART>
<STATUSEXTERN>IA</STATUSEXTERN>
<VALIDFROMDATE />
</DOCUMENTDATA>
<DOCUMENTDESCRIPTIONS>
<item>
<LANGUAGE>DE</LANGUAGE>
<DESCRIPTION>DESC <SDH></DESCRIPTION>
</item>
<item>
<LANGUAGE>EN</LANGUAGE>
<DESCRIPTION>DESC <SDH></DESCRIPTION>
</item>
</DOCUMENTDESCRIPTIONS>
</ns0:BAPI_DOCUMENT_CREATE2>
but the result is same as earlier - when I look into R/3 instead of the symbol (< >) - it displays still & lt; and & gt; in the description field
Best Regards,
Satish.
> when I use CDATA - I expect that the XML parser will treat the content as string and won't parse them at all and it is as such passed to RFC Adapter and I expect that the result in R/3 should be "DESC <SDH>" - but it is not!
Of course not, as the original data are > and < instead of < >
Otherwise you could not send the data with SOAP.
My source SOAP message contains < ; > ; - I am using the JAVA mapping to convert them to the right symbols (< >) and place them in the CDATA structure u2013 without CADTA the XML wonu2019t be a valid one.
My earlier thread contains the XI Message and I did not find anything special even if I copy them to Notepad u2013 it is same as above.
> My source SOAP message contains < ; > ; - I am using the JAVA mapping to convert them to the right symbols (< >) and place them in the CDATA structure u2013 without CADTA the XML wonu2019t be a valid one.
Instead of replacing & gt and & lt, try to use the same values of SOAP adapter unchanged.
> My earlier thread contains the XI Message and I did not find anything special even if I copy them to Notepad u2013 it is same as above.
Do mean mean you copy with ^c ^v? That of course will not change anything.
Store the payload as local file and open with Notepad.
> My source SOAP message contains < ; > ; - I am using the JAVA mapping to convert them to the right symbols (< >) and place them in the CDATA structure u2013 without CADTA the XML wonu2019t be a valid one.
I cannot imagine that the receiver RFC adapter will change <> symbols in a CDATA section to escape sequences.
In fact the RFC adapter replaces escape sequences back to the symbols. I have used this behaviour in a scenario and it worked for me in any PI release.
So I have to assume that your JAVA mapping is not working correctly or your inbound payload from SOAP adapter is totally different.
When you have an escape sequence in message payload, you will not see it in SXMB_MONI, and not in Internet explorer.
Maybe you show your Java mapping code to see, if it is working like it should.
Inbound payload looks like as follows: [I have cut and pasted the below line from SXMB_MONI]
<attribute name="DocumentDescription" system="MP" value="DESC <SDH>" />
Note: as you mentioned - SXMB_MONI is not displaying the symbols just escape sequence: & lt; and & gt;
>you will not see it in SXMB_MONI, and not in Internet explorer.
I saved my XML Payload locally and opened in Internet Explorer and also in XML SPY [inbuilt Browser] - both the browser showed me & lt; and & gt; - they did not show me the symbols.
Below is my UDF: just replaces the occurens [& lt; with < and & gt; with > and wrap the string in the CDATA structure]
String currentData = new String(var1);
currentData =currentData
.replaceAll("& lt;", "<")
.replaceAll("& gt;", ">");
currentData = "<![CDATA[" + currentData + ""; // I tried even commenting this line.
return currentData;
]]>
> Seems RFC receiver adapter doesn't parse "<" ">" at all.
Do following:
- dowload the payload from SXMB_MONI to file system
- open the file with a hexeditor (there are enough freeware hex editors*)
check if the < is "<", "& gt ;" or "& amp ; gt ;" (without spaces)
sxmb_moni, internet explorer and other editors do not display the escape sequences correctly
What happens, when you do not use CDATA? Just map DESCRIPTION as is?
That should work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.