Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I do this utilizing Jetty or similar?  RSS feed

 
mat buckland
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm new to writing web services, so please bear that in mind.

Requirements

On the server machine I need to run a business simulation, which has dynamic state. Let's use a very simple example




An instance of this object must be *running at all times* on the server so that it's state is kept updated.

I also require a SOAP based web service that exposes Simulator::getState() so that remote machines can query the simulator's state.

A Solution

I've been reading 'Java Web Services Up and Running' and have modified his very simple example that utilizes an Endpoint object to publish the web service (this also utilizes a thread pool) and run the simulator at the same time. This works great and looks like this:






The Problem

I now need to do the same thing but deploy the WS in a web container such as Jetty. Unfortunately I haven't a clue how to do that (and run the sim at the same time) since main() is never called when Jetty starts the service.
I've tried calling simulator.Run() in the SimServerImpl constructor but that seems to hang the client when i go to test it.

I would very much appreciate it if someone could outline how I can solve this problem. I've been stumped for days now and I'm getting overwhelmed with all the options.

Many thanks and apologies for the long post.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!