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

How to send HTTP Body parameters in SAP PO 7.5

former_member607993
Contributor
16,123

Hello Mates,

I have a scenario wherein the body parameters is send from Sender REST pooling and same needs to be passed as HTTP Body Parameters at a REST receiver end.

POST /api/authentication/access_token HTTP/1.1

Host: HOst-sbx.npr.sandbox.com:443

Headers:

appkey: 11UVugFfQ12hTh5mGBfPckUssLrUdIig

Content-Type: application/x-www-form-urlencoded

Body:

client_id=RVqVK4APpp2hVWKn2fen96wsrqskb9k&client_secret=nilwkaR4&password=nil!&username=user@com&grant_type=password&auth_chain=OAuthLDAPService

Please revert on this. I'm getting below error.

Error while sending message to module processor: Sender Channel 'CC_REST_AccessToken_Sender' (ID: nilb7f8af3c7aa5481): Catching exception calling messaging system: com.sap.aii.adapter.rest.ejb.common.exception.HttpCallException: HTTP POST call to https://HOst-sbx.npr.sandbox.com:443/api/authentication/access_token not successful. : HTTP POST call to https://HOst-sbx.npr.sandbox.com:443/api/authentication/access_token not successful.

Thanks Much - Rajesh PS

Accepted Solutions (0)

Answers (9)

Answers (9)

Hello @rajeshps did you figure it out how to send body application/x-www-form-urlencoded content ?

I'm stucked with this because I need to sent my grant_type on body and it's not working for me

bjorkmanwarren
Explorer
Hi, did you ever manage to get this working? I am struggling with exact same issue

Did you got any solution to pass request body trought a REST receiver channel comunication? If so, can you teach me how I do it?

Tks.

VIJENDRAN
Explorer

rajeshps : shai18 : Did you guys got any solution on this. ARIBA OPEN API integration. Need some pointers as there were no help blog available.

shai18
Newcomer

rajeshps have you got any solution for this? I am using Ariba API for Procurement reporting for which I need to pass the filter parameter in the body.

chetan_risbud
Participant

Hi Rajesh,

Try to use REST lookup.
I came across the same requirement earlier and I have use REST lookup for the same.

I wrote UDF by taking help of below blog post

https://blogs.sap.com/2015/09/11/yes-rest-lookup-is-possible-in-pi/

Regards,
Chetan Risbud

former_member607993
Contributor

Hi Chetan Risbud ,

Above mentioned blog works if input is a xml and my question is unalike.

vicky20691
Active Contributor

okay,

I am sure the ASMA properties are correctly populating from the udf 🙂

1. Please try without the parameter auth_chain

2. try with ---- ?grant_type={grant_type}&username={username}&password={password}&client_id={client_id}&client_secret={client_secret}

Also try to check if the receiver API requires any more parameters like resource, scope?

Regards,

Vikas Singh

former_member607993
Contributor

Vikas Kumar Singh,

Below one is already tried which you can see above which is sent as dynamic URL parameters and it works.

But this isn't secured to send like below and there is no more parmeters.

?grant_type={grant_type}&username={username}&password={password}&client_id={client_id}&client_secret={client_secret}

Please suggest if any.

vicky20691
Active Contributor

Hi Rajesh,

rather than passing the authentication parameters for oauth in URL as query , try passing as header in the header tab.

Regards,

Vikas Singh

former_member607993
Contributor

Thanks much for your reply vicky20691

API accepts Client authentication only in URL parameters or Body parameters.

It doesn't accepts in Header and hereby throws HTTP 400 Bad Request.

I wanted to have this a protected URL or send it as HTTP body with content Type: application/x-www-form-urlencoded to get a access and refresh tokens.

former_member607993
Contributor

Thanks Piyawat Natpisarnwanit.

This is actually OAUTH 2.0 Authentication(grant type as password).

But why can't it accept as HTTP body parameters instead of Query. Since the details passed in query like client_secret, user, password etc. are clearly visible in PI logs nor XPI inspector. Is there any solution to overcome with a solution.

former_member190293
Active Contributor

Hi Rajesh!

Why not to use XSL transformation or java mapping to produce text output (not XML), containing the needed string for body parameters? In HTTP receiver adapter you just set the headers.

Regards, Evgeniy.

former_member607993
Contributor

Hi Evgeniy Kolmakov

I'm using REST adapter to post the data to receiver end. Below is the configurations:

But the thing is it is going as HTTP URL parameters, due to some security reasons I want to send as HTTP body only which is actually working in POSTMAN but failing in SAP PO..