HowTo monitor a JAX-WS Client with a Reverse Proxy
Membrane SOA Monitor can be placed between a JAX-WS client and a service in two different ways. One way is to use a HTTP proxy as described in Monitoring a JAX-WS client with a ProxySelector. The other way to use Membrane Monitor is as a service proxy. To do that the endpoint address in the client has to be modified so that it sends its requests to the monitor. The monitor then forwards the requests to the service.
First setup a service proxy as described in the quickstart guide.
Then you have to change the client code. The client should connect to the monitor running on port 2000 instead to the service on port 8080. To manipulate the endpoint address we have to put a property with the URL of the monitor into the RequestContext. This can be done by a code snippet like the one in the listing below.
BookAddServiceService service = new BookAddServiceService(); BookAddService port = service.getBookAddServicePort(); ((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
"http://localhost:2000/BookAddService/BookAddServiceService"); port.addBook(0, "Herr der Ringe", "J. R. Tolkien");
The code in bold letters changes the endpoint address to the address of the service proxy. Pleas recognize that the port number was changed from 8080 to 2000.
Now you can run your client and have a look at the messages in the user interface of the monitor.