Announcement Announcement Module
No announcement yet.
For Arjen/Spring Team : Reading Nested Headers Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • For Arjen/Spring Team : Reading Nested Headers

    I ran into a problem while reading nested headers with Spring WS

    My header looked like

    HTML Code:
    <tns:testHeader xmlns:tns="" >
              <tns:TransactionName> </tns:TransactionName> 
              <tns:StartTime> </tns:StartTime>
              <tns:stopTime> </tns:stopTime>
    I do not find a standard way of retrieving the nested header elements using Spring SOAP API's. Well, i can get the source and unmarshal it. But i think i will be going a step back (since the message factory took the XML and converted it into SOAP Objects already and now i choose to go back to using the XML).

    Is this a limiation of Spring Soap API's that it can't deal with nested headers or am i missing something here? I noticed that XWSSSecurityInterceptor of spring ws takes in nested headers - how does this interceptor handle it? I checked the source code for XWSSSecurityInterceptor but i am unable to find this particular logic for nested headers.

    Any inputs from the Spring experts would be nice
    Last edited by Rahul Mishra; Apr 29th, 2008, 01:03 AM.

  • #2
    Spring-WS provides an abstraction over SOAP messages, making it easier to switch from SAAJ to Axiom. That abstraction results in some things being relatively hard to do, compared to the native APIs.

    What you can do, is either get the native message (cast it to SaajSoapMessage, and call getSaajMessage() or cast it to AxiomMessage, and call getAxiomMessage()), or you can transform the header Source into a DOMResult, and manipulate that.


    • #3
      Nested Headers

      Thanks Arjen,

      Just wanted to know that i wasn't missing something. Your reply confirmed that.

      Will use one of the options as recommended