cancel
Showing results for 
Search instead for 
Did you mean: 

Rest receiver token in the same session

1,558

Hi everyone,

I have an issue and I really cannot solve it.

I have to call a Customer Checkuout API from SAP PO, using REST Receiver.

The idea is I have to get a token and then call the API that I want to use.

Testing in Postman everything works fine as you can see in the next picture.

1- I'm getting the token

2- I use the same Session ID calling the correct API and it works perfect.

The issues come in PO.

I've tried to create an UDF doing a "REST LOOKUP" pretty similar like here https://blogs.sap.com/2017/01/23/oauth-2.0-authentication-within-a-udf-mapping-to-be-included-in-res... without luck.

With this option I'm getting the error:

Returning to application. Exception: com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.aii.adapter.rest.ejb.common.exception.HttpCallException: HTTP POST call to http://XXXXX:8080/ccos/api/internal/sync/materials/bulk not successful.

Now I'm trying to do it using OAuth but without luck again.

With this option I'm getting this error.

Returning to application. Exception: com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.aii.adapter.rest.ejb.common.exception.HttpCallException: HTTP OAUTH 2.0 RESOURCE OWNER PASSWORD CREDENTIALS GRANT call to http://XXXXX:8080/ccos/api/auth/admin not successful. Error while processing Authorization request!

I have tried many thing but without success, please I really need a help.

Thank you in advance.

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Hi mojammil_khan, are you having the same issue?

0 Kudos

I could solve it.

In the first call the REST give me the Session ID and Token, so I have to send token and Cookie parameter in the header using the sessionId of the first call.

Thank you!

0 Kudos

Dear Sebastian,

As you mentioned In the first call the REST give me the Session ID and Token, so I have to send token and Cookie parameter in the header using the sessionId of the first call.

Can you please provide the detail of your parameters & paste you header screen ?

Thank You!

0 Kudos

Hi sebastianalvarez79, I'm having the exact same scenario. The only difference is that I'm having two "set-cookie" keys in the header of the response (having the same name of the key but different values).. Now when I'm trying to get it using dynamic configuration UDF, I'm able to get only 1 value. My requirement is to get both of them but the value is getting overwritten and i'm able to get only the second value... Any suggestions on how can we fetch both the values having the same key name in the response header?

0 Kudos

Hi ilhaam14 I would recommend you to use a Java Mapping instead a UDF. Let me know if you need more detail.

jsts
Newcomer
0 Kudos

Hi Sebastian,

Can you share a bit more detail about how you solved it? I have the exact same issue and can't seem to find the right solution.

Cheers!