cancel
Showing results for 
Search instead for 
Did you mean: 

Web Services - 302 Redirect

MaxGent
Level 2
Hello - am currently building a Web Service that pings a central server in order to get a) a redirect URL and b) a JWT token. I am able to send the request and get a 302 code back, but it comes up as an internal error rather than populating the HTTP Status Code and Response Headers data items as expected. 

If we get a 200 OK back it populates them, but I can't seem to find a way to get it to be okay with a 302 as this is what we want to get back when making this API call - please help!
7 REPLIES 7

Hi Max,

This is possible but how you handle errors may need to change.

Because it's not a 200 result it may be getting classed as a "failure" despite it being positive if the return is a 302.

What you can do is inside your process or retry loop if you work in a pathway to read the exception message and see if "302" is in the test with an InString( call.
If it is in the exception message then you can return to the happy path. If it was a 400 exception e.g. invalid password, then you can throw the exception as normal. 
Example below

36522.png
Ronan Considine Senior Business Analyst Blue Prism

MaxGent
Level 2
Thanks for this Ronan - how can we then get the data from the response headers once we've handled the 302 error?

Hi Max, if you look at the response content when you generate the 302 error are you able to see the full detail or is it just an error message?

You should be able to add 1 or many calculation stages to read the data into a suitable collection. If you are able to send an example or a safe data example I might be able to help you more.
Another tool that might help you with responses it Postman, it's free to set up and you can see the full response with any response so you can set the outputs in BluePrism to different headers if they are available.

Ronan Considine Senior Business Analyst Blue Prism

ewilson
Staff
Staff
Hi @MaxGent,

Am I correct in thinking that you're using the Web API Service feature to build this? If so, you probably won't have access to the headers as I don't believe BP includes them in the exception detail. This is one of my gripes about this feature. If the response is anything other than an HTTP 2xx code, Blue Prism treats it as an exception and things become challenging.

What I've started doing is simply using the Utility - HTTP VBO to perform all but the absolute most basic HTTP/REST actions. The HTTP VBO gives you significantly more control over the request/response handling.

Cheers,
Eric​

MaxGent
Level 2
Hi Eric, 

Thanks for this - that's really frustrating, but we'll go ahead and build an object for this instead to cover each API call. Is there a way to feed this into the dev team? It feels like a fairly fundamental feature... 

Hi Ronan, 

Thanks for your help on this, but as Eric mentioned we need the headers specifically as the content is empty (as expected).

MaxGent
Level 2
When I'm trying to put in headers (namely Content-Length) into the HTTP Request, I keep getting the below error: 

36523.png36524.png

ewilson
Staff
Staff
Hi @MaxGent,

Regarding the Web API feature, there are several open enhancement requests on it. I believe you can find some of them on the Ideas page.

As for the Content-Length header, are you using the HTTP Request action or one of the others? Generally, Content-Length doesn't need to be provided unless you're using the HTTP Request Multipart action. This leads me to another question. Are you using the latest release of the Utility - HTTP VBO? If not, you can get it from the Digital Exchange at the link below:

https://digitalexchange.blueprism.com/dx/entry/3439/solution/utility---http

Cheers,
Eric​