cancel
Showing results for 
Search instead for 
Did you mean: 

Web API - Cannot read response from external API (The

LaurensMakel
Level 2
Hi all,

We are trying to send a file in combination with a XML as a multipart message to an API endpoint over HTTPS using the Blue Prism Web API.

We have integrated some custom C# code and provided the correct parameters to the request action. On my local machine I can run the C# program without any problems and it will print the response body to my console.

When we execute the HTTPS call in Blue Prism it succesfully sends the file and the XML to the remote API. 

By checking the logs from the remote application we saw that the file and XML are accepted, being processed and a response is returned. 

The problem here is that the response actually never reaches Blue Prism. Blue Prism waits a bit and then decides to throw an error saying "unable to connect remote server".

This is incorrect, the remote server accepted the request and even responded but the response got lost somewehere.

Anyone?

------------------------------
Laurens Makel
------------------------------
8 REPLIES 8

ewilson
Staff
Staff
Hi Laurens,

Interesting situation. What version of Blue Prism are you running? Is there a firewall running on the Blue Prism machine by chance?

Cheers,

------------------------------
Eric Wilson
Director, Partner Integrations for Digital Exchange
Blue Prism
------------------------------

Hi Eric,

We are running Blue Prism at version 6.4 and firewall is Symantec endpoint protection.

In case of a blocking firewall the request wouldn't reach the remote server right? And it wouldn't make sense that Postman is able to succesfully receive a response on the same machine in case of a blocking firewall.

------------------------------
Laurens Makel
------------------------------

Ah, so you have tested with Postman from the same machine. That detail wasn't included in your original post.

What are the contents of the response? Is it just a 200 OK, does it contain a body of JSON, any binary data, or a zipped information?

Have you tried performing a request of the remote service from within a code stage to ensure it works there? The reason I ask is that I believe the WebAPI feature has some issues with processing responses with binary payloads.

Cheers,

------------------------------
Eric Wilson
Director, Partner Integrations for Digital Exchange
Blue Prism
------------------------------

Hi Eric,

We are expecting a 200 OK containing a JSON body, no binary or any zipped data although we are sending binary data amongst an xml over multipart using the WebAPI indeed.

Should I attach the C# code that I wrote to make the call? It runs okay on my machine.

I could re-create a stubbed verison of the remote service on the public web if needed, currently it's hosted internal.

This is the raw HTTP call from Postman from my local machine, not the blue prism machine, maybe it will help to figure out what the problem is:
https://pastebin.com/i93RF9RF

------------------------------
Laurens Makel
------------------------------

Hi Laurens,

Can you run Fiddler or Wireshark on the Blue Prism machine making the request? I'm wondering if the request is actually being lost somewhere, or if the network subsystem on the BP machine is receiving the response and something weird is happening with the processing. If the response is actually being lost on the network somehow before it reaches the Blue Prism machines there's not a whole lot we can do to troubleshoot that. It would require engaging with your network administrators are to see what's going on. One thing you could do is just check to see what hops the request is taking between the BP machine and the destination server. You can do that with a tracert [hostname] ccall on the command line. If this is an internal service, to your company, I would imagine you're not making all that many hops. 

Did you enable the Request Content data item on your WebAPI definition? If BP is throwing an exception about the response you may not see it populated, but it would be interesting to see if/how the request from Blue Prism differs from the Postman request.

If you can stub out the server publicly, I'm happy to run some tests from my side.

Cheers,

------------------------------
Eric Wilson
Director, Partner Integrations for Digital Exchange
Blue Prism
------------------------------

One other thing to check would be the Process logs. You might need to go into your process definition and enable full logging for the WebAPI steps though.

Cheers,

------------------------------
Eric Wilson
Director, Partner Integrations for Digital Exchange
Blue Prism
------------------------------

Hi Eric,

If necessary it should be possible to run listed tools on the BP machine but I'm afraid those require administrator permissions which makes things a bit more difficult due company policies but like I said, if it's necessary it should be possible 🙂 

I kind of assume that the problem is not related to the network since Postman is able to get successfully back and forth. Anyway I will link this community thread to one of the network admins, maybe they see something I don't.

Yes we had Request Content enabled but we also ran some tests with the option disabled, from now on we will continue running tests with the option enabled.

Is there a way to get the RAW HTTP request that Blue Prism sends out?
We could compare it to the Postman one I attached to my previous post.

Enabling logging from process definition doesn't really give any additional information on the error, it just says error connecting to remote server.

I'm going to create a cloud environment where I will host a stubbed version of the service, business rules and external connections will be removed but connection stuff should still be the same. I will PM you the details later on today along with the C# code used to send calls to it.

Thanks for your time Eric 🙂

------------------------------
Laurens Makel
------------------------------

The Request_Content data item will contain the raw request, but as I mentioned BP doesn't populate it if it encounters any sort of exception. That's why I was hoping you could run Fiddler or Wireshark on the local machine.

Another option would be to check the "Disable sending request" option on the Web API action. That will create the raw request and populate the Request_Content data item. It just won't actually push it on the network.

Cheers,

------------------------------
Eric Wilson
Director, Partner Integrations for Digital Exchange
Blue Prism
------------------------------