In one of my projects I was implementing
the Gateway architecture, where I have grouped together all common activities
and will route to the different project /modules, based on relative URI and
needs to pass on the http headers.
There is a misconception
that HTTP headers can only be passed if the backend Proxies are using transport
protocol as HTTP and not local. This is not true, even in the case of local
proxies the headers can be passed through. I am explaining how this can be done
using the frontend and backend proxies and using local and HTTP transport
protocols.
This is how you fetch the
values from header in front –end proxy and set in the outbound to the backend
proxy
Transport Protocol -HTTP
This is how the values
will be passed in $inbound
<tran:headers xsi:type="http:HttpRequestHeaders"
xmlns:tran="http://www.bea.com/wli/sb/transports">
<tran:user-header
name="http-method" value="GET"/>
<tran:user-header
name="query-string" value="name=George"/>
<tran:user-header
name="relative-URI" value=”Customer/GetCustomerDetails”/>
<http:Content-Type>text/xml</http:Content-Type>
</tran:headers>
Transport Protocol -Local
This is how the values
will be passed in $inbound
<con:qualityOfService>best-effort</con:qualityOfService>
<con:request xsi:type="loc:LocalRequestMetaData"
xmlns:loc="http://www.bea.com/wli/sb/transports/local"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tran:headers
xsi:type="loc:LocalRequestHeaders"
xmlns:tran="http://www.bea.com/wli/sb/transports">
<tran:user-header
name="http-method" value="GET"/>
<tran:user-header
name="query-string" value="name=George"/>
<tran:user-header
name="relative-URI" value=”Customer/GetCustomerDetails”/>
</tran:headers>
Receiving proxy
-----------------------------------
The
caller will embedd the values in the user-header name-value pairs.
The
receiving proxy can retreive the values
from tp:user-header and pass in the required the name to fetch the
corresponding values..The syntax is below.
$inbound/ctx:transport/ctx:request/tp:headers/tp:user-header[@name="relative-URI"]/@value
Similarly you can fetch
all the header values in backend proxy.
That’s it from my desk J