Just use Camel's type converter, much easier. In your processor code write

String data = exchange.getIn().getBody(String.class);

On Fri, Jul 25, 2014 at 2:23 PM, Jaishankar <[email protected]> wrote:
> Using rest client POST method I'm sending Soap Envelop message.
> But couldn't get it in exchange and it's null.
> //Code
>                 from("servlet:///hello?servletName=TestServlet")
>                 .log("log: ${body}")
>                 .process(new Processor() {
>                         public void process(Exchange arg0) throws Exception {
>                                 InputStream httpinputstream=(InputStream) 
> arg0.getIn().getBody();
>                 InputStreamReader inputStreamReader = new
> InputStreamReader(httpinputstream);
>                 StringBuilder stringBuilder=new StringBuilder();
>                 BufferedReader bufferedReader = new
> BufferedReader(inputStreamReader);
>                 String httpread = bufferedReader.readLine();
>                 while(httpread != null) {
>                         stringBuilder.append(httpread);
>                         httpread =bufferedReader.readLine();
>                 }
>                 System.out.println("HTTP template response:::
> "+stringBuilder.toString());
>                         }
>                 });
>
> // Message sent in RestClient POST
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/
> envelope.xsd">
>   <soap:Body>
>     <Employee_Modify>
>       <EmployeeID>sdf</EmployeeID>
>       asdf
>     </Employee_Modify>
>   </soap:Body>
> </soap:Envelope>
>
>
> I need the request message in process?
> Please help me
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Exchange-Body-is-null-while-using-processor-tp5754445.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [email protected]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Reply via email to