Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java JAX-WS web-service client: how log request & response xml?

I created an implementation of LoggingHandler that implements SOAPHandler<SOAPMessageContext>

It should log whenever handleMessage triggers (and it is never called in my case)

MyService service = new MyService();
MyServicePort port = service.getPortType();

now I try this:

BindingProvider bindingProvider = (BindingProvider)port;
bindingProvider.getBinding().getHandlerChain().add(new LoggingHandler());

I do not see any request / response xml though.

Can you suggest any solution? Maybe there's another way to see output and request XML?

like image 649
EugeneP Avatar asked May 11 '10 06:05

EugeneP


People also ask

How do I test a JAX-WS web service?

A JAX-WS web service can be tested by using the Web Service Tester View displayed in Figure 7.1, “Web Service Test View”. The JAX-WS test is specified by: Selecting the JAX-WS combobox option. Entering the location of the WDSL file.

What is the difference between JAX RPC and JAX-WS web services?

JAX-WS and JAX-RPC are Java programming APIs that are used in the web service bindings, to create and consume SOAP messages. JAX-WS is the successor to JAX-RPC. This topic describes the similarities and differences between the two. Using the web service binding, you can specify that messages are processed by handlers.


1 Answers

It starts working if you use this method:

binding.setHandlerChain(handlerList);

So, first initialize this list with

binding.getHandlerChain();

then add your element to the list and after all

setHandlerChain();
like image 89
EugeneP Avatar answered Sep 30 '22 16:09

EugeneP