I would like to have a reverse proxy (apache httpd with mod_proxy
) in front of an IIS hosting a SOAP Web Service.
The problem I'm facing is that the SOAP clients ask the web server for the details about the web service by downloading the WSDL
from the endpoint. This WSDL is generated by the web service and it contains the URLs to the web service that the client should use. The problem is that when the web service is behind the proxy, the generated URLs contain the wrong, private, address.
the IIS web service is located at
http://internal.host.com/Dirname/Service.asmx
and it can be called with GET
or POST
.
The WSDL is retrieved with GET with WSDL
as the query string:
http://internal.host.com/Dirname/Service.asmx?WSDL
The reverse proxy presents the web service as:
https://proxy.host.com/VirtualDir/Service.asmx
And my problem is that the contents of the dynamically generated WSDL contains the internal URLs (that the proxy connects to).
I would like to avoid hacking/recompiling the web service itself, so when I was thinking of alternative solutions, I wondered this;
Could I make httpd
on the proxy server somehow intercept the call to the ?WSDL document and serve static content instead, and still forward other queries (including GET parameters) to the internal IIS server?
The relevant httpd config currently looks like this:
ProxyPass "/VirtualDir/" "http://internal.host.com/Dirname/"
And I was thinking that perhaps RewriteCond and RewriteRule could be used in some clever way to catch only the requests to the /.../Service.asmx?WSDL
and serve a static local document instead, and forward "the rest" to the IIS, but I don't really know how to do that correctly without breaking anything else.
The reverse proxy is used for other services as well, under other virtual "directories".
I've worked around the problem for the time being, by creating a static WSDL specification, containing the proper (proxied) addresses to the service methods, and tell the clients to use that one instead.
It seems to work just fine, but it will have to be updated each time the WebService interface changes.
I've set up a static file on the proxy apache http on this address:
That contains the correct WSDL specification with the public URIs to use. I downloaded it from the IIS with
wget
and just fixed it with a text editor.