I want to write a simple 2 player battleships game using jax-ws. so there is a server running in the glassfish appServer and clients can connect to is oever SOAP.
now i am a little confused. let's consider the scenario, that client1 (c1) wants to shoot, so it calls the servers WebMethod shoot(xCord, YCord, playerID). now c1 has to wait until c2 has made his turn.
i tried to implement this using async calls using call-back functions ... which of course did not work, since c1 gets called back, when it shot, but i want c2 to be notified, that it can make a turn now.
what is the best way to do this?
as i said, i am a little confused and i hope that i could make myself clear.
I don't think WS are a good fit for this problem. WS are server-centric, with clients making requests to which the server responds; battleship is a peer-to-peer scenario, with both sides being equals, so to speak. While it's possible to make asynchronous calls, to which the server responds at some later time, this may be difficult in practice due to firewalls and NAT.
Now, if you had just one player, who battles a computer opponent accessed via WS, that would be a much better fit. Plus, you'd get to think up and implement a strategy of how to play the game
Ping & DNS - updated with new look and Ping home screen widget
Joined: Apr 29, 2007
yes, that makes sens ... i already implemented everything using rmi, where i can call methods on the client from the server.
but it's got to work with JAX-WS as well ... maybe with a dispatcher ... i am lost somehow
i could always poll the server, but that is just not nice.