我需要调用WildFly 8上可用的JAX-WS Web服务。我已经开始使用一个简单的示例来开始。这是我的Web服务:
import javax.jws.WebService;
@WebService
public class HelloWorld implements Hello{
@Override
public String greet(String s) {
return "Hello "+s;
}
}
WSDL位于:http://localhost:8080/DemoWS/HelloWorld?wsdl
看一下Tomcat-CXF示例,我编写了以下路由:
public class CamelRoute extends RouteBuilder {
private String uri = "cxf:http://localhost:8080/helloWorld?serviceClass=com.sample.HelloWorld";
@Override
public void configure() throws Exception {
from(uri)
.to("log:input")
.recipientList(simple("direct:${header.operationName}"));
from("direct:greet")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
String id = exchange.getIn().getBody(String.class);
exchange.getOut().setBody(id);
}
})
.to("log:output");
}
}
通过在Camel Context中运行上述代码,将返回以下错误:
Exception in thread "main" org.apache.camel.FailedToCreateRouteException: Failed to create route route1: Route[[From[cxf:http://localhost:8080/helloWorld?serviceClas... because of Failed to resolve endpoint: cxf://http://localhost:8080/helloWorld?serviceClass=com.sample.HelloWorld due to: No component found with scheme: cxf
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:177)
at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:731)
at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1803)
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1589)
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1453)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1421)
at com.sample.Main.main(Main.java:15)
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: cxf://http://localhost:8080/helloWorld?
serviceClass = com.sample.HelloWorld由于:找不到使用scheme的组件:cxf
似乎我甚至无法调用它。有帮助吗? Thannks
答案 0 :(得分:0)
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cxf</artifactId>
</dependency>