How to retrieve the SOAP header from exchange object in Camel?

Solution Verified - Updated -

Issue

  • We exposed an Apache camel-cxf webservice. Using camel processor we are trying to get the soap header that we passed in the soap request from the soapUi client.
    The exchange object contains the body of soap message(not soap header). In the exchange.getIn.getHeader() we are only getting the HTTP Headers we passed, not the SOAP Header.

How to retrieve the SOAP header from exchange obeject in Camel ?

Following are the soap header passed::

<soapenv:Header>
      <ns1:info xmlns:ns1="http://www.w3schools.com/transaction/">
         <ns1:TransactionID>01</ns1:TransactionID>
         <ns1:AppUserID>52</ns1:AppUserID>
         <ns1:AppPass>ab</ns1:AppPass>
      </ns1:info>
   </soapenv:Header>
  • We tried using,
    • exchange.getIn().getHeaders();
    • exchange.getIn().getHeader(“TransactionID”);
      However it was not able to extract the SOAP header which was sent.
  • How to add custom soap headers in Payload mode ?

Environment

  • Red Hat JBoss Fuse
    • 6.x
  • Apache Camel
  • Apache CXF

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.