01: package org.objectweb.celtix.systest.routing.bridge;
02:
03: import java.util.HashMap;
04: import java.util.Map;
05:
06: import javax.xml.namespace.QName;
07: import javax.xml.ws.Endpoint;
08:
09: import org.objectweb.celtix.systest.common.TestServerBase;
10: import org.objectweb.celtix.systest.routing.DocLitWrappedImpl;
11:
12: public class Server extends TestServerBase {
13: private static final String XML_BINDINGID = new String(
14: "http://celtix.objectweb.org/bindings/xmlformat");
15:
16: protected void run() {
17: QName serviceName = new QName(
18: "http://objectweb.org/hello_world_doc_lit",
19: "XMLService1");
20: QName portName = new QName(
21: "http://objectweb.org/hello_world_doc_lit", "XMLPort1");
22:
23: String address = "http://localhost:9002/XMLService1/XMLPort1";
24: createAndpublishEndpoint(address, serviceName, portName,
25: XML_BINDINGID);
26:
27: serviceName = new QName(
28: "http://objectweb.org/hello_world_doc_lit",
29: "XMLService2");
30: portName = new QName(
31: "http://objectweb.org/hello_world_doc_lit", "XMLPort2");
32: address = new String("http://localhost:0/JMSService/JMSPort");
33: createAndpublishEndpoint(address, serviceName, portName,
34: XML_BINDINGID);
35:
36: serviceName = new QName(
37: "http://objectweb.org/hello_world_doc_lit",
38: "SOAPService2");
39: portName = new QName(
40: "http://objectweb.org/hello_world_doc_lit", "SoapPort2");
41: address = new String("http://localhost:0/JMSService/JMSPort");
42: createAndpublishEndpoint(address, serviceName, portName, null);
43:
44: serviceName = new QName(
45: "http://objectweb.org/hello_world_doc_lit",
46: "SOAPService5");
47: portName = new QName(
48: "http://objectweb.org/hello_world_doc_lit", "SoapPort5");
49: address = new String(
50: "http://localhost:9002/SOAPService5/SoapPort5");
51: createAndpublishEndpoint(address, serviceName, portName, null);
52: }
53:
54: private void createAndpublishEndpoint(String address,
55: QName serviceName, QName portName, String bindingId) {
56: Object implementor = new DocLitWrappedImpl();
57: Map<String, Object> props = new HashMap<String, Object>();
58: props.put(Endpoint.WSDL_SERVICE, serviceName);
59: props.put(Endpoint.WSDL_PORT, portName);
60:
61: Endpoint ep = null;
62: if (null != bindingId) {
63: ep = Endpoint.create(bindingId, implementor);
64: } else {
65: ep = Endpoint.create(implementor);
66: }
67: ep.setProperties(props);
68: ep.publish(address);
69: }
70:
71: public static void main(String[] args) {
72: try {
73: Server s = new Server();
74: s.start();
75: //s.run();
76: } catch (Exception ex) {
77: ex.printStackTrace();
78: System.exit(-1);
79: } finally {
80: System.out.println("done!");
81: }
82: }
83: }
|