Please use exchange.getIn() instead of exchange.getOut() in the process method.


--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com(http://willemjiang.blogspot.com/) 
(English)
http://jnn.iteye.com(http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On January 2, 2014 at 4:14:40 PM, viral.patel69 (viral.pa...@algorhythm.co.in) 
wrote:
>  
> Dear,
>  
> I also want to call third party web service using camel but i am  
> unable to
> call.
>  
> I have tried two things
>  
> First is:Creating SOAP String manually.
>  
> Exchange exchange = template.request(endpointUri, new Processor()  
> {
> public void process(final Exchange exchange) throws Exception  
> {
>  
> exchange.getIn()
> .setBody(
> "> xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\";>"  
> + "> xmlns:ns1=\"http://service.application.buzzor.atpl.com\";>"  
> + "> xmlns=\"http://service.application.buzzor.atpl.com\";>hello  
> world"
> + "");  
>  
> }
> });
> return exchange;
>  
> This code will call Web Service but instead of creating manually  
> string when
> i have tried bellow code for calling web service it will give an  
> error
>  
> String url =
> "cxf://http://localhost:8081/buzzor-service/services/ApplicationService?";  
> +
> "wsdlURL=http://localhost:8081/buzzor-service/services/ApplicationService?wsdl&";
>   
> +
> "serviceName={http://service.application.buzzor.atpl.com}ApplicationService&"; 
>  
> +
> "portName={http://service.application.buzzor.atpl.com}ApplicationServiceHttpPort&";
>   
> + "dataFormat=MESSAGE";
> Exchange exchange = template.request(url, new Processor()  
> {
> public void process(final Exchange exchange) {
>  
> exchange.getOut().setBody("Hello");
> exchange.getOut().setHeader(CxfConstants.OPERATION_NAME,  
> "getApplication");
> exchange.getOut().setHeader(CxfConstants.OPERATION_NAMESPACE,  
> "http://service.application.buzzor.atpl.com";);
> exchange.getOut().setHeader(Exchange.FILE_NAME, "testFile");  
> exchange.getOut().setHeader("requestObject",
> new DefaultCxfBinding());
>  
> }
> });
> return exchange;
>  
>  
> *Exception is "org.apache.camel.InvalidPayloadException:  
> No body available
> of type: java.io.InputStream on: Message: [Body is null]. Caused  
> by: No type
> converter available to convert from type: null to the required  
> type:
> java.io.InputStream with value null. Exchange[Message: Hello].  
> Caused by:
> [org.apache.camel.NoTypeConversionAvailableException  
> - No type converter
> available to convert from type: null to the required type:
> java.io.InputStream with value null]"*
>  
> Can any one help me to resolved my problem.
>  
> Thanks in Advance.
>  
>  
>  
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/How-can-I-call-a-web-service-with-no-parameters-via-a-producerTemplate-tp4806257p5745421.html
>   
> Sent from the Camel - Users mailing list archive at Nabble.com.  
>  

Reply via email to