Camel、Maven、Spring 的新手...尝试测试最简单的原型以调用外部 Web 服务。请让我知道这对于本论坛来说是否过于基本,并且有一个更合适的问题。异常和代码如下:
异常:原因:org.apache.camel.NoSuchBeanException:在注册表中找不到 bean:cc 类型:org.apache.camel.component.cxf.CxfEndpoint
<cxf:cxfEndpoint id="cc"
address="http://www.webservicex.net/CurrencyConvertor.asmx"
wsdlURL="http://www.webservicex.net/CurrencyConvertor.asmx?WSDL"
endpointName="CurrencyConvertorHttpGet"
serviceName="CurrencyConvertor"/>
<camelContext xmlns="http://camel.apache.org/schema/spring">
<package>com.cgi.siromsint</package>
</camelContext>
POM 依赖项:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>${camel-version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
<version>${camel-version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cxf</artifactId>
<version>${camel-version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-http</artifactId>
<version>${camel-version}</version>
</dependency>
public class WSRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Exception {
from("file:src/data/amanda.csv").marshal().string()
.to("cxf:bean:cc");
}
}