Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ABAP CL_HTTP_CLIENT basic authentication gives HTTP/1.1 500 Internal Server Error

0 Likes
3,641

Hi Friends,

I am calling HTTPS Rest API (POST Method) by using CL_HTTP_CLIENT=>CREATE_BY_URL in SAP.

From Postman I am using POST method with sample URL "https://www.test.com/abc/xyz/pqr" and passing Basic Authentication credentials, and it is succesful.

If I look at the Postman HTTP code, it has two parts on the top:

POST /abc/xyz/pqr HTTP/1.1

Host: www.test.com

From SAP, if I use POST method and pass the full URL (https://www.test.com/abc/xyz/pqr) and pass basic authentication credentials, it gives Invalid Authentication (status code 500). If I just pass "https://www.test.com", it is successful.

I want to add the name of the POST method "/abc/xyz/pqr" before sending from SAP.

I tried by using option below code, I again get the error of Invalid Authentication. CL_HTTP_UTILITY=>SET_REQUEST_URI( REQUEST = LO_HTTP_CLIENT->REQUEST URI = '/abc/xyz/pqr' ).

Requesting your help in this, thanks in advance.

3 REPLIES 3
Read only

cris_hansen
Product and Topic Expert
Product and Topic Expert
0 Likes
2,473

Hi Birendra,

Is the URI another SAP system or it is an external one?
If it is an SAP system, then you can use RZ11 to set is/HTTP/show_detailed_errors = TRUE and then obtain more details about the error.
If it is an external system, then you would need to know more about the external system API and see why an error 500 is defined as "Invalid Authentication" (in an SAP system it would be 401 Unauthorized).

Regards,
Cris

Read only

0 Likes
2,473

Hi Cris,

Thanks for your reply. It's an external one.

Thanks & Regards,

Birendra

Read only

0 Likes
2,473

Hi Friends,

Any suggestions, as this is working from Postman, and the same thing is not working from SAP.

Thanks in Advance.