Skip to Content

REST Receiver Adapter POST Method

Hi SAPiens,

I am trying to integrate SAP PI with SFDC (REST Service).

I am trying with REST Receiver adapter for LOOKUP and get ACCESS_TOKEN in response.

But my receiver channel is showing BAD requet 400.

I am using below URL under URL pattern -

https://xxxxxxx.my.salesforce.com/services/oauth2/token?grant_type=password&client_id=xxxxxxxxxxx&client_secret=xxxxxxxxx&username=xxxxx@xxx.com.xxx&password=xxxx

Error Log -


Error when calling an adapter by using the communication channel CC_RCVR_SFDC_REST_LOOKUP (Party: , Service: BC_SFDC, Object ID: 25f71318dbba3381bcf077849c698519) XI AF API call failed. Module exception: (No information available). Cause Exception: 'HTTP POST call to https://xxxxx.my.salesforce.com/services/oauth2/token?grant_type="password"+client_id="xxxxxxxxxxxxxxxxxxxxxxxxxxx"+client_secret="xxxxxxxxxxxxxxxxxxx"+username=xxxxxxxx@xxxxxx"+password="xxxxxxxxx" not successful. HTTP/1.1 400 Bad Request'.

In HTTP operations I have selected manual value = POST.

Why I am getting this error?

BR,

Rashmi

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Aug 28, 2017 at 12:28 PM

    Hi Rashmi,

    400 request error are usually because the server is not able to understand the request you are sending as suggested earlier again the best way it to check with soapui/postman with enabling trace in http adapter then cross check both the xml and you will get to know what exactly is causing the issue .

    Please make sure you close the earliet raised threads.

    Br,

    Manoj

    Add comment
    10|10000 characters needed characters exceeded

    • As you are querying the sfdc server for token your operation should be GET and not POST and also can you make sure you have enabled XML to JSON conversion and vice versa is taken care at channel level.

      Br,

      Manoj

  • Aug 28, 2017 at 01:36 PM

    Hi Manoj,

    This is what we got details from SFDC team also tested in SOAPUI and POSTMAN, it iis working with POST only and not with GET Method..

    BR,

    Rashmi

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 26, 2017 at 01:08 PM

    Hello Rashmi!
    I'm having a similar issue, but while using a dynamic token on REST Adapter and passing the value either on URL Pattern or in HTTP Header, to connect to our partner system.


    Performing several tests, analysis, collecting XPI Inspector logs and in parallel with a VH incident at SAP, I perceived that when I put this dynamic token value (retrieved from XML message) that contains /, %, & and other characters, the error occurs.


    However, in my case, when I manually insert the token on HTTP header, the connection works fine.


    We are at this moment awaiting for an SAP response.

    Our environment is on 7.40 SP14 - all components at latest patch.

    Hope it helps...

    Regards

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello guys!
      Thank you very much and I'm very sorry for a long long time with no answer.

      At the end, SAP has replied the incident with the solution. I had to add below standard module parameter in order to handle this issue.

      Former Member thank you for the tip!

      module.png (7.8 kB)
  • avatar image
    Former Member
    Oct 28, 2017 at 08:32 AM

    I have similar interface here but I decide slipt in two, because for me Lookup channel into UDF it´s not good for archtecture perspective so look the my recent release blog about, it´s to get tokenid:

    https://blogs.sap.com/2017/10/27/how-to-test-message-pi-aex-without-backend/

    I see also that you solved.

    Regards,

    Viana.

    Add comment
    10|10000 characters needed characters exceeded