This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Services and the fly likes battleships game with JAX-WS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "battleships game with JAX-WS" Watch "battleships game with JAX-WS" New topic
Author

battleships game with JAX-WS

Jan Schumacher
Greenhorn

Joined: Apr 29, 2007
Posts: 2
Hi everybody,

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.

Cheers, jansch
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41132
    
  45
Welcome to JavaRanch.

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 - my free Android networking tools app
Jan Schumacher
Greenhorn

Joined: Apr 29, 2007
Posts: 2
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.

Cheers, Jan
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: battleships game with JAX-WS
 
Similar Threads
Uno: Returning control to the Uno object from a player object
how many objects will be eligible for garbage collection
Garbage collection doubt
protected and default constructor
Garbage Collection