cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

REST receiver adapter - Structure is different than expected

0 Kudos
1,257

Hi Experts,

I am working on a new project where we need to send specific data to a REST service.

The request I am trying to send is next one:

<?xml version="1.0" encoding="UTF-8"?>
<ns1:xxxRequest xmlns:ns1="http://xxx.com">
<xxxRequest ac="x" aID="x">
<ns2:deleteRecord xmlns:ns2="http://bos.xxx.com">
<ns2:deleteEmployee eID="exampleID"/>
<ns2:MessageList/>
</ns2:deleteRecord>
</xxxRequest>
</ns1:xxxRequest>

But the expected looks like this one:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://xxx.com" xmlns:bos="http://bos.xxx.com" xmlns:ser1="http://xxx.com">
<soapenv:Header/>
<soapenv:Body>
<ser:xxxRequest ac="YY">
<ser:deleteRecord> <ser:yyy eID="exampleID"/>
</ser:deleteRecord>
</ser:xxxRequest>
</soapenv:Body>
</soapenv:Envelope>

So I have a few questions about this:

  1. I want to try sending a request without <?xml version="1.0" encoding="UTF-8"?>. Is there a way in the REST receiver adapter to avoid this?
  2. I have imported a wsdl provided by the vendor so there are some differences in the tags generated. Will this work if point 1 is solved? If not, how can I generate the structure? Replacing strings?

I know that maybe using xslt mappings will help me but I am trying to use what PI REST adapter provides me so that's why I'm asking. If there's any chance I can do this using UDFs or also default options in the middleware please let me know.

Thanks in advanced!

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

I was able to import the structure used in SOAP UI into my message mapping and now I could replicate exactly what they are expecting us.

Thanks for the help!

Answers (2)

Answers (2)

r_herrmann
Active Contributor

From the expected output you showed to us and from your second point ("I imported a WSDL") I would say you don't want to send data to a REST service, but to a SOAP webservice.

Basic steps to do so would be:

  1. Replace your REST receiver channel in SAP PI with SOAP receiver adapter
  2. Create a message mapping in your interface. On the target side use the message type you imported via the WSDL file. Then map you incoming message to the target type.

The combination of using the message information from the WSDL in the message mapping and the use of the SOAP adapter should ensure that the messages are send out well-formatted to the partner's service.

0 Kudos

Thank you Raffael for your quick answer.

I was able to do both steps (1 and 2) but for the soap receiver channel the endpoint must be a wsdl and in this case URL is not good because it's a web page.

I was algo able to do a succesful test case at SOAP UI using REST and also SOAP (uploading the wsdl as a file in a new project, not with the URL).

I am assuming that there is only an issue with the format I am sending the data so I need to have this mapped structure

<?xml version="1.0" encoding="UTF-8"?>
<ns1:zzz xmlns:ns1="http://service.upload.myidtravel.lhsystems.com">
   <zzz ac="YY">
      <ns2:aaa xmlns:ns2="http://www.com">
         <ns2:bbb eID="132456"/>
         <ns2:ccc/>
      </ns2:aaa>
   </zzz>
</ns1:zzz>

look like this one:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://xxx.com" xmlns:bos="http://www.com" xmlns:ser1="http://zzz.com">
<soapenv:Header/>
<soapenv:Body>
<ser:zzz ac="YY">
<ser:aaa> <ser:bbb eID="132456"/>
</ser:aaa>
</ser:zzz>
</soapenv:Body>
</soapenv:Envelope>

I need to have a soap:Envelope and also tags start with ser and not with ns2.

Is this only be able to be done under an xslt mapping?