dev@glassfish.java.net

Re: sample web service application

From: Vijay Ramachandran <Vijay.Ramachandran_at_Sun.COM>
Date: Tue, 24 Jan 2006 16:05:09 -0800

> Oh. I have misunderstood the specifications. Sorry about that. What
> JSR (if any) defines the standard packaging for Java EE 5 web services -
> so that I can create a WAR that is portable across Java EE 5
> containers? Or is that a non-goal of Java EE 5?

JSR109v1.2 does specify the packaging requirements for a service. At a
minimum, the developer should package the JAXWS endpoint impl class
(using proper annotations) in a WAR / JAR; the platform implementation
should take care of the rest. If the developer packages webservices.xml,
then that has to be present in WEB-INF or META-INF depending on the type
of endpoint (and in this case WebService.wsdlLocation should point to
the packaged WSDL). If you package webservices.xml, then the values in
webservices.xml override the values in the corresponding @WebService
annotation. I have cc'ed the 109v12 spec lead here. He will chime in, if
I missed some detail.

> I am trying to understand how to use the 'wsdl-publish-location' element
> if I want to package a WSDL inside the WAR for a web service, i.e.,
> WEB-INF/wsdl/MyService.wsdl

'wsdl-publish-location' is specific to GlassFish and gives a way for
publishing the WSDL as a file location in addition to making the
published WSDL available as an URL. If you check
appserv-tests/devtests/webservice/annotations/prepkged-svc-1, the
wsdl-publish-location points to a local directory - so, at the end of
deployment of the service, the WSDL will be available at the usual URL
(accessibe through http://...?WSDL). PLUS, the wsdl will also be
published in the directory specified using wsdl-publish-location. Again,
this is a GlassFIsh specific 'feature' and is not specified in 109.

Coming to your question of packaging the WSDL :

1. If you are starting from Java, then (if you wish) there is no need to
package WSDL; Just package the endpoint in WAR / JAR and the platform
will take care of the rest
2. If you are starting from WSDL, then you package the WSDL in in your
WAR or JAR along with SEI, endpoint impl (plus other classes generated
by wsimport in GlassFish) and deploy that artifact.

Hope this helps

Vijay