Skip to main content

Abstracting from http.server / http.servlet transport

5 replies [Last post]
medavid
Offline
Joined: 2006-12-31

Hi all,

An jaxws webservice is currently launched either as standalone or in a servlet environment. For the standalone mode you can at runtime create endpoints reffering to instance of your implementation, where as for the servlet you'll need to have them in your descriptor file at configuration time.

I have an application that launches endpoints at runtime (depending plugins etc.) and is currently implemented using the standalone http server, but I also want to be able to run it in the servlet environment.

I hacked together something similar to the WSServlet making the list with adapters in the WSServletDelegate public domain and thus allowing to add / remove adapters at runtime.

This is all getting a lot of hassle for something simple: abstracting wether it is run standalone or within an servlet. Am I overlooking something? Shouldn't this be 'out-of-the-box' functionality?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kohsuke
Offline
Joined: 2003-06-09

For services running inside, such difference should be largely invisible.

But if you are deploying services on your own term (which is what you are doing, it sounds like), then you'd have to use our hosting API to do so. IOW, you have to do what the container would normally do.

I guess I don't understand what you envision as the excessive work that you shouldn't have to do, and what is that 'out-of-the-box' functionality that you expected.

medavid
Offline
Joined: 2006-12-31

I want to create a factory similar to EndPoint.publish(...) that dynamically creates endpoint no matter if we are running in a servlet or as standalone http server. I can run my application on servlet startup using a listener class defined in the web.xml, but it will need access to the adapters list in the WSServiceDelegate. I'll write some code to make it an out of the box available when I have access to the adapter list. I'll file an bug report (feature request) to make the adapter list available.

kohsuke
Offline
Joined: 2003-06-09

Ah, OK, so you just want to add a new ServletAdapter to the adapter list.

But that alone might not be sufficient with servlet. The JAX-WS's servlet also needs to be properly URL-mapped.

The next revision of the servlet spec is supposed to be working on this kind of programatic registration, so maybe that will help.

medavid
Offline
Joined: 2006-12-31

I have worked around it by making a servlet-mapping with url pattern /services/* and modified almost every class in com.sun.xml.ws.transport.http.servlet. I'll see if I can add a proper patch to bug #261 while I'm at it

kohsuke
Offline
Joined: 2003-06-09

Thanks. I'm looking forward to seeing the patch.