Three months ago, when I was working on webservices: SOAP and spring-ws, I encountered an issue.
The WSDLs were from a third party and the plugin I used was org.jvnet.jax-ws-commons:jaxws-maven-plugin.
The plugin was used with the goal wsimport which generates JAX-WS portable artifacts used in JAX-WS
clients and services. The tool reads a WSDL and generates all the required artifacts for web service
development, deployment, and invocation.
Initially, I used a common namespace for all the WSDL, until I noticed that it was a culprit.
The following is a snippet of the plugin usage, I used initially:
So, after using the above plugin in a common namespace ie. com.geekz.anon.model, I encountered the following error.
org.springframework.oxm.UncategorizedMappingException: Unknown JAXB exception; nested exception is javax.xml.bind.JAXBException: class com.geekz.anon.model.SomeClass nor any of its super class is known to this context.
I discovered that the issue was sharing a common namespace, where the last WSDL ie. Service3 was rewriting on the already generated files by Service2 and Service1.
So, the best bet was to have multiple specifications of a set of goals to execute during the build lifecycle, each having a different configuration.
So, refactored it to the following, placing them into different namespaces.
Now, all the classes were generated in their respective packages. However, there was an issue with the spring framework mapping. All I had to do was explicitly define the context path which earlier was just at the com.geekz.anon.model level, which perphaps is different now for each of the service.
I fixed it as below. ( Please follow the same for each of the services.)
This fixed all the errors and I was able to make all the webservice calls successfully!