Using IHttpModule to redirect request to another server
Here is the problem that I am trying to solve.
I need to write an IHttpModule that will examine the parameters of a SOAP
web service request and determine whether the local host can service this
request or if it should redirect the request to another server.
If the local host can handle the request, the request should pass through
to the web service normally. If the local host cannot service the request
then the request should be directed to the appropriate web service of another
The redirection check will be performed after the security check has been
done on the request. If the request needs to be redirected the security credentials
will need to be changed to use a security mechanism developed in house.
Other parts of the SOAP header may also need to be changed. Then the SOAP
request will go to the appropriate server.
I need to also make sure that exceptions (even on the redirected servers)
continue to get serialized and sent back to the client.
It seems to me that an HttpModule would be well suited for this problem.
I've read some articles on the topic including a VSM article by Jonathan
Goodyear and Robert Lair. I'm looking for more information on this topic,
watchouts, good articles, good book references and any examples if anyone
I have one specific question. When I do this "redirection" does the return
path still go through the server that performed the redirection? The way
I imagine this will work it would. I imagine the call coming into Server1.
The HttpModule makes the decision that another server (Server2) needs to
handle the request. It modifies the SOAP message appropriately and then
sends on the request to Server2. The response then comes back to Server1
which then sends it back to the client. Does this make sense?