You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by kmoens <kr...@yahoo.com> on 2011/07/07 16:01:39 UTC
Using cxf:bean to invoke external webservice
Hi,
I am playing around to invoke an external webservice from Camel 2.6.
With Java DSL this works fine, but I struggle with the Spring DSL using
cxf:bean
/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}AmlService. /
This is my config:
<cxf:cxfEndpoint id="amlEndpoint"
address="http://localhost:8080/aml/AmlService"
wsdlURL="src/main/resources/wsdl/AmlService.wsdl"
serviceClass="com.mycomp.aml.Aml"
serviceName="s:AmlService"
endpointName="s:AmlServicePort"
xmlns:s="http://aml.mycomp.com"/>
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="direct:begin"/>
<to uri="cxf:bean:amlEndpoint" />
<log message=">>>>> ${body}"/>
</route>
</camelContext>
Maybe I'm missing something with this cxf:bean approach ?
Thanks for any hints on this
Kris
--
View this message in context: http://camel.465427.n5.nabble.com/Using-cxf-bean-to-invoke-external-webservice-tp4561146p4561146.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Using cxf:bean to invoke external webservice
Posted by kmoens <kr...@yahoo.com>.
Hi Ashwin,
yes, this wsdl folder containing the AmlService.wsdl is available under
src/main/resources.
If I remove "src/main/resources" I get a FileNotFoundException.
I am not using maven.
I use eclipse, defined a java project and put the camel and cxf jars in the
referenced libraries.
I just run my junit4 test from eclipse.
As I mentioned in my original postbefore, a similar test with JavaDSL works
fine.
Thanks for the reply.
--
View this message in context: http://camel.465427.n5.nabble.com/Using-cxf-bean-to-invoke-external-webservice-tp4561146p4563755.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Using cxf:bean to invoke external webservice
Posted by Ashwin Karpe <ak...@fusesource.com>.
Hi,
Can you please remove "src/main/resources/" from the wsdlURL and change it
to "wsdl/AmlService.wsdl". See example below...
BTW, I am assuming you have a wsdl directory under src/main/resources. The
directory src/main/resources is already on your classloader classpath if
this is a maven deployed artifact.
Hope this helps.
Cheers,
Ashwin...
=============================================
<cxf:cxfEndpoint id="amlEndpoint"
address="http://localhost:8080/aml/AmlService"
wsdlURL="wsdl/AmlService.wsdl"
serviceClass="com.mycomp.aml.Aml"
serviceName="s:AmlService"
endpointName="s:AmlServicePort"
xmlns:s="http://aml.mycomp.com"/>
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="direct:begin"/>
<to uri="cxf:bean:amlEndpoint" />
<log message=">>>>> ${body}"/>
</route>
-----
---------------------------------------------------------
Ashwin Karpe
Apache Camel Committer & Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary)
http://fusesource.com
Blog: http://opensourceknowledge.blogspot.com
---------------------------------------------------------
--
View this message in context: http://camel.465427.n5.nabble.com/Using-cxf-bean-to-invoke-external-webservice-tp4561146p4561548.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Using cxf:bean to invoke external webservice
Posted by kmoens <kr...@yahoo.com>.
In meantime I progressed a bit.
Because my WSDL contains a single service/port, I can leave out the
following in the cxfEndpoint configuration:
serviceName="s:AmlService"
endpointName="s:AmlServicePort"
xmlns:s="http://aml.mycomp.com"
so it ends up like
<cxf:cxfEndpoint id="amlEndpoint"
address="http://localhost:8080/aml/AmlService"
wsdlURL="src/main/resources/wsdl/AmlService.wsdl"
serviceClass="com.mycomp.aml.Aml"/>
Now, I can run my test as expected :)
In case my WSDL will have multiple operations, it might fail again.
I will handle this later on, I can progress now on my prototype.
Thanks for the valuable hints guys
BRs,
Kris
--
View this message in context: http://camel.465427.n5.nabble.com/Using-cxf-bean-to-invoke-external-webservice-tp4561146p4589743.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Using cxf:bean to invoke external webservice
Posted by kmoens <kr...@yahoo.com>.
Hi Willem,
I did send you a private email.
Thanks for the help
BRs,
Kris
--
View this message in context: http://camel.465427.n5.nabble.com/Using-cxf-bean-to-invoke-external-webservice-tp4561146p4586369.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Using cxf:bean to invoke external webservice
Posted by Willem Jiang <wi...@gmail.com>.
Can you send a small test case to me?
I can not tell if there is something wrong from the files that you
showed to me.
On 7/8/11 7:53 PM, kmoens wrote:
> 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.
>
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang
Re: Using cxf:bean to invoke external webservice
Posted by kmoens <kr...@yahoo.com>.
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.
Re: Using cxf:bean to invoke external webservice
Posted by kmoens <kr...@yahoo.com>.
The WSDL is generated from the following piece of code, so the
name="AmlService" is there for free
@WebService(portName = "AmlServicePort")
public class Aml {
@WebMethod
public boolean isValidPayment(@WebParam(name = "currency") String
currency, @WebParam(name = "amount") BigDecimal amount)
throws AmlException {
...
}
I guess if I change it to:
@WebService(serviceName = "FooService", portName = "AmlServicePort")
this wont make a difference in the end, no?
--
View this message in context: http://camel.465427.n5.nabble.com/Using-cxf-bean-to-invoke-external-webservice-tp4561146p4564026.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Using cxf:bean to invoke external webservice
Posted by Willem Jiang <wi...@gmail.com>.
On 7/8/11 3:40 PM, kmoens wrote:
> Hi Willem,
>
> I did. Here it is:
>
> <?xml version='1.0' encoding='UTF-8'?>
> <definitions
> xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
> xmlns:wsp="http://www.w3.org/ns/ws-policy"
> xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy"
> xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:tns="http://aml.mycomp.com/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns="http://schemas.xmlsoap.org/wsdl/"
> targetNamespace="http://aml.mycomp.com/" name="AmlService">
Can you change the definitions@name not to be "AmlService" ?
> <types>
> <xsd:schema>
> <xsd:import namespace="http://aml.mycomp.com/"
> schemaLocation="http://localhost:8080/aml/AmlService?xsd=1" />
> </xsd:schema>
> </types>
> <message name="isValidPayment">
> <part name="parameters" element="tns:isValidPayment" />
> </message>
> <message name="isValidPaymentResponse">
> <part name="parameters" element="tns:isValidPaymentResponse" />
> </message>
> <message name="AmlException">
> <part name="fault" element="tns:AmlFault" />
> </message>
> <portType name="Aml">
> <operation name="isValidPayment">
> <input wsam:Action="http://aml.mycomp.com/Aml/isValidPaymentRequest"
> message="tns:isValidPayment" />
> <output wsam:Action="http://aml.mycomp.com/Aml/isValidPaymentResponse"
> message="tns:isValidPaymentResponse" />
> <fault message="tns:AmlException" name="AmlException"
> wsam:Action="http://aml.mycomp.com/Aml/isValidPayment/Fault/AmlException" />
> </operation>
> </portType>
> <binding name="AmlServicePortBinding" type="tns:Aml">
> <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
> style="document" />
> <operation name="isValidPayment">
> <soap:operation soapAction="" />
> <input>
> <soap:body use="literal" />
> </input>
> <output>
> <soap:body use="literal" />
> </output>
> <fault name="AmlException">
> <soap:fault name="AmlException" use="literal" />
> </fault>
> </operation>
> </binding>
> *<service name="AmlService">*
> <port name="AmlServicePort" binding="tns:AmlServicePortBinding">
> <soap:address location="http://localhost:8080/aml/AmlService" />
> </port>
> </service>
> </definitions>
>
> I'm pretty new into Camel, so I'm not sure what exactly you want me to
> provide as "URI of CXF endpoint".
>
> This is my junit4 test I run from eclipse (no maven involved):
>
> public class AmlTest extends CamelSpringTestSupport {
>
> @Override
> protected AbstractXmlApplicationContext createApplicationContext() {
> return new ClassPathXmlApplicationContext("camel-context.xml");
> }
>
> @Test
> public void testOrderOk() throws Exception {
> List params = new ArrayList();
> params.add("usd");
> params.add(100.15);
> String reply = template.requestBody("cxf:bean:amlEndpoint", params,
> String.class);
> assertEquals(true, reply);
> }
> }
>
> Thanks again
>
> Kris
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Using-cxf-bean-to-invoke-external-webservice-tp4561146p4563777.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang
Re: Using cxf:bean to invoke external webservice
Posted by kmoens <kr...@yahoo.com>.
Hi Willem,
I did. Here it is:
<?xml version='1.0' encoding='UTF-8'?>
<definitions
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:wsp="http://www.w3.org/ns/ws-policy"
xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://aml.mycomp.com/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="http://aml.mycomp.com/" name="AmlService">
<types>
<xsd:schema>
<xsd:import namespace="http://aml.mycomp.com/"
schemaLocation="http://localhost:8080/aml/AmlService?xsd=1" />
</xsd:schema>
</types>
<message name="isValidPayment">
<part name="parameters" element="tns:isValidPayment" />
</message>
<message name="isValidPaymentResponse">
<part name="parameters" element="tns:isValidPaymentResponse" />
</message>
<message name="AmlException">
<part name="fault" element="tns:AmlFault" />
</message>
<portType name="Aml">
<operation name="isValidPayment">
<input wsam:Action="http://aml.mycomp.com/Aml/isValidPaymentRequest"
message="tns:isValidPayment" />
<output wsam:Action="http://aml.mycomp.com/Aml/isValidPaymentResponse"
message="tns:isValidPaymentResponse" />
<fault message="tns:AmlException" name="AmlException"
wsam:Action="http://aml.mycomp.com/Aml/isValidPayment/Fault/AmlException" />
</operation>
</portType>
<binding name="AmlServicePortBinding" type="tns:Aml">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
<operation name="isValidPayment">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
<fault name="AmlException">
<soap:fault name="AmlException" use="literal" />
</fault>
</operation>
</binding>
*<service name="AmlService">*
<port name="AmlServicePort" binding="tns:AmlServicePortBinding">
<soap:address location="http://localhost:8080/aml/AmlService" />
</port>
</service>
</definitions>
I'm pretty new into Camel, so I'm not sure what exactly you want me to
provide as "URI of CXF endpoint".
This is my junit4 test I run from eclipse (no maven involved):
public class AmlTest extends CamelSpringTestSupport {
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("camel-context.xml");
}
@Test
public void testOrderOk() throws Exception {
List params = new ArrayList();
params.add("usd");
params.add(100.15);
String reply = template.requestBody("cxf:bean:amlEndpoint", params,
String.class);
assertEquals(true, reply);
}
}
Thanks again
Kris
--
View this message in context: http://camel.465427.n5.nabble.com/Using-cxf-bean-to-invoke-external-webservice-tp4561146p4563777.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Using cxf:bean to invoke external webservice
Posted by Willem Jiang <wi...@gmail.com>.
http://localhost:8080/aml/AmlService?wsdl is the WSDL which is generated
from your service.
You still need to open the WSDL file to find out the service name and
the port name.
BTW, can I have a look of URI of you CXF endpoint?
Maybe it shows something we are just missing.
On 7/7/11 10:56 PM, kmoens wrote:
> Hi Willem,
>
> yes, I double checked.
> Got this also from the generated code:
>
> package com.mycomp.aml;
>
> import...
>
> @WebServiceClient(name = "AmlService",
> wsdlLocation =
> "http://localhost:8080/aml/AmlService?wsdl",
> targetNamespace = "http://aml.mycomp.com/")
> public class AmlService extends Service {
>
> public final static URL WSDL_LOCATION;
> public final static QName SERVICE = new QName("http://aml.mycomp.com/",
> "AmlService");
> public final static QName AmlServicePort = new
> QName("http://aml.mycomp.com/", "AmlServicePort");
> ...
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Using-cxf-bean-to-invoke-external-webservice-tp4561146p4561318.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang
Re: Using cxf:bean to invoke external webservice
Posted by kmoens <kr...@yahoo.com>.
Hi Willem,
yes, I double checked.
Got this also from the generated code:
package com.mycomp.aml;
import...
@WebServiceClient(name = "AmlService",
wsdlLocation =
"http://localhost:8080/aml/AmlService?wsdl",
targetNamespace = "http://aml.mycomp.com/")
public class AmlService extends Service {
public final static URL WSDL_LOCATION;
public final static QName SERVICE = new QName("http://aml.mycomp.com/",
"AmlService");
public final static QName AmlServicePort = new
QName("http://aml.mycomp.com/", "AmlServicePort");
...
--
View this message in context: http://camel.465427.n5.nabble.com/Using-cxf-bean-to-invoke-external-webservice-tp4561146p4561318.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Using cxf:bean to invoke external webservice
Posted by Willem Jiang <wi...@gmail.com>.
Hi,
Can you double check your WSDL definition to make sure the service name
is right?
On 7/7/11 10:01 PM, kmoens wrote:
> Hi,
>
> I am playing around to invoke an external webservice from Camel 2.6.
>
> With Java DSL this works fine, but I struggle with the Spring DSL using
> cxf:bean
>
> /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}AmlService. /
>
> This is my config:
>
> <cxf:cxfEndpoint id="amlEndpoint"
> address="http://localhost:8080/aml/AmlService"
> wsdlURL="src/main/resources/wsdl/AmlService.wsdl"
> serviceClass="com.mycomp.aml.Aml"
> serviceName="s:AmlService"
> endpointName="s:AmlServicePort"
> xmlns:s="http://aml.mycomp.com"/>
>
> <camelContext xmlns="http://camel.apache.org/schema/spring">
> <route>
> <from uri="direct:begin"/>
>
> <to uri="cxf:bean:amlEndpoint" />
> <log message=">>>>> ${body}"/>
> </route>
> </camelContext>
>
> Maybe I'm missing something with this cxf:bean approach ?
>
> Thanks for any hints on this
>
> Kris
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Using-cxf-bean-to-invoke-external-webservice-tp4561146p4561146.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang