Sunday, July 17, 2016

Get Redirection URL from ESB

In this article I will show you how to get redirection URL from ESB. Assume that you call a back-end service from ESB proxy service and that back-end service re-direct to another service. In that case you will get a response from the server something like below.

HTTP/1.1 308 Redirection (308)[\r][\n]"
Server: Cowboy[\r][\n]
Connection: close[\r][\n]
Location: http://www.mocky.io/v2/57889ef20f0000701dbd16e3DDDD[\r][\n]
Content-Type: application/xml; charset=utf-8[\r][\n]
Date: Mon, 18 Jul 2016 05:40:21 GMT[\r][\n]
Via: 1.1 vegur[\r][\n]
[\r][\n]
<hi></hi>

If you want to get the re-direction url which is with the "Location" header,  you can use the the property mediator as below. 

 <property xmlns:ns="http://org.apache.synapse/xsd"
                   name="Location"
                   expression="$axis2:PRE_LOCATION_HEADER"/>

No comments:

Post a Comment