我想创建一条通往Soap Endpoint的骆驼路线。我使用Eclipse。 第一步是将此代码插入pom.xml:
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>http://localhost:8088/mockHello_Binding?wsdl</wsdl>
<wsdlLocation>classpath:wsdl/hello.wsdl</wsdlLocation>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
然后我创建一条新路线:
SoapJaxbDataFormat soap = new SoapJaxbDataFormat("com.examples.wsdl.helloservice.HelloPortType", new ServiceInterfaceStrategy(HelloPortType.class, false));
soap.setVersion("1.2");
from("direct:start")
.onException(Exception.class)
.handled(true)
.unmarshal(soap)
.end()
.marshal(soap)
.to("file:C:\\ATemp\\")
.unmarshal(soap);
我也对此进行了测试:
from("file:C:\\ATemp")
.setHeader("Content-Type", simple("text/xml;charset=UTF-8"))
.setHeader("SOAPAction", simple("http://example.com//sayHello"))
.to("cxf://http://localhost:8088/mockHello_Binding"
+"?wsdlURL=http://localhost:8088/mockHello_Binding?wsdl"
+"&serviceName={http://example.com/}Hello_Service"
+"&portName={http://example.com/}Hello_Port"
+"&defaultOperationName=sayHello"
+"&dataFormat=POJO"
+"&serviceClass=com.examples.wsdl.helloservice.HelloPortType"
);
但是在两种情况下都无济于事:
Class Not Found
我必须做什么才能使其运行?