[jboss-dev-forums] [JBoss AS7 Development] - Re: Load on startup is ignored - JaxWS webservice is always initialized first

Alessio Soldano do-not-reply at jboss.com
Wed Jul 27 05:04:47 EDT 2011


Alessio Soldano [http://community.jboss.org/people/asoldano] created the discussion

"Re: Load on startup is ignored - JaxWS webservice is always initialized first"

To view the discussion, visit: http://community.jboss.org/message/617824#617824

--------------------------------------------------------------
Hi rushead,
the WS endpoints is actually started during the deployment phase, which ends with rewriting (for POJO endpoints) [1] or creation (for EJB3 endpoints) of the webapp web.xml descriptor and start of the web transport layer. The servlet stuff is indeed just the transport layer/view of the webservice endpoint and is just the mean for serving HTTP requests to the webservice endpoints. The endpoint is thus created regardless of / independently from the servlet layer and the jbossws endpoint servlet delegates to the actual ws endpoints at runtime.
Expecting the servlet context to be available when the POJO endpoint bean is instanciated if unfortunately a wrong assumption here. Similarly, I bet you would not expect to have the servlet stuff available when an EJB3 WS endpoint is created in the case of EJB3 endpoints.
So unless there's a specification requirement (and I really believe there's not such req) mandating actually creating the endpoint after the web transport is up, this is not going to be modified, as this a design decision and it granted multiple benefits. Btw, AS6 was already based on this afair.
This said, you can probably achieve the behaviour you need differently, below are a couple of idea:
- you can modify your ws endpoint impl to call a given method when the first invocation comes; if your endpoint is being served on HTTP transport only, the servlet context and such will for sure be available
- you could also provide a configuration lookup mechanism that do not rely on the servlet init params (for instance lookup/read a conf or prop file in the deployment, use the ServiceLoader API, etc) and read your configuration in a @PostConstruct annotated method of the endpoint implementation
- if you still need to bound your endpoint creation to the servlet, you can have a custom servlet that programmatically starts a WS endpoint, either by the JAXWS Enpdoint.publish(..) API or through the EndpointPublisher API that is included in the current AS 7.1.0.Alpha1-SNAPSHOT version (that's still to be released, sorry)



[1] your web.xml is rewritten by replacing the reference to the ws endpoint bean with the actual jbossws endpoint servlet; the endpoint bean class is passed to the endpoint servlet as a parameter
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/617824#617824]

Start a new discussion in JBoss AS7 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20110727/d5de83ed/attachment.html 


More information about the jboss-dev-forums mailing list