My question is if I choose Service.Mode.MESSAGE, must I implement Provider<SOAPMessage> ?
From Ivan's notes p.161, I choose Service.Mode.MESSAGE instead of Service.Mode.PAYLOAD, and I implement Provider<Source>, just like what Ivan does.
However, I got a null pointer exception from the client side because the server expects to have a SOAP envelope.
I wonder if Service.Mode.MESSAGE and Provider<SOAPMessage> must be used together and Service.Mode.PAYLOAD and Provider<Source> must be used together.
You are sending a ReverseStringReq as JAXB object (mashalled to XML) over the wire. This ReverseStringReq is (probably) not a SOAPMessage object and that is why you get the UnmarshalException on the server side (as the server thinks it is getting an SOAPMessage because of the Mode.MESSAGE). You can use JAXB object in combination with the dipatch client and Mode.MESSAGE though:
For JAXB objects (from JAX-WS 2.x)
JAXB Objects Use of JAXB allows clients to use JAXB objects generated from an XML Schema to create and manipulate XML representations and to use these objects with JAX-WS without requiring an intermediate XML serialization. JAXB objects may be used with any protocol binding in either message or message payload mode.