camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From suralk <sura.mon...@yahoo.com>
Subject how to access a SOAP message part inside a route
Date Tue, 02 Oct 2012 05:51:22 GMT
Hi All,
I have a route that gets some data from a remote we service and writes to a
file:
 from("file:src/data?noop=true")

.to("cxf://http://www.webservicex.net/stockquote.asmx?wsdlURL=src/main/resources/META-INF/stockquote.wsdl&serviceName={http://www.webserviceX.NET/}StockQuote&portName={http://www.webserviceX.NET/}StockQuoteSoap&dataFormat=MESSAGE")
        	
 .to("file:src/dataout?fileName=t.xml");

This works fine, but I want to access only some of the elements in this SOAP
message. I tried a processor like the one shown below, but it is returning
null. Can someone point out what is wrong in this route?
I am assuming that I should not cast the SoapBody to Cxfpayload because the
dataformat at the endpoint is MESSAGE. However, I do not know an
alternative.

.process(new Processor() {
                    @SuppressWarnings("unchecked")
                    public void process(final Exchange exchange) throws
Exception {
                        CxfPayload<SoapBody> requestPayload =
exchange.getIn().getBody(CxfPayload.class);
                        List<Source> inElements =
requestPayload.getBodySources();
                        List<Source> outElements = new ArrayList<Source>();  
                    
                        for(Source element:inElements)
                        {
                        	Element in = new
XmlConverter().toDOMElement(element);
                        	System.out.println("++++++++++++++" +
in.getNodeValue());// prints null
                        }
                       
                    }
                })



--
View this message in context: http://camel.465427.n5.nabble.com/how-to-access-a-SOAP-message-part-inside-a-route-tp5720345.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message