best practice for packing the code

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 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 at META-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 at WEB-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:

  • JSR 244 (JAX-WS)
  • JSR 109 (integration with Java EE)
  • JSR 316 (Java EE 6)
  • 链接地址: http://www.djcxy.com/p/63062.html

    上一篇: 以小时,天,月和年显示相对时间

    下一篇: 打包代码的最佳实践