1

i want to create a camel route to a Soap Endpoint. I use Eclipse. First step is to insert this code to 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>

Then I create a new Route:

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);

I tested also this:

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"
        );

But nothing helps in both cases I get the error:

Class Not Found

What I must do, to get it to run?

lexicore
  • 42,748
  • 17
  • 132
  • 221
Burner
  • 981
  • 19
  • 41
  • Did you run mvn generate-sources from the command line in the project directory and see if it creates the classes needed? I would start there to make sure it is working – Namphibian Jun 29 '18 at 02:43
  • Yes, the files already exists! – Burner Jun 29 '18 at 11:53
  • So you can see the generated folder located at ${project.build.directory}/generated/cxf. In there you see the generated closes? Can you find com.examples.wsdl.helloservice.HelloPortType in there? – Namphibian Jul 02 '18 at 00:53
  • Yes! Must I set the Classpath? To find the classes? – Burner Jul 02 '18 at 06:58
  • YES! I do ...... – Burner Jul 02 '18 at 13:31
  • Then it some other class that is missing. Could you try one of the sample projects and compare? The camel in action first edition has and example here https://github.com/camelinaction/camelinaction/tree/master/chapter7/cxf it appears that your code generation is working and something else is amiss. Without access to the entire project I can only guess. – Namphibian Jul 04 '18 at 03:15
  • The question is: Must I do more than the steps above? Must I set a classpath in Eclispe or something else? – Burner Jul 04 '18 at 08:39

0 Answers0