KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > hello_world_soap_http > GreeterServer


1 package org.objectweb.hello_world_soap_http;
2
3 import javax.xml.ws.Endpoint;
4
5 import org.objectweb.celtix.Bus;
6 import org.objectweb.celtix.BusException;
7
8 public class GreeterServer implements Runnable JavaDoc {
9
10     Bus bus;
11     
12     protected GreeterServer(String JavaDoc[] args) throws Exception JavaDoc {
13         System.out.println("Starting Server");
14
15         /**
16          * Creation of the endpoint could be part of the bus initialisation
17          * based on configuration. For now, do it manually.
18          */

19
20         bus = Bus.init(args);
21         Object JavaDoc implementor = new AnnotatedGreeterImpl();
22         String JavaDoc address = "http://localhost:9000/SoapContext/SoapPort";
23         Endpoint.publish(address, implementor);
24     }
25     
26     public static void main(String JavaDoc args[]) throws Exception JavaDoc {
27         GreeterServer server = new GreeterServer(args);
28         Thread JavaDoc t = new Thread JavaDoc(server);
29         t.start();
30         try {
31             Thread.sleep(100);
32         } catch (InterruptedException JavaDoc ex) {
33             // ignore
34
}
35         System.out.print("Press any key to terminate the server ...");
36         System.in.read();
37         
38         server.shutdown(true);
39         
40         t.join();
41     }
42     
43     public void run() {
44         bus.run();
45     }
46     
47     void shutdown(boolean wait) throws BusException {
48         bus.shutdown(wait);
49     }
50
51     
52 }
53
Popular Tags