Search code examples
javawsdlcxfwsdl2javawsimport

What is the easiest way to generate code from wsdl (cxf)?


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.


Solution

  • 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.