Use the Apache Camel CXF component [1] with the MESSAGE dataFormat to
receive the request. Afterwards you can use the XPath [2] or XQuery
component to retrieve the needed data. Something like

    <route>
        <from uri="cxf:bean:cbrProxy" />
        <setHeader headerName="theHeaderName">
            <xpath
resultType="java.lang.String">/soapenv:Envelope/soapenv:Header/wsa:MessageID</xpath>
        </setHeader>
    </route>

[1] http://camel.apache.org/cxf.html
[2] http://camel.apache.org/xpath.html
[3] http://camel.apache.org/xquery.html

Best,
Christian

On Wed, Sep 26, 2012 at 10:03 AM, balkishore <balkishore.pan...@gmail.com>wrote:

> Hi,
> I wanted to extract a term from my soap message, I tried using Xpath but,
> no
> matter what I try i always use to get an error: Invalid xpath expression.
> So
> i decided to take help of CXF.
>
> I came up with something like this:
>
> CxfPayload<SoapHeader> payload =
> exchange.getIn().getBody(CxfPayload.class);
> List<SoapHeader> headers = payload.getHeaders();
>
> how how can i get the required element from the header? As now I have my
> header stored in a list headers.
> I tried to use
>
> headers.get(), but it's asking me to specify the index as argument.
>
> What is an index and how would i determine the index of my term?
>
> my SOAP message is as follow:
>
> <?xml version="1.0" encoding="http://schemas.xmlsoap.org/soap/envelope/";
> standalone="no"?>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
> ">
> <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing";>
> <wsa:ReplyTo>
> <wsa:Address>http://www.w3.org/2005/08/addressing/none</wsa:Address>
> <wsa:ReferenceParameters>
> <axis2:ServiceGroupId
> xmlns:axis2="http://ws.apache.org/namespaces/axis2
> ">urn:uuid:2BC5F552AF3179755C1348038695049</axis2:ServiceGroupId>
> </wsa:ReferenceParameters>
> </wsa:ReplyTo>
> <wsa:MessageID>urn:uuid:2BC5F552AF3179755C1348038695050</wsa:MessageID>
> <wsa:Action>some action to perform</wsa:Action>
> <wsa:RelatesTo>urn:uuid:599362E68F35A38AFA1348038694466</wsa:RelatesTo>
> </soapenv:Header>
> <soapenv:Body>
> <ns1:TCAQSR_BAS_ServerGetOsVariableOutput
> xmlns:ns1="http://www.transcat-plm.com/TCAQSRBase/";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:type="ns1:TCAQSR_BAS_ServerGetOsVariableOutputType">
>
> <ns1:TCAQSR_BAS_BaseOutputServiceReturnCode>0</ns1:TCAQSR_BAS_BaseOutputServiceReturnCode>
> <ns1:TCAQSR_BAS_BaseOutputServiceTxtMessage>TCAQSRBaseService
> 2.2.1</ns1:TCAQSR_BAS_BaseOutputServiceTxtMessage>
>
> <ns1:TCAQSR_BAS_BaseServerGetOutputVal>PCSW13</ns1:TCAQSR_BAS_BaseServerGetOutputVal>
> </ns1:TCAQSR_BAS_ServerGetOsVariableOutput>
> </soapenv:Body>
> </soapenv:Envelope>
>
> I would like to extract urn:uuid:2BC5F552AF3179755C1348038695049 from the
> serviceGroupID node. what index should i specify in this case?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Getting-a-node-from-an-XML-using-camel-cxf-tp5720008.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--

Reply via email to