1

我想创建一个到 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

我必须做什么,让它运行?

4

0 回答 0