I have a question regarding generating Java artifacts with wsimport tool (by Maven Jax-WS )
When I generate the Java artifacts from WSDL, I would like to pack the web service project as a WAR file, and its client as a JAR file.
Where to put the generated artifacts and where to put the WSDL? What is the best practice regarding organizing web service projects?
Thank you in advance!
Best regards, Jurica Krizanic
The wsimport command-line tool processes an existing Web Services Description Language (WSDL) file and generates the required artifacts for developing Java™ API for XML-Based Web Services (JAX-WS) web service applications.
The artifacts will be required on both client and server side so pack them in a third jar and set it as a dependency for both. The WSDLs should go to the WEB-INF folder of the war and the wsdlLocation
attribute of @WebService
and @WebServiceClient
should be set to reflect the path to it.
Packaging options for managed services are defined in JSR 109: Web Services for Java EE, Version 1.3.
For services:
5.4.2 EJB Module Packaging
...the Web services deployment descriptor location within the EJB-JAR file is
META-INF/webservices.xml
. The wsdl directory is located atMETA-INF/wsdl
.5.4.3 Web App Module Packaging
...a Web services deployment descriptor is located in a WAR at
WEB-INF/webservices.xml
and the wsdl directory is located atWEB-INF/wsdl
.
For clients:
A client can be any of the following: Java EE application client, web component, EJB component, or another Web service.
The location of the Web services client deployment descriptor in the module is module specific. WSDL files are located relative to the root of the module and are typically located in the
wsdl
directory that is co-located with the module deployment descriptor or a subdirectory of it.
Note that this spec restricts itself to Java EE clients; it doesn't mean that you can't have an unmanaged client where you provide the WSDL explicitly.
Cross-reference these specifications for more detail:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With