camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Malathi G <malathi...@gmail.com>
Subject Camel to Soap webservice call
Date Wed, 13 Nov 2013 09:18:31 GMT
Hi,

I am calling soap based webservice from camel but i am getting " Could not
find definition for service {http://service.polaris.com/}ServiceRequest"
error

*Camel code:*
CamelContext context=new DefaultCamelContext();
        try{
	    final DataFormat bindy = new
BindyCsvDataFormat("com.polaris.mh.camel.poc.scenario_1.dto");
	    final CxfEndpoint wsendpoint = new CxfEndpoint();
	   
wsendpoint.setAddress("http://localhost:9090/axis2/services/ServiceRequest");
	   
wsendpoint.setWsdlURL("http://localhost:9090/axis2/services/ServiceRequest?wsdl");
	    wsendpoint.setServiceClass("com.polaris.service.ServiceRequest");
	    wsendpoint.setCamelContext(context);				
	    context.addRoutes(new RouteBuilder() {
	        public void configure() {
		from("mina:tcp://localhost:6789?textline=true&sync=true").process(new
Processor(){
		        public void process(Exchange req){
			log.info("Request Message-->"+req.getIn());
		        }
		 }).unmarshal(bindy).marshal().xstream()
                          .to(wsendpoint)
		.process(new Processor(){
		public void process(Exchange res){
		          log.info("Response Message-->"+res.getIn());
		}
	}).unmarshal().xstream().marshal(bindy);
	}
	});
	}
            catch(Exception exception){
	      exception.printStackTrace();
	}
	try{
		context.start();
		while(true){		
	             }
	}
			

*WSDL file:*
<?xml version="1.0" encoding="UTF-8" ?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
	xmlns:ns1="http://org.apache.axis2/xsd"
xmlns:ns="http://service.polaris.com"
	xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
             xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
             xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
             xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
	targetNamespace="http://service.polaris.com">
	<wsdl:documentation>ServiceRequest</wsdl:documentation>
	<wsdl:types>
	     <xs:schema attributeFormDefault="qualified"
			elementFormDefault="qualified"
targetNamespace="http://service.polaris.com">
	            <xs:element name="request">
		        <xs:complexType>
                                     <xs:sequence>
			      <xs:element minOccurs="0" name="request" nillable="true"
type="xs:string" />
			</xs:sequence>
		        </xs:complexType>
		</xs:element>
		<xs:element name="requestResponse">
		        <xs:complexType>
			<xs:sequence>
			       <xs:element minOccurs="0" name="return" nillable="true"
							type="xs:string" />
			</xs:sequence>
		         </xs:complexType>
		</xs:element>
	         </xs:schema>
	</wsdl:types>
	<wsdl:message name="requestRequest">
		<wsdl:part name="parameters" element="ns:request" />
	</wsdl:message>
	<wsdl:message name="requestResponse">
		<wsdl:part name="parameters" element="ns:requestResponse" />
	</wsdl:message>
	<wsdl:portType name="ServiceRequestPortType">
		<wsdl:operation name="request">
			<wsdl:input message="ns:requestRequest" wsaw:Action="urn:request" />
			<wsdl:output message="ns:requestResponse"
wsaw:Action="urn:requestResponse" />
		</wsdl:operation>
	</wsdl:portType>
	<wsdl:binding name="ServiceRequestSoap11Binding"
type="ns:ServiceRequestPortType">
		<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
			style="document" />
		<wsdl:operation name="request">
			<soap:operation soapAction="urn:request" style="document" />
			<wsdl:input>
				<soap:body use="literal" />
			</wsdl:input>
			<wsdl:output>
				<soap:body use="literal" />
			</wsdl:output>
		</wsdl:operation>
	</wsdl:binding>
	<wsdl:binding name="ServiceRequestSoap12Binding"
type="ns:ServiceRequestPortType">
		<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"
			style="document" />
		<wsdl:operation name="request">
			<soap12:operation soapAction="urn:request" style="document" />
			<wsdl:input>
				<soap12:body use="literal" />
			</wsdl:input>
			<wsdl:output>
				<soap12:body use="literal" />
			</wsdl:output>
		</wsdl:operation>
	</wsdl:binding>
	<wsdl:binding name="ServiceRequestHttpBinding"
type="ns:ServiceRequestPortType">
		<http:binding verb="POST" />
		<wsdl:operation name="request">
			<http:operation location="ServiceRequest/request" />
			<wsdl:input>
				<mime:content type="text/xml" part="request" />
			</wsdl:input>
			<wsdl:output>
				<mime:content type="text/xml" part="request" />
			</wsdl:output>
		</wsdl:operation>
	</wsdl:binding>
	<wsdl:service name="ServiceRequest">
		<wsdl:port name="ServiceRequestHttpSoap11Endpoint"
binding="ns:ServiceRequestSoap11Binding">
		<soap:address
location="http://localhost:9090/axis2/services/ServiceRequest.ServiceRequestHttpSoap11Endpoint/"
/>
		</wsdl:port>
		<wsdl:port name="ServiceRequestHttpSoap12Endpoint"
binding="ns:ServiceRequestSoap12Binding">
		          <soap12:address
location="http://localhost:9090/axis2/services/ServiceRequest.ServiceRequestHttpSoap12Endpoint/"
/>
		</wsdl:port>
		<wsdl:port name="ServiceRequestHttpEndpoint"
binding="ns:ServiceRequestHttpBinding">
			<http:address		
location="http://localhost:9090/axis2/services/ServiceRequest.ServiceRequestHttpEndpoint/"
/>
		</wsdl:port>
	</wsdl:service>
</wsdl:definitions>

*Exception:*
14:44:58.284 [main] DEBUG o.a.camel.util.IntrospectionSupport - Clearing
cache[size=0, hits=26, misses=32, evicted=0]
14:44:58.300 [main] INFO  o.a.camel.impl.DefaultCamelContext - Apache Camel
2.11.1 (CamelContext: camel-1) uptime 2.248 seconds
14:44:58.300 [main] INFO  o.a.camel.impl.DefaultCamelContext - Apache Camel
2.11.1 (CamelContext: camel-1) is shutdown in 0.078 seconds
org.apache.camel.FailedToCreateProducerException: Failed to create Producer
for endpoint: Endpoint[http://localhost:9090/axis2/services/ServiceRequest].
Reason: org.apache.cxf.service.factory.ServiceConstructionException: Could
not find definition for service {http://service.polaris.com/}ServiceRequest.
	at
org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:395)
	at
org.apache.camel.impl.ProducerCache.acquireProducer(ProducerCache.java:114)
	at
org.apache.camel.impl.ProducerCache.startProducer(ProducerCache.java:145)
	at org.apache.camel.processor.SendProcessor.doStart(SendProcessor.java:175)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:64)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:54)
	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:75)
	at
org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:78)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:64)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:54)
	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:75)
	at
org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:78)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:64)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:54)
	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:75)
	at
org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:78)
	at
org.apache.camel.processor.interceptor.TraceInterceptor.doStart(TraceInterceptor.java:358)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:64)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:54)
	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:75)
	at
org.apache.camel.processor.RedeliveryErrorHandler.doStart(RedeliveryErrorHandler.java:1122)
	at
org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:41)
	at
org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:28)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:64)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:54)
	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:75)
	at
org.apache.camel.processor.interceptor.DefaultChannel.doStart(DefaultChannel.java:153)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:64)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:54)
	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:87)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:56)
	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:75)
	at
org.apache.camel.processor.MulticastProcessor.doStart(MulticastProcessor.java:938)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:64)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:54)
	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:75)
	at
org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:78)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:64)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:54)
	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:75)
	at
org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:78)
	at
org.apache.camel.processor.UnitOfWorkProcessor.doStart(UnitOfWorkProcessor.java:88)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:64)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:54)
	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:75)
	at
org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:78)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:64)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:54)
	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:75)
	at
org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:78)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:64)
	at
org.apache.camel.impl.RouteService.startChildService(RouteService.java:322)
	at org.apache.camel.impl.RouteService.warmUp(RouteService.java:151)
	at
org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:2040)
	at
org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1970)
	at
org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1758)
	at
org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1633)
	at
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1500)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
	at
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1468)
	at
com.polaris.mh.camel.poc.scenario_1.CamelScenario_1.main(CamelScenario_1.java:61)
Caused by: org.apache.cxf.service.factory.ServiceConstructionException:
Could not find definition for service
{http://service.polaris.com/}ServiceRequest.
	at
org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:126)
	at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:415)
	at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:528)
	at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:278)
	at
org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:99)
	at
org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:51)
	at
org.apache.camel.component.cxf.CxfEndpoint.createClient(CxfEndpoint.java:549)
	at org.apache.camel.component.cxf.CxfProducer.doStart(CxfProducer.java:76)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:64)
	at
org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:393)
	... 70 more

Kindly help me to correct uri of webservice calling.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-to-Soap-webservice-call-tp5743162.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message