We have a message processing server, which
- start a few threads
- processing the message
- interact with the database etc…..
now the client want to have a web service server on the server, they will be able to querying the message processing server, with a web service client. e.g. give me all the messages for today, or delete the message with id….
the problem are:
- The server just a standard j2se application, doesn’t run inside application server, like tomcat or glassfish.
- To handle a Http request, do I need to implement a http server?
- I would like to use the nice j2ee annotation such as @webservice, @webmothod etc…
is there any library or framework I can use
You don’t need a third party library to use jax-ws annotations. J2SE ships with jax-ws, so all the annotations are still available to you. You can achieve lightweight results with the following solution, but for anything optimized/multi-threaded, it’s on your own head to implement:
Design a SEI, service endpoint interface, which is basically a java interface with web-service annotations. This is not mandatory, it’s just a point of good design from basic OOP.
Implement the SEI in a java class called a SIB service implementation bean.
Expose the service using an
Endpointimport javax.xml.ws.Endpoint;
The snippets above, like I said, are pretty basic, and will perform poorly in production. You’ll need to work out a threading model for requests. The endpoint API accepts an instance of Executor to support concurrent requests. Threading’s not really my thing, so I’m unable to give you pointers.