Sunday, 25 July 2010

jax-ws maven plugin and wsdlLocation problem

I am using wsimport of jax-ws maven plugin in order to build my webservices, but I have run into a minor problem with the plugin.

The plugin has two ways of configuring how to find the wsdl files, either using the tag to point out the files or to point out the target namespaces using a catalog file to map to wsdl files. The approach chosen has an influence on what is generated as the "wsdlLocation" in the service class' webservice annotation.

If I use the and tags the calculated full path ends up in the annotation. This doesn't work for me because at runtime this full path is used to find the wsdl and it doesn't exist at that location on that machine. The jax-ws-catalog file is no help here as it normally contains the target namespace as key. 

I could put a full path in the catalog file, but I would need to keep maintaining that  depending on where the build server is building the project which is not very good.

If I on the other hand use the the target namespace goes into the annotation. This works at runtime because the jax-ws catalog matches the namespace to a relative path inside the jar file.

The problem with using is that the maven plugin is not smart enough to know if it should regenerate the classes because of the extra layer of redirection. The result is the classes are allways regenerated. 

I have created a issue on the topic: classes always regenerated when using wsdlUrls (#58)

I have not tested just placing the wsdl files in the default directory and letting the plugin auto discover them. I have avoided this because the default directory does not really follow maven standards.

No comments:

Post a comment