cancel
Showing results for 
Search instead for 
Did you mean: 

Help with HTTP to RFC communication with XML payload as escpaed strign in a post variable

Former Member
0 Kudos

Hi,

Once of our partner is sending data to XI via HTTPS post via SAP XI and we want to map it to a BAPI call via RFC connection. This is how payload looks like:

S0004318351.

However their payload is not a direct XML post. The XML is being send is escpaped and passed as string in a post variabe. This is how the payload looks like in XI log:

content=%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%3F%3E%0D%0A%3C%21DOCTYPE+CaseManagementOrderStatus+SYSTEM+%........and so forth.

Typically we do not need to create an sender agreement for http adapter but loosk like in this case we willl need it. Will really appreciate if anyone can give some pointers on what's the best way to handle this.

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

However their payload is not a direct XML post. The XML is being send is escpaped and passed as string in a post variabe. This is how the payload looks like in XI log:

content=%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%3F%3E%0D%0A%3C%21DOCTYPE+CaseManagementOrderStatus+SYSTEM+%........

This doesn't look like an XML escape codes e.g > , < etc...but rather URL escape codes. This is typical when your payload is in the URL. Can you confirm that you are sending the payload in the HTTP Body and not as a part of the URL?

If this is a part of the HTTP Body, you need to extract the content; Re-escape the characters (can use Java Mapping) and write the converted string into XML. If this is a part of the URL, you should be able to extract the value of the content via ASMA (URL Parameters).

Hope this helps,

Mark

Former Member
0 Kudos

Hi Mark,

The post is coming from a third party and I have asked to confirm but I think you are right that the data is coming as a URL param.

Having said that, I can extract the value of content using UDF. Since I need to pass the content of XML to a  various fields of reciever BAPI interface just wanted to check if its feasible? One option I was thinking is to pass the whole XML as is to a wrapper BAPI and do all the parsing in ABAP but please let me know if this can be done in XI and I can directly call the target BAPI.

Thanks!

Former Member
0 Kudos

Hi Paresh,

If you really want to do this in UDF I think you can. Create a simple data type as your source (entire input string). Import the BAPI obviously as your target structure in mapping.

You can create a reusable UDF which takes 2 parameters, the source string, and which element or attribute you want returned. Use some simple java replacing and xml parsing in the UDF to hone in on the value and output mapping to each of your BAPI fields. For example, each BAPI field will have the source string plus constant of element name passed into your reusable UDF.

As to whether this is easier than using Java mapping like Mark suggests or in the BAPI itself I guess is for you to decide!

Good luck,

Aaron

Former Member
0 Kudos

Thanks Mark for your response, it really helped!!

Former Member
0 Kudos

Thanks Aaron for your suggestion!!

Answers (0)