I've setup a JAXWS client and added a SoapHandler implementation to its Binding handlerChain. All this in the hope of viewing the raw service response when it's not running as it should.
When everything is fine my handler.handleMessage() get called twice, once for the request and once for the response.
But when the service's response is some garbled XML or worse I would have hoped the handler.handleFault to be called but nothing happens.
Here is part of the relevant stacktrace in this case :
com.sun.xml.internal.ws.streaming.XMLStreamReaderException: XML reader error: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
Message: Premature end of file.
com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil.wrapException(XMLStreamReaderUtil.java:256)
com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil.next(XMLStreamReaderUtil.java:84)
com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil.nextContent(XMLStreamReaderUtil.java:99)
com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil.nextElementContent(XMLStreamReaderUtil.java:89)
com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:164)
com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:292)
com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:118)
com.sun.xml.internal.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:278)
com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:180)
com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:83)
com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:105)
com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:587)
com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:546)
com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:531)
com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:428)
com.sun.xml.internal.ws.client.Stub.process(Stub.java:211)
com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:124)
com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98)
com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
I would like to get the RAW data that's exchanged which might not be XML and since my handler already expect a nice XML in its context.getMessage().getSOAPPart() I don't think this is the way to go.
I'm tempted of bypassing the SOAP stack and running my request directly over HTTP to get the data, but find this a tiny-bit ugly
Should I really go that way?