我正在尝试访问第三方webservice wsdl – http://www.webservicex.net/CurrencyConvertor.asmx?WSDL
此服务具有计算货币汇率的 *** 作/方法. *** 作名称为“ConversionRate”.
我定义了这样的路线 –
<?xml version="1.0" enCoding="UTF-8"?><!-- Configures the Camel Context--><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://camel.apache.org/schema/spring" xmlns:cxf="http://camel.apache.org/schema/cxf" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> <camelContext xmlns="http://camel.apache.org/schema/spring"> <route> <description>here is a sample which processes the input files (leaving them in place - see the 'noop' flag) then performs content based routing on the message using XPath</description> <from uri="file:src/data/order?noop=true"/> <log message="${body}"/> <to uri="cxf://http://www.webservicex.net/CurrencyConvertor.asmx?wsdlURL=http://www.webservicex.net/CurrencyConvertor.asmx?wsdl&servicename=CurrencyConvertor&portname=http://www.webserviceX.NET/tns:CurrencyConvertorSoap&dataFormat=MESSAGE"/> <log message="${body}"/> </route></camelContext></beans>
我已将样本有效负载xml定义为 –
<order> <ID>1</ID> <Price>10.00</Price> <Quantity>2</Quantity></order>
运行此示例时,我收到此错误.
Error occurred while running main from: org.apache.camel.spring.Mainjava.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.camel.maven.RunMojo.run(RunMojo.java:440) at java.lang.Thread.run(Thread.java:744)Caused by: org.apache.camel.FailedToCreateProducerException: Failed to create Producer for endpoint: Endpoint[cxf://http://www.webservicex.net/CurrencyConvertor.asmx?dataFormat=MESSAGE&portname=http%3A%2F%2Fwww.webserviceX.NET%2Ftns%3ACurrencyConvertorSoap&servicename=CurrencyConvertor&wsdlURL=http%3A%2F%2Fwww.webservicex.net%2FCurrencyConvertor.asmx%3Fwsdl]. Reason: org.apache.cxf.service.factory.ServiceConstructionException: Could not find deFinition for service CurrencyConvertor. 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:60) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:62) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:52) at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:73) at org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:78) at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:62) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:52) at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:73) 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:60) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:62) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:52) at org.apache.camel.processor.WrapProcessor.doStart(WrapProcessor.java:52) at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:62) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:52) at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:73) at org.apache.camel.processor.RedeliveryErrorHandler.doStart(RedeliveryErrorHandler.java:1064) 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:62) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:52) at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:73) at org.apache.camel.processor.interceptor.DefaultChannel.doStart(DefaultChannel.java:153) at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:62) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:52) at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:85) at org.apache.camel.processor.MulticastProcessor.doStart(MulticastProcessor.java:938) at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:62) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:52) at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:73) at org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:78) at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:62) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:52) at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:73) 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:60) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:62) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:52) at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:73) at org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:78) at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:62) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:52) at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:73) at org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:78) at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:62) 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:2000) at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1928) at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1716) at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1597) at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1453) at org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:179) at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60) at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1421) at org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:228) at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:118) at org.apache.camel.spring.CamelContextfactorybean.onApplicationEvent(CamelContextfactorybean.java:283) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:327) at org.springframework.context.support.AbstractApplicationContext.finishrefresh(AbstractApplicationContext.java:941) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:475) at org.springframework.context.support.ClasspathXmlApplicationContext.<init>(ClasspathXmlApplicationContext.java:139) at org.springframework.context.support.ClasspathXmlApplicationContext.<init>(ClasspathXmlApplicationContext.java:93) at org.apache.camel.spring.Main.createDefaultApplicationContext(Main.java:186) at org.apache.camel.spring.Main.doStart(Main.java:140) at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60) at org.apache.camel.main.MainSupport.run(MainSupport.java:141) at org.apache.camel.main.MainSupport.run(MainSupport.java:332) at org.apache.camel.spring.Main.main(Main.java:73) ... 6 moreCaused by: org.apache.cxf.service.factory.ServiceConstructionException: Could not find deFinition for service CurrencyConvertor. at org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:139) at org.apache.cxf.service.factory.ReflectionServicefactorybean.buildServiceFromWSDL(ReflectionServicefactorybean.java:412) at org.apache.cxf.service.factory.ReflectionServicefactorybean.initializeServiceModel(ReflectionServicefactorybean.java:534) at org.apache.cxf.service.factory.ReflectionServicefactorybean.create(ReflectionServicefactorybean.java:248) at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101) at org.apache.cxf.frontend.ClIEntfactorybean.create(ClIEntfactorybean.java:90) at org.apache.camel.component.cxf.CxfEndpoint.createClIEnt(CxfEndpoint.java:527) at org.apache.camel.component.cxf.CxfProducer.doStart(CxfProducer.java:76) at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:62) at org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:393) ... 88 more*************************************.解决方法 根据 CXF文档,目标URI似乎不正确.
servicename和portname的格式应为{namespace} name
试试:
> servicename = {http://www.webserviceX.NET/} CurrencyConvertor
> portname = {http://www.webserviceX.NET/} CurrencyConvertorSoap
以上是内存溢出为你收集整理的web-services – 如何使用cxf componnet使用Apache camel调用第三方Web服务全部内容,希望文章能够帮你解决web-services – 如何使用cxf componnet使用Apache camel调用第三方Web服务所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)