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