Java – Axis 2 java2wsdl creates different wsdl than JBoss shows in the ?wsdl URL


I'm refactoring the way the client code for a bottom-up web service is built. The existing build creates the Java client code by using a deployment of the web service on JBoss 4.2 and executing the Axis 2 AntCodegenTask against http://devserver.url?wsdl. This method fails if the development server is down or has outdated wsdl. (Crusie Control fails whenever the wsdl changes.)

I need to build the client code against the web service class itself instead of having to point to a deployment of the web service. I use java2wsdl to generate wsdl from the web service class and then use the same AntCodegenTask to generate the client classes.

The problem is that wsdl created by java2wsdl is different than what JBoss displays in http://devserver.url?wsdl. Among other things, some of the namespaces are different and the AntCodegenTask step doesn't convert these namespaces into the correct package structure.

I've got to get the final package structure to be what the client code expects. The existing AntCodegenTask uses namespacetopackages="…" to accomplish that, but when I execute the same AntCodegenTask to the wsdl generated by java2wsdl it doesn't convert the namespaces to the package name.

Why would Axis show different wsdl when the web service is deployed in JBoss than it generates from java2wsdl?

Is there a way to use Axis to create the client code from the web service class without generating the intermediate wsdl?

The documentation for the java2wsdl and wsdl2java Ant tasks is a little bit spotty. Axis 2 v 1.4.1 gives Ant tasks for AntCodegenTask and 2 Java2WSDLTasks in different packages. The Axis 2 installation includes binaries for wsdl2java and java2wsdl, but no codegen binary. Maybe AntCodegenTask is the same as wsdl2java.

Has anyone got something like this to work with Axis 2?

Best Solution

Deploy webservice on JBoss server. Save locally WSDL file and pass it as a parameter to Ant task. Hopefully generated classes would be correct, however it may happen that Axis 2 would not like to work with JBoss generated WSDL.

In that case use wsconsume.bat provided with JBoss instead of AXIS ant task.

Always use that once generated WSDL file, package it with application, etc, since even different versions of JBoss produce different WSDL files.

Axis always sort of sucked, if you can (I now it is not so obvious...) use Apache CXF or native JBoss implementation.

Related Question