Browse DevX
Sign up for e-mail newsletters from DevX


Build a SOAP-based Chat Application with Java Web Services, Part 2 : Page 3

In Part 1, you built a fully-functional chat application using the Eclipse IDE and free Web services software from Systinet. In Part 2, use WASP Developer for Eclipse 4.6 to extend your original application with asynchronous messaging.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Figure 1. Import sources.

Installing the Sources in Eclipse
Assuming that you have Eclipse with WASP Developer up and running, install the sample code. First of all, download the sources with the sample service code here.

  1. In Eclipse create a new project (File—>New—>Project...). Choose the Systinet Web Services/Web Service Project.
  2. In the following dialog enter the project name, AsyncChatServiceProject, and project location. Finish the wizard.
  3. From the File menu, choose the Import... command, and choose the Zip file method.
  4. In the following dialog choose the service code file downloaded earlier and click on the Finish button.

Your project should now contain the two packages with the source for the Asynchronous Chat Service. You can verify this by examining the Package Explore view.

Figure 2. The runner for the server.

Turning the Chat Server into a Web Service
There's no surprise waiting here for those who visited the first tutorial. You publish the chat server implementation as a Web service using the WASP Server for Java runtime publishing API. With these two method calls, your Java class gets published as a Web Service:

public class ChatServerApp { public static void main(String[] args) throws Exception { Wasp.startServer("http://localhost:6060"); Registry.publish("/ChatServiceAsync/", ChatService.class); System.out.println("Chat server V2 is up an running.") } }

The full source can be found in Listing 3

Build and Run the Chat Server
The chat server is now ready to run. After the build is complete (Project—>Rebuild All), you can start it. First, create a Web service runner. This runner ensures that the server has all the required libraries and that it is properly configured. To create the runner, select the ChatServerApp from the com.systinet.asyncchat.server.impl package and choose Run—>Run... from the IDE menu.

Figure 3. The output in the console.

The dialog that opens is the manager for all runners in the project. Double click on the WASP Java Application runner template. This creates a new runner called ChatServerApp. Always use this runner to run the ChatServerApp class. Press the Run button to start the chat server. You should see the console, normally at the bottom of the IDE window, with a message about a running server. If there's any exception there, you either haven't run the server through its runner, or another process is sitting at port 6060. Please make sure that no process is listening on this port and that you use the correct runner, and run the server one more time. It is essential to have this server running for the rest of the tutorial.

As a reminder, the server is up and running now. Its location is:


The location of the dynamically generated WSDL document is:


Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date