0

I am writing a camel endpoint which is as below,

<cxf:cxfEndpoint id="testService" address="/TestService"
    serviceClass="com.test.test1.TestQuote" wsdlURL="wsdl/Test.wsdl">
    <cxf:properties>
        <entry key="dataFormat" value="PAYLOAD" />
        <entry key="schema-validation-enabled" value="true" />
    </cxf:properties>
</cxf:cxfEndpoint>

<camel:camelContext id="camelContext">
    <camel:route id="test">
        <camel:from uri="cxf:bean:testService" />
        <camel:to uri="bean:requestValidator" />    
    </camel:route>

In the request validation i am trying to retrieve Soap headers in request validator class,

exchange.getIn().getHeaders();

But expected soap headers are not coming, looks like similar problem https://access.redhat.com/solutions/1504543

EDIT: Soap request

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsc="http://common.com/common21" xmlns:urn="urn:srv.test:v1">
   <soapenv:Header>
      <wsc:AutHeader>
         <wsc:SourceApplication>?</wsc:SourceApplication>
         <wsc:DestinationApplication>?</wsc:DestinationApplication>
         <wsc:authContext>
            <wsc:userid>?</wsc:userid>
            <wsc:credentials>?</wsc:credentials>
            <wsc:id>1234</wsc:id>
         </wsc:authContext>
      </wsc:AutHeader>
   </soapenv:Header>
   <soapenv:Body>
      <urn:CreateRequest>
         <urn:createRequest>
            <urn:customerNumber>12345678</urn:customerNumber>
         </urn:createRequest>
      </urn:reateRequest>
   </soapenv:Body>
</soapenv:Envelope>

If i use String requestXML = exchange.getIn().getBody(String.class); , i am getting soapenv:body (body) node completely, but not soapenv:header node (headers)

Please suggest a way to get and set the SOAP Headers.

Sunil Rk
  • 999
  • 6
  • 12
  • 35
  • http://grokbase.com/t/camel/users/1243sybk41/how-to-get-and-set-the-soap-header – Souciance Eqdam Rashti Nov 17 '16 at 14:22
  • Hi, Thanks for the reference. I am getting payload as null for CxfPayload payload = exchange.getIn().getBody(CxfPayload.class); . And i am using camel version 2.12.2 . – Sunil Rk Nov 18 '16 at 04:51
  • Try this: List soapHeaders = CastUtils.cast((List>) exchange.getIn().getHeader(Header.HEADER_LIST)); – Shoaib Khan Nov 18 '16 at 08:47
  • For an example see _How to get and set SOAP headers in PAYLOAD mode_ in the [documentation](http://camel.apache.org/cxf.html). – Ralf Nov 18 '16 at 12:38
  • @ShoaibKhan, i am getting object wsc:AutHeader, but object attributes are null. i think i am missing something here. – Sunil Rk Nov 18 '16 at 13:52
  • @Ralf, i tried, it is null as i said in my comment (camel jar version is 2.12.2 this might be the reason, not sure) – Sunil Rk Nov 18 '16 at 13:52
  • @SunilRk have you mapped the namespace for wsc? You can get all the child elements and attributes further from the AutHeader mapped to node object. – Shoaib Khan Nov 23 '16 at 07:01

0 Answers0