• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ServiceMode Message and Provider<SOAPMessage>

 
Bartender
Posts: 2418
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Suppose I have this:


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.

 
Greenhorn
Posts: 27
Eclipse IDE Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you please copy your code here for any inputs ? If you are working with Mode.MESSAGE, then client will work at SOAP Envelope that's the specification.
 
Himai Minh
Bartender
Posts: 2418
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The code from Ivan's notes. The artifacts ReverseStringReq and ReverseStringResp are generated from the wsdl provided by Ivan. They are not shown here.


The client code I created:


Error message from client side :


Error message from server side:


How can I create the SOAP messages with the request and response inside the SOAP messages ?
 
Creator of Enthuware JWS+ V6
Posts: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Himai,

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.



Regards,
Frits
 
Himai Minh
Bartender
Posts: 2418
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Frits.
So, my next questions is how can I convert ReverseStringReq JAXB element into SOAPMessage ? Or, it is not possible to do that?
 
Frits Walraven
Creator of Enthuware JWS+ V6
Posts: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Himai Minh wrote:Thanks Frits.
So, my next questions is how can I convert ReverseStringReq JAXB element into SOAPMessage ? Or, it is not possible to do that?


No that is not possible.

In fact using the Mode.MESSAGE in combination with JAXB is a bit tricky (because there is no @XmlRootElement in the SOAPMessage class), you better stick to Mode.PAYLOAD.

Regards,
Frits
 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Himai Minh,
You can find an example of Mode.MESSAGE with JAXB here on my GitHub. HTH.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Posts: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

a sarkar wrote:Himai Minh,
You can find an example of Mode.MESSAGE with JAXB here on my GitHub. HTH.


Nice example, but we were talking about an example of:

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic