cancel
Showing results for 
Search instead for 
Did you mean: 

Pass Multiple HTTP method in single REST Receiver Channel.

08-06-2021 5:59 PM
1289 views 6 comments
0 Likes
SAP Managed Tags
Subscribe

Hi Experts,

I have a requirement where i have to pass multiple HTTP method(e.g. PUT and POST) in a single REST receiver channel.

So can you please guide me with steps for configuring.

As an example,

if value is coming as "00" in FEILD1 then my POST method should get executed

else

if value is not equal to "00" then PUT method should get executed.

0 Likes

Accepted Solutions (0)

Answers (2)

Answers (2)

manoj_khavatkopp
Active Contributor

Hi Kesha,

If the requirement is in PI/PO then :

1. Add the below UDF in mapping, pass the FEILD1 as input to the UDF and output map to target root node:

public String setMethod(String inp , Container container) throws StreamTransformationException
{
String method = "";
DynamicConfiguration conf1 = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key1 = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/REST","id");
if(inp=="00")
method = "POST";
else
method = "PUT";
conf1.put(key1,method);
return method;
}

2. Maintain the receiver REST channel as below :

Thanks,

Manoj

0 Likes

Thank you so much Manoj.

Also based on the method used, i have to pass corresponding fields in output payload.

So any suggestions with that?

manoj_khavatkopp
Active Contributor
0 Likes

You need to implement that in mapping, based on FIELD1 value populate the required target fields.

Don't forget to close the thread by marking correct/helpful answer.

0 Likes

Thanks Manoj and Praveen for your inputs.

However with the help of UDF, it didn't suffice my requirement so used xpath and with that it worked. Attaching screenshot for your reference.

0 Likes

Hi shahkesha,

I am assuming this requirement is for Cloud Integration(SCPI).

You could set the method as dynamic and set it dynamically.

For more details please find below the help document.

https://help.sap.com/viewer/368c481cd6954bdfa5d0435479fd4eaf/LATEST/en-US/2da452effb764b3bb28f8e0a2f...

Hope this helps !

thanks and regards,

Praveen T

0 Likes

Thanks Praveen for quick response.

However we have this requirement in PO 7.5 version. Apologies I forgot to mention system details.