REST Post API to SAP returns Status 0

Hi everyone,

I am getting an error whenever I am using the activity “HTTP Request” to connect to SAP. I have already tried what it is written in this link, unfortunately it is not working.

https://forum.uipath.com/t/api-post-request-giving-0-as-status-code/149970/8

I have also tried to create a Library but it didn’t work either
https://forum.uipath.com/t/http-request-activity-returns-status-code-0-and-empty-response-but-works-in-soapui/111930/8

This is a simple authorization with user and password. I have tried the process in SOAPUI and it works correctly. First, I call a GET (in the header I have argument “X-CSRF-Token” with “Fetch”) and I get back the token (x-csrf-token) and the cookie.

Then, I call POST ( “X-CSRF-Token” with the info retrieved in GET, and “cookie” with the value retrieved in get “SAP_SESSIONID…” ) and I see that there was a connection with SAP.

With UIPath I do the following steps:

1.- Create a HTTP Request for GET.

Header: x-csrf-token = “Fetch”

I get in the header the x-csrf-token and the cookie that I will use in the Post

2.- Create a HTTP Request for POST

Header:

x-csrf-token =

cookie = <cookie received from GET, only the substring starting with SAP_SESSIONID…>

As I described, this combination works in SOAPUI. Unfortunately in UIPATH it doesn’t work.

The GET is working correctly returning the token and the cookie.

The POST get a Status 0. It seems that there is no connection with the system at all, I cannot see the request in SAP.

If I only pass the token, without the cookie, then I get a Status 403. There is connection to SAP, I can see the request in SAP. Since the cookie is not provided then I get the error.

Did anyone able to solve this problem?

Any info will be more than welcome.

Thanks very much.

There is no status like 0 from any server, it may be because the client aborts or failed to send back the response. I hope the request may have some issues which server won’t able to process. Can you check the same request in postman and let us know if it is working fine there @Alejandro_Montero.

Hi HareeshMR,

thanks for your reply.
Unfortunately it works with Postman as well as with SoapUI.
If the cookie is not set I get a 403 status error. If in UIPath I set the received cookie in the header then I don’t get any response.

Best regards,
Alejandro

You need to set the cookie to let the request know that you are authenticated. so you must pass it. When you mean, you are not getting any response, what is the status of the request? Please run the workflow and check instead of preview response

Hi Hareesh,

in the POST request header I am passing:

  • x-csrf-token with the token received from the GET request
  • cookie with the cookie received from GET (I am only take the part starting with SAP_SESSION…)

I have tried it manually in SOAPUI and in POSTMAN and it works fine. First, I request the Token and the cookie with GET. Then I fill the token and the cookie in the POST Header.

Unfortunately UIPath returns Status 0.

In SAP I can see the GET request and the POST request from SOAPUI and from POSTMAN. In the case of UIPath I only see the GET request. This is what you say in your previous message (it is not able to authenticate).

In UIPath there are only three returning parameters (Output) for the HTTP Request activity. In Header, I don’t get any result and in StatusCode I receive 0. How can I see the response preview?

Thanks again for your help.

BR
Alejandro

The result will be the response from the server if you are going to get anything from server and status will be the response code by the server. Are you getting anything in the result?

I don’t get anything in the response.
Result and Headers are empty and in Status Code I get 0.

The REST service works with SOAPUI and Postman, this is the reason I don’t understand why with UIPath is not working. It might be a argument that needs to be added somewhere in the request.

As I said, I am passing the Token and the cookie in the header, same as in the other tools. Unfortunately with different results

Can you post the screenshots of how you are trying to send the request in UiPath? Same screenshot of postman is also helpful :slight_smile:

Following are the Postman Screenshots

GET Request Postman

POST Request Postman

And the following are the UIPath Screenshots
Workflow Process

GET Request UIPath

POST Request UIPath

Hi,

has anyone solve that problem?

Regards,
Alejandro

Hi Alejandro,

Were you able to solve this problem? I’m having the exact same issue with a 403 response and have tried all different combinations of sending cookies, headers, etc.

Works fine in postman but can’t get it to work in UiPath.

Hi,
unfortunately I was not able to solve the problem. It seems that the cookies info are not beeing correctly passed.
In the meantime I found a workaround. There is the possibility to work with BAPIs (SAP Remote Function Modules), so I just used them. Anyway if somebody is able to solve the problem I would be interested for a future solution.

Regards
Alejandro

This is the link to the BAPI explanation BAPI Functionality in UI Path

@StefanSchnell any inputs / thoughts from your side here? Thanks, Lev

1 Like