camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "viral.patel69" <viral.pa...@algorhythm.co.in>
Subject Re: How can I call a web service with no parameters via a producerTemplate?
Date Thu, 02 Jan 2014 04:59:23 GMT
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(
								"<soap:Envelope
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
										+ "<soap:Body><ns1:getApplication
xmlns:ns1=\"http://service.application.buzzor.atpl.com\">"
										+ "<arg0
xmlns=\"http://service.application.buzzor.atpl.com\">hello world</arg0>"
										+ "</ns1:getApplication></soap:Body></soap:Envelope>");

			}
		});
		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.

Mime
View raw message