01: package org.objectweb.hello_world_soap_http;
02:
03: import javax.xml.ws.Endpoint;
04:
05: import org.objectweb.celtix.Bus;
06: import org.objectweb.celtix.BusException;
07:
08: public class GreeterServer implements Runnable {
09:
10: Bus bus;
11:
12: protected GreeterServer(String[] args) throws Exception {
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 implementor = new AnnotatedGreeterImpl();
22: String address = "http://localhost:9000/SoapContext/SoapPort";
23: Endpoint.publish(address, implementor);
24: }
25:
26: public static void main(String args[]) throws Exception {
27: GreeterServer server = new GreeterServer(args);
28: Thread t = new Thread(server);
29: t.start();
30: try {
31: Thread.sleep(100);
32: } catch (InterruptedException 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: }
|