camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: How to invoke CXF webservice from processor bean
Date Tue, 24 Jul 2012 06:51:07 GMT
You just set the header on the exchange which is passed to process method.
You should set the header on the ProducerTemplate, please use the
method requestBodyAndHeader instead of requestBody.


On Fri, Jul 20, 2012 at 9:34 AM, jeyaseelan78
<jeyaseelansukumar@gmail.com>wrote:

> Hi,
> I have processor bean using which i would like to invoke an external
> webservice. I need to pass the operation name as well as parameters. If I
> pass the parameter in header then its ignored and if i send it via uri then
> I am getting error as invalid parameter name.
>
> public void process(Exchange exchange) throws Exception {
>                 List<String> params = new ArrayList<String>();
>                 params.add((String)exchange.getIn().getBody());
>                 exchange.getIn().setHeader(CxfConstants.OPERATION_NAME,
> "processClient");
>                 try{
>                 String reply =
>
> exchange.getContext().createProducerTemplate().requestBody("cxf:bean:PASLIEndpoint",params,String.class);
>                 System.out.println("Reply ---> : "+reply);
>                 exchange.getOut().setBody(reply);
>                 }catch(Exception ex){
>                         ex.printStackTrace();
>                 }
>
>
>         }
> If I use the above code then the operation name is ignored and camel calls
> only the first operation in the webservice.
> If I use
> String reply =
>
> exchange.getContext().createProducerTemplate().requestBody("cxf:bean:PASLIEndpoint?operationName=processClient",params,String.class);
> then the parameter operationName is not identified and I get an exception.
> can you please tell me how should I be able to use the operation name and
> parameters using processor bean.
>
> Thanks a lot.
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/How-to-invoke-CXF-webservice-from-processor-bean-tp5716272.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message