Requires version 3.0.0 or above.
Membrane Monitor/Router can change the path URI of a request. A request to
can be rewritten to
We want to hide that this service is hosted by axis2. To do this we have to replace the part axis2 from the context path. The hostname is changed by the service proxy. To change the path URI you have to use an URL rewriting feature.
URL Rewriting Feature
To demonstrate how the rewriting works we present here the step by step description how to map the WSDL of the BLZService to a nicer URL.
Start Membrane Monitor and create a simple Service Proxy.
Specify 2000 as the port number on which the router will listen.
Than specify thomas-bayer.com as target host and 80 as target port. Next click on Finish.
To add the URL rewriting feature do right click on the newly created service proxy in the Proxies View and choose edit. Then click onto the XMLConfiguration tab and have a look on it. An XML representation of the Service Proxy is displayied in the main text area of the tab.
add an URL Rewriting element to the Configuration XML so that your Proxy Service definition looks like.
<serviceProxy name="" port="2000"> <rewriter> <map from="^/bank/(.*)" to="/axis2/$1" /> </rewriter> <target host="www.thomas-bayer.com" port="80" /> </serviceProxy>
Click on OK button to apply changes and to save Service proxy configuration.
How it Works
After adding the rewriting feature the RewriteInterceptor is set for the rule. The interceptor will be called during the processing of each request and response.
Now take a closer look at the rewriter element:
<rewriter> <map from="^/bank/(.*)" to="/axis2/$1" /> </rewriter>
The interceptor is configured with one regular expression /bank/(.*) . This will match the following URIs:
In the regular expression we use a group that we can reference when replacing the URI. The value to replace the URI is given by the uri attribute and is set to /axis/$1 . The $1 is the reference to the group and will contain the value matched by the group. So the above URIs will be replaced by the following:
Test URL Rewriting
Test the monitor by opening the URL http://localhost:2000/bank/services/BLZService?wsdl in your browser. You should get the WSDL from the BLZ service.