Thursday, December 1, 2011

How to call a Web Service or API "Off to the side" from the Vordel Gateway

A very common question asked by Vordel Gateway users is "How do I call out to an API or Web Service from within the Gateway, then use the response in a request to another destination?". I notice that people often gravitate to the "Web Service Filter" or "Call Internal Service" filter for this, but that's actually not how it's done.

The way to do this is to use the "Connect to URL" filter. In the example below, I am calling out to a REST API from within a circuit on the Vordel Gateway. You can see that because the initial request to the Gateway is a POST (it's a SOAP message coming in) and the call out to the REST API is a GET, I'm using a "Set HTTP Verb" to set the verb to "GET" before making the request to the REST API (a REST STS in this case, to request a SAML Assertion). I then am taking the response from that service, and using it in the construction of a request to the destination Web Service, which is an SP (Service Provider) that expects a SAML Assertion to be sent to it.



It's quite easy, in this way, to string together many calls to different APIs or Web Services.
Link
Note that if you want to store the initial request, make the callout "off to the side" to another service, then restore the initial request (i.e. not overwrite it with the response from the service you called "off to the side") then that's where the "Store" and "Restore" filters are used.