• 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

Adding JAXB object to Soap Header

 
Greenhorn
Posts: 15
Eclipse IDE PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Could you please tel me how to add the JAXB Object to SOAP Header using JAX-WS???


Thanks in Advance..
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
The usual way to manipulate the headers of a SOAP message using Java is through an object implementing the SOAPHeader interface.
After some calls, you will get an object implementing the SOAPElement interface. This interface extends the DOM interfaces Element and Node, thus you can add a DOM node to a SOAPHeader object.
Then you need to transform the JAXB object into a DOM object, before you can add it to the SOAPHeader object. Take a look at the JavaSE 6 API documentation for javax.xml.bind.Marshaller on how to do this.

An alternate route is to manipulate a string representing the XML message. This is not the solution I would prefer, but it may reduce the amount of code you have to write.

A third alternative is using Groovy, which is good at XML manipulation, or some additional framework. If you have restrictions imposed on you, this may not be a viable option.
Best wishes!
 
udhaya kumarG
Greenhorn
Posts: 15
Eclipse IDE PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ivan Krizsan,

Thanks for your Reply.. I got it. Working fine now!
 
Greenhorn
Posts: 2
Android Mac Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Would it be possible to post the code sample. I guess I am missing something while trying to achieve the same
Vikky Chan
 
Evil is afoot. But this tiny ad is just an ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic