cancel
Showing results for 
Search instead for 
Did you mean: 

HTTP error occurred: HTTP/1.1 401 Unauthorized in SAP PI using REST Adapter

maheswarareddykonda
Active Contributor
0 Kudos

Hi Experts,


I am currently working on a SOAP to REST (synchronous) scenario, and have used SAP's REST adapter in the receiver communication channel.

I am using the GET operation here on resource of the target system's REST API, and am trying to retrieve all the data related to the same from receiver server.

Here we are using few authentications while connecting to rest server:

1: basic authentication(user and pwd)

2: x- accesstoken (in http header)

But when I am sending the request from PI to rest server, it getting fail in receiver adapter engine..error is  HTTP error occurred: HTTP/1.1 401 Unauthorized

and below is the screenshot url which we are using in Channel

we tried URL like

Also like hardcoded value in URL


and we tested SOAP UI tool(rest project) its working perfectly fine, The target URL seems like this:

https://xxxxxxxxx.co.uk/xxxxxxx/{id}/sites?Keyword=Atherton&ResultsPerPage=10

Note: Above same URL we tested in SOAP UI(new rest project)with same authentication..its working perfectly fine, Below is the screenshots.

And one more thing while sending “id” input data we had to keep either id style as Template or hardcoded in URL itself.. then only it working in UI tool.

So, Please can someone help me out to handle in pi server..


Thanks,

Maheswarareddy



Accepted Solutions (0)

Answers (1)

Answers (1)

maheswarareddykonda
Active Contributor
0 Kudos

Hi,

small progress...i just recreated new Channel and used below URL

https://xxxxxxxxx.co.uk/xxxxxxx/{id}/sites?Keyword=Atherton&ResultsPerPage=10

now error is  HTTP/1.1 400 Bad Request

so, can any one please provide information why that error coming , in case URL formate is wrong, then how to frame the URL.

Thanks in advance!!

Thanks,

Maheswarareddy

former_member186851
Active Contributor
0 Kudos

Hello Mahesh,

You should give attributes and give the paylod values or constant to form the URL.

maheswarareddykonda
Active Contributor
0 Kudos

Hi Sritharan,

if you see the first post, there is a communication channel screen shot, in that URL had only one attribute i.e "ID"

that same we are passing value through Xpath to "ID"

my Question is why that URL working in saop ui and not in PI server

Thanks,

Maheswarareddy