2

I need to consume a webservice with webservice-security. This webservice was created using cxf (not by me).

I tried so far:

wsimport with locally downloaded wsdl (http://theopentutorials.com/examples/java-ee/jax-ws/create-and-consume-web-service-using-jax-ws/). This failed with a couple of errors. I tried it without -extension saying "no usable port, try using -extension". I tried it with -extension saying "no standard SOAP". So I thought this may be because they used CXF.

web service client using cxf in eclipse (http://help.eclipse.org/luna/topic/org.eclipse.jst.ws.cxf.doc.user/tasks/create_client.html). When I select in step 3d "Apache CXF 2" the OK-button gets grayed out. Could be an unresolved error (https://bugs.eclipse.org/bugs/show_bug.cgi?id=351799) if I understand it right.

wsdl2java (https://axis.apache.org/axis2/java/core/tools/eclipse/wsdl2java-plugin.html#Installation). I followed the instructions getting an exception when clicking finish "An error occurred while completing process - java.lang.InterruptedException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException".

edit: I ran wsdl2java now in command prompt getting the following error:

wsdl2java -d C:\xkfz -client -verbose C:\xkfz.wsdl Loading FrontEnd jaxws ... Loading DataBinding jaxb ... wsdl2java -d C:\xkfz -client -verbose C:\xkfz.wsdl wsdl2java - Apache CXF 3.0.1

Aug 26, 2014 4:07:23 PM org.apache.cxf.wsdl11.WSDLServiceBuilder checkForWrapped INFORMATION: Operation {http://www.xoev.de/schemata/xkfz/1_1}verarbeiteXKfz cannot be unwrapped, input message must reference global element declaration with same localname as operation

Is there any way to generate my desired classes? This shouldn't be that complicated :-/

I use Win7/64 with latest Eclipse EE and JDK.

UNeverNo
  • 549
  • 3
  • 8
  • 29
  • Can you post the WSDL url? As for the Eclipse bug, maybe it is related to this: http://stackoverflow.com/questions/25391606/how-to-consume-a-webservice-using-cxf-in-eclipse/25401688#25401688. – asohun Aug 26 '14 at 10:13

3 Answers3

4

CXF includes a Maven plugin which can generate java artifacts from WSDL. It's enough add it with some specified config values like this:

<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>${basedir}/src/main/resources/myService.wsdl</wsdl>
                    </wsdlOption>
                </wsdlOptions>
            </configuration>
            <goals>
                <goal>wsdl2java</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Refer to this address for more info. Hope this helps.

Farzad Fallah
  • 591
  • 4
  • 9
1

Try using an eclipse plugin for generating your classes

http://sourceforge.net/projects/wsdl2javawizard/

Ayrad
  • 3,996
  • 8
  • 45
  • 86
  • Sorry, forgot to mention this. Already tried it. But I get no "Import WebService reference" after unpacking those zips into my eclipse-plugins-folder. – UNeverNo Aug 26 '14 at 09:55
0

I found out that I can ignore the error from wsdl2java, because it generated a class anyways. I only expected another Class-name according to the examples I got from the ws-creator.

UNeverNo
  • 549
  • 3
  • 8
  • 29