camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmoens <kris_mo...@yahoo.com>
Subject Re: Using cxf:bean to invoke external webservice
Date Fri, 08 Jul 2011 11:53:10 GMT
update:

I used cxf tool java2ws to generate wsdl, where I changed the name to "foo".
I used this wsdl to expose my external web service, which is now running on
http://localhost:8080/aml/FooService?WSDL 

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="foo" targetNamespace="http://aml.mycomp.com/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://aml.mycomp.com/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
  <wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://aml.mycomp.com/" attributeFormDefault="unqualified"
elementFormDefault="unqualified" targetNamespace="http://aml.mycomp.com/">
<xs:element name="isValidPayment" type="tns:isValidPayment"/>
<xs:element name="isValidPaymentResponse"
type="tns:isValidPaymentResponse"/>
<xs:complexType name="isValidPayment">
<xs:sequence>
<xs:element minOccurs="0" name="currency" type="xs:string"/>
<xs:element minOccurs="0" name="amount" type="xs:decimal"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="isValidPaymentResponse">
<xs:sequence>
<xs:element name="return" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
<xs:element name="AmlFault" type="tns:AmlFault"/>
<xs:complexType name="AmlFault">
<xs:sequence/>
</xs:complexType>
</xs:schema>
  </wsdl:types>
  <wsdl:message name="isValidPayment">
    <wsdl:part name="parameters" element="tns:isValidPayment">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="AmlException">
    <wsdl:part name="AmlException" element="tns:AmlFault">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="isValidPaymentResponse">
    <wsdl:part name="parameters" element="tns:isValidPaymentResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="Aml">
    <wsdl:operation name="isValidPayment">
      <wsdl:input name="isValidPayment" message="tns:isValidPayment">
    </wsdl:input>
      <wsdl:output name="isValidPaymentResponse"
message="tns:isValidPaymentResponse">
    </wsdl:output>
      <wsdl:fault name="AmlException" message="tns:AmlException">
    </wsdl:fault>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="FooServiceSoapBinding" type="tns:Aml">
    <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="isValidPayment">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="isValidPayment">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="isValidPaymentResponse">
        <soap:body use="literal"/>
      </wsdl:output>
      <wsdl:fault name="AmlException">
        <soap:fault name="AmlException" use="literal"/>
      </wsdl:fault>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="FooService">
    <wsdl:port name="AmlServicePort" binding="tns:FooServiceSoapBinding">
      <soap:address location="http://localhost:8080/aml/FooService"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions> 

Still, when Camel is launched I get the error:

org.apache.camel.FailedToCreateProducerException: Failed to create Producer
for endpoint: Endpoint[cxf://bean:amlEndpoint]. Reason:
org.apache.cxf.service.factory.ServiceConstructionException: Could not find
definition for service {http://aml.mycomp.com}FooService.
	at
org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:362)
	at
org.apache.camel.impl.ProducerCache.acquireProducer(ProducerCache.java:93)
	at
org.apache.camel.impl.ProducerCache.startProducer(ProducerCache.java:124)
	at org.apache.camel.processor.SendProcessor.doStart(SendProcessor.java:144)
	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)
	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:52)
	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:66)
	at
org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:77)
	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)
	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:52)
	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:66)
	at
org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:77)
	at
org.apache.camel.processor.interceptor.TraceInterceptor.doStart(TraceInterceptor.java:429)
	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)
	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:52)
	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:66)
	at
org.apache.camel.processor.RedeliveryErrorHandler.doStart(RedeliveryErrorHandler.java:847)
	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)
	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:52)
	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:66)
	at
org.apache.camel.processor.DefaultChannel.doStart(DefaultChannel.java:146)
	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)
	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:83)
	at
org.apache.camel.processor.MulticastProcessor.doStart(MulticastProcessor.java:893)
	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)
	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:52)
	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:66)
	at
org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:77)
	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)
	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:52)
	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:66)
	at
org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:77)
	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)
	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:52)
	at
org.apache.camel.impl.RouteService.startChildService(RouteService.java:233)
	at org.apache.camel.impl.RouteService.warmUp(RouteService.java:136)
	at
org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:1803)
	at
org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1729)
	at
org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1528)
	at
org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1420)
	at
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1321)
	at
org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:164)
	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)
	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
	at
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1299)
	at
org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:203)
	at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:101)
	at
org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:237)
	at
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
	at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)
	at
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)
	at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:428)
	at
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
	at
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
	at vap.AmlTest.createApplicationContext(AmlTest.java:15)
	at vap.AmlTest.createApplicationContext(AmlTest.java:1)
	at
org.apache.camel.test.junit4.CamelSpringTestSupport.setUp(CamelSpringTestSupport.java:50)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
	at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
	at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
	at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.apache.cxf.service.factory.ServiceConstructionException:
Could not find definition for service {http://aml.mycomp.com}FooService.
	at
org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:131)
	at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:386)
	at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:503)
	at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:242)
	at
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:202)
	at
org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101)
	at
org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:90)
	at
org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:117)
	at
org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:124)
	at
org.apache.camel.component.cxf.CxfSpringEndpoint.createClient(CxfSpringEndpoint.java:140)
	at org.apache.camel.component.cxf.CxfProducer.<init>(CxfProducer.java:70)
	at
org.apache.camel.component.cxf.CxfEndpoint.createProducer(CxfEndpoint.java:118)
	at
org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:358)
	... 87 more

Any other clues?

Thanks

--
View this message in context: http://camel.465427.n5.nabble.com/Using-cxf-bean-to-invoke-external-webservice-tp4561146p4564482.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message