从apache camel交换对象中检索soap标头

时间:2016-11-17 12:55:09

标签: soap apache-camel cxf soapheader

我正在写一个骆驼端点,如下所示,

<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>

在请求验证中,我试图在请求验证器类中检索Soap头,

  

exchange.getIn()getHeaders();

但是预期的肥皂标头不会出现,看起来像类似的问题https://access.redhat.com/solutions/1504543

  

编辑:肥皂请求

    <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>

如果我使用String requestXML = exchange.getIn()。getBody(String.class); ,我正在获得soapenv:body(body)节点完全,但不是soapenv:header node(headers)

请建议一种获取和设置SOAP标头的方法。

0 个答案:

没有答案