I have a Chat Web Service and a java application as client.
When the client "connects" or call the method connect(user) in the server, the user is listed in the server.
How then would the server know if the user already closed the client application? I could call a disconnect method before the user closes the application. But what if the application closes without calling the disconnect method?
Is there a way that the server would know that the user is not connected anymore?
Both the server and the client need to be a Web Service. A requester and provider. The provider hosts a WSDL for both the 'Chat Service' and the 'Chat Callback Service'.
The client then fetches the callback WSDL from the provider and builds a new one by importing the fetched wsdl <wsdl:import> and adding the port details of its client-side service.
The client can then generate the skeleton classes using wsdl2java and the server can do the same to build the stubs. The server can then invoke a isAlive() method or something similar to test if the client is there or not.