1

How do i add sub elements to the SOAP header. I'm using old Spring ws 1.5.5 released in 2008/9.

  SoapHeader header = soapMsgResponse.getSoapHeader();
  SoapHeaderElement loggingHeader = header.addHeaderElement(new QName("https://svn.some.schema/logging.xsd", "LoggingHeader", "NS1"));
  //SoapElement businessId = loggingHeader.addAttribute(new QName(), "");

I don't know how the lines following the above would be like.

I want something like

<soap:Header>
    <NS1:LoggingHeader xmlns:NS1="https://svn.some.schema/logging.xsd">
        <NS1:BusinessId>ABCDEGED</NS1:BusinessId>
    </NS1:LoggingHeader>
</soap:Header>
Akhil K Nambiar
  • 3,835
  • 13
  • 47
  • 85

1 Answers1

1

Found this in this link

you can actually cast the message to a SOAPMessage which gives you full access to all the SAAJ apis. From there you can build whatever elements you want inside the header.

So after type casting you should be able to use something like this

SaajSoapMessage soapMessage = (SaajSoapMessage) message;
SoapHeaderElement messageId =  soapMessage.getSoapHeader().addHeaderElement(new QName("https://svn.some.schema/logging.xsd", "LoggingHeader", "NS1"));
messageId.setText("NS1:abcdef1234");
Community
  • 1
  • 1
Sarfaraz Khan
  • 2,166
  • 2
  • 14
  • 29