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:
  • Report post to moderator
Hi,
I have created a JAX-WS client from a business partner's WSDL. I now have many JAXB objects for everything in the WSDL/XSD.
They have provided a data structure for me to fill in and add to the SOAP header which is used for message routing and authentication. After doing some reading I think the proper solution is for me to create a SOAPHandler that intercepts every request and adds the SOAPHeader. Below is a snippet of what my handleMessage method looks like:

public boolean handleMessage(SOAPMessageContext msgCtx) {

SOAPEnvelope soapEnvelope;
SOAPHeader soapHeader;
PartnerHeader partnerHeader; // JAXB object

boolean isOutboundMessage = ((Boolean) msgCtx.get(
SOAPMessageContext.MESSAGE_OUTBOUND_PROPERTY))
.booleanValue();

if (isOutboundMessage) {

try {

soapEnvelope = msgCtx.getMessage().getSOAPPart().getEnvelope();

soapHeader = envelope.getHeader();

partnerHeader = new PartnerHeader(); // JAXB object



// fill in partnerHeader JAXB object



// add partnerHeader to soapHeader



} catch .... {



...



}



}



}

Can someone please show me how to add the filled-in JAXB object into the SOAPHeader?
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Question already asked here: https://coderanch.com/t/553067/Web-Services/java/Adding-JAXB-object-Soap-Header
Locking this thread.
 
"Don't believe every tiny ad you see on the internet. But this one is rock solid." - George Washington
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
    Bookmark Topic Watch Topic
  • New Topic