cancel
Showing results for 
Search instead for 
Did you mean: 

Call (SOAP) Webservice in iRPA

Jana_dK
Participant
646

Hi all !

We're having some troubles creating the correct payload for a soap api call.
Whilst creating an SOAP Envelope, it needs a message ID to be added to the soap envelope header.

We tried several things to add a message ID, even hardcoded.. But whatever we try, we always get this result.

Does someone has the solution to send a SOAP call in the iRPA Cloud Factory with a MessageID?

This is our payload, one of many that did not work 😉

var XMLBody= "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:edi='http://sap.com/xi/EDI'>"+
"<soapenv:Header/>" +
"<soapenv:Body>" +
"<edi:OrderConfRequest>" +
"<MessageHeader>" +
"<CreationDateTime>2022-09-21T18:40:00.001Z</CreationDateTime>" +
"</MessageHeader>" +
"<OrderConfirmation>" +
.............
"</OrderConfirmation>" +
"</edi:OrderConfRequest>" +
"</soapenv:Body>" +
"</soapenv:Envelope>";
var payload = {
'resolveBodyOnly' : true,
'method': 'POST',
'contentType': "text/xml",
'responseType':'json', // parse the response to get a JSON object
'url': URL,
headers: {
'Content-Type': "text/xml",
'Accept': '*/*'
},
'body': XMLBody
};
return payload;

KR,

Jana

View Entire Topic
0 Kudos

Hello Jana,

From the Web Services Best Practices sample, you can see that the Content-Type of the header should be set to irpa_core.enums.request.content.xmlText. Then I would try the following code:

var payload = {
'resolveBodyOnly' : true,
'method': 'POST',
'contentType': "text/xml",
'responseType':'json', // parse the response to get a JSON object
'url': URL,
headers: {
'Content-Type': irpa_core.enums.request.content.xmlText,
'Accept': '*/*'
},
'body': XMLBody
};
return payload;

And I would remove the responseType: json.

Let me know if it helps.

Thanks a lot and best regards,

Baptiste

usr_Name_
Explorer
0 Kudos

Hi Baptiste,

I am the colleague of Jana.
I tested your suggestion and unfortunately, it didn't pass through.

Response error:

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header/>
<soap-env:Body>
<soap-env:Fault>
<faultcode>soap-env:Server</faultcode>
<faultstring xml:lang="en">
Web service processing error; more details in the web service error log on provider side (UTC timestamp 20220923094107; Transaction ID 8E6DA01BF72B0200E00632C6A72A51D6) The error log can be accessed by service provider from SAP backend
</faultstring>
<detail/>
</soap-env:Fault>
</soap-env:Body>
</soap-env:Envelope>

Error in monitoring:

In my opinion we need a unique message ID placed in the header, something like:

<soapenv:Header>
<wsa:messageId>uniqueMessageUUID</wsa:messageId>
</soapenv:Header>

Only, is this possible in IRPA?

Kr,

Cedric

0 Kudos

Hi, yes it is. I guess here the payload is not well formated. Is it working in Postman ?

Jana_dK
Participant
0 Kudos

Hi baptiste_sa_sap ,

In postman it is working when using the postman variable "<wsa:messageId>urn:uuid:{{$randomUUID}}</wsa:messageId>"

This way, postman generates us a randomUUID which is needed. The rest of the body payload is identically the same. The only issue we have, is generating a random UUID as messsage ID. We are looking for a way to generate this Message ID in iRPA.

KR,

Jana

RamaniNagarajan
Explorer
0 Kudos

Hi @former_member17397, Your suggestion on the "headers" is working perfectly for my SoapWebservices. The posting happens perfectly now. Thanks for your suggestion!