Reputation: 11
I have to build a UI that consumes and needs to display the xml request and responses to a SOAP Web Service. (This is the first time I am working with SOAP and also my first stack question). All the questions I've seen only answer half of what I'm asking.
Is there a way to display the request xml even if the soap request is not sent?
This code snippet is me binding the ServicePort object (generated by wsimport), to MyHandler, which implements SOAPHandler <SOAPMessageContext>
eftServicePort = new EFTService(new URL(uri)).getEFTPort();
handler = new MyHandler();
Binding binding = ((BindingProvider) eftServicePort).getBinding();
List<Handler> handlerList = binding.getHandlerChain();
handlerList.add(handler);
binding.setHandlerChain(handlerList);
This works fine when the URI is correct. I can display both the request and response xml on screen.
If the uri is incorrect/invalid (at the first line) an exception is thrown and the handler object is not created or bound to the ServicePort object.
Upvotes: 1
Views: 213