1 24 package org.objectweb.joram.client.jms.soap; 25 26 import org.apache.soap.rpc.Parameter; 27 import org.apache.soap.server.DeploymentDescriptor; 28 import org.apache.soap.server.ServiceManagerClient; 29 import org.apache.soap.server.TypeMapping; 30 import org.apache.soap.util.xml.QName; 31 32 36 public class SoapServiceStarter { 37 47 public static void main(String [] args) throws Exception { 48 String host = args[0]; 49 int port = Integer.parseInt(args[1]); 50 int serverId = Integer.parseInt(args[2]); 51 String serverName = args[3]; 52 53 java.net.URL url = new java.net.URL ("http://" + host + ":" + port 54 + "/soap/servlet/rpcrouter"); 55 56 System.out.println("Starting the SOAP service on host " 57 + host 58 + " listening on port " 59 + port); 60 61 ServiceManagerClient smc = new ServiceManagerClient(url); 62 smc.deploy(getDeploymentDescriptor()); 63 64 System.out.println("SOAP service deployed."); 65 66 org.apache.soap.rpc.Call call = new org.apache.soap.rpc.Call(); 67 call.setTargetObjectURI("urn:ProxyService"); 68 call.setMethodName("start"); 69 70 java.util.Vector params = new java.util.Vector (); 71 params.add(new Parameter("serverId", Integer .class, 72 new Integer (serverId), null)); 73 params.add(new Parameter("serverName", String .class, serverName, null)); 74 call.setParams(params); 75 76 System.out.println("Starting the " + serverName + " embedded server."); 77 78 org.apache.soap.rpc.Response resp = call.invoke(url,""); 79 80 System.out.println("Server " + serverId + " started."); 81 } 82 83 87 private static DeploymentDescriptor getDeploymentDescriptor() { 88 DeploymentDescriptor dd = new DeploymentDescriptor(); 89 90 dd.setID("urn:ProxyService"); 91 92 dd.setProviderType(DeploymentDescriptor.PROVIDER_JAVA); 93 dd.setProviderClass("org.objectweb.joram.mom.proxies.soap.SoapProxyService"); 94 dd.setScope(DeploymentDescriptor.SCOPE_APPLICATION); 95 96 String [] methods = {"start", "setConnection", "send", "getReply"}; 97 dd.setMethods(methods); 98 99 String [] listener = {"org.apache.soap.server.DOMFaultListener"}; 100 dd.setFaultListener(listener); 101 102 dd.setMappings(getTypeMappings()); 103 104 return dd; 105 } 106 107 108 private static TypeMapping[] getTypeMappings() { 109 TypeMapping[] mappings = new TypeMapping[27]; 110 111 String encoding = "http://schemas.xmlsoap.org/soap/encoding/"; 112 String bSerializer = "org.apache.soap.encoding.soapenc.BeanSerializer"; 113 114 int i = 0; 115 116 mappings[i++] = 117 new TypeMapping(encoding, 118 new QName("urn:ProxyService", "AbstractJmsRequest"), 119 "org.objectweb.joram.shared.client.AbstractJmsRequest", 120 bSerializer, bSerializer); 121 mappings[i++] = 122 new TypeMapping(encoding, 123 new QName("urn:ProxyService", "CnxConnectRequest"), 124 "org.objectweb.joram.shared.client.CnxConnectRequest", 125 bSerializer, bSerializer); 126 mappings[i++] = 127 new TypeMapping(encoding, 128 new QName("urn:ProxyService", "CnxStartRequest"), 129 "org.objectweb.joram.shared.client.CnxStartRequest", 130 bSerializer, bSerializer); 131 mappings[i++] = 132 new TypeMapping(encoding, 133 new QName("urn:ProxyService", "CnxStopRequest"), 134 "org.objectweb.joram.shared.client.CnxStopRequest", 135 bSerializer, bSerializer); 136 mappings[i++] = 137 new TypeMapping(encoding, 138 new QName("urn:ProxyService", "CnxCloseRequest"), 139 "org.objectweb.joram.shared.client.CnxCloseRequest", 140 bSerializer, bSerializer); 141 mappings[i++] = 142 new TypeMapping(encoding, 143 new QName("urn:ProxyService", "ConsumerAckRequest"), 144 "org.objectweb.joram.shared.client.ConsumerAckRequest", 145 bSerializer, bSerializer); 146 mappings[i++] = 147 new TypeMapping(encoding, 148 new QName("urn:ProxyService", "ConsumerDenyRequest"), 149 "org.objectweb.joram.shared.client.ConsumerDenyRequest", 150 bSerializer, bSerializer); 151 mappings[i++] = 152 new TypeMapping(encoding, 153 new QName("urn:ProxyService", "ConsumerReceiveRequest"), 154 "org.objectweb.joram.shared.client.ConsumerReceiveRequest", 155 bSerializer, bSerializer); 156 mappings[i++] = 157 new TypeMapping(encoding, 158 new QName("urn:ProxyService", "ConsumerSetListRequest"), 159 "org.objectweb.joram.shared.client.ConsumerSetListRequest", 160 bSerializer, bSerializer); 161 mappings[i++] = 162 new TypeMapping(encoding, 163 new QName("urn:ProxyService", 164 "ConsumerUnsetListRequest"), 165 "org.objectweb.joram.shared.client.ConsumerUnsetListRequest", 166 bSerializer, bSerializer); 167 mappings[i++] = 168 new TypeMapping(encoding, 169 new QName("urn:ProxyService", "ConsumerSubRequest"), 170 "org.objectweb.joram.shared.client.ConsumerSubRequest", 171 bSerializer, bSerializer); 172 mappings[i++] = 173 new TypeMapping(encoding, 174 new QName("urn:ProxyService", "ConsumerCloseSubRequest"), 175 "org.objectweb.joram.shared.client.ConsumerCloseSubRequest", 176 bSerializer, bSerializer); 177 mappings[i++] = 178 new TypeMapping(encoding, 179 new QName("urn:ProxyService", "ConsumerUnsubRequest"), 180 "org.objectweb.joram.shared.client.ConsumerUnsubRequest", 181 bSerializer, bSerializer); 182 mappings[i++] = 183 new TypeMapping(encoding, 184 new QName("urn:ProxyService", "QBrowseRequest"), 185 "org.objectweb.joram.shared.client.QBrowseRequest", 186 bSerializer, bSerializer); 187 mappings[i++] = 188 new TypeMapping(encoding, 189 new QName("urn:ProxyService", "SessAckRequest"), 190 "org.objectweb.joram.shared.client.SessAckRequest", 191 bSerializer, bSerializer); 192 mappings[i++] = 193 new TypeMapping(encoding, 194 new QName("urn:ProxyService", "SessDenyRequest"), 195 "org.objectweb.joram.shared.client.SessDenyRequest", 196 bSerializer, bSerializer); 197 mappings[i++] = 198 new TypeMapping(encoding, 199 new QName("urn:ProxyService", "SessCreateTQRequest"), 200 "org.objectweb.joram.shared.client.SessCreateTQRequest", 201 bSerializer, bSerializer); 202 mappings[i++] = 203 new TypeMapping(encoding, 204 new QName("urn:ProxyService", "SessCreateTTRequest"), 205 "org.objectweb.joram.shared.client.SessCreateTTRequest", 206 bSerializer, bSerializer); 207 mappings[i++] = 208 new TypeMapping(encoding, 209 new QName("urn:ProxyService", "TempDestDeleteRequest"), 210 "org.objectweb.joram.shared.client.TempDestDeleteRequest", 211 bSerializer, bSerializer); 212 mappings[i++] = 213 new TypeMapping(encoding, 214 new QName("urn:ProxyService", "GetAdminTopicRequest"), 215 "org.objectweb.joram.shared.client.GetAdminTopicRequest", 216 bSerializer, bSerializer); 217 mappings[i++] = 218 new TypeMapping(encoding, 219 new QName("urn:ProxyService", "AbstractJmsReply"), 220 "org.objectweb.joram.shared.client.AbstractJmsReply", 221 bSerializer, bSerializer); 222 mappings[i++] = 223 new TypeMapping(encoding, 224 new QName("urn:ProxyService", "ServerReply"), 225 "org.objectweb.joram.shared.client.ServerReply", 226 bSerializer, bSerializer); 227 mappings[i++] = 228 new TypeMapping(encoding, 229 new QName("urn:ProxyService", "MomExceptionReply"), 230 "org.objectweb.joram.shared.client.MomExceptionReply", 231 bSerializer, bSerializer); 232 mappings[i++] = 233 new TypeMapping(encoding, 234 new QName("urn:ProxyService", "CnxConnectReply"), 235 "org.objectweb.joram.shared.client.CnxConnectReply", 236 bSerializer, bSerializer); 237 mappings[i++] = 238 new TypeMapping(encoding, 239 new QName("urn:ProxyService", "CnxCloseReply"), 240 "org.objectweb.joram.shared.client.CnxCloseReply", 241 bSerializer, bSerializer); 242 mappings[i++] = 243 new TypeMapping(encoding, 244 new QName("urn:ProxyService", "SessCreateTDReply"), 245 "org.objectweb.joram.shared.client.SessCreateTDReply", 246 bSerializer, bSerializer); 247 mappings[i++] = 248 new TypeMapping(encoding, 249 new QName("urn:ProxyService", "GetAdminTopicReply"), 250 "org.objectweb.joram.shared.client.GetAdminTopicReply", 251 bSerializer, bSerializer); 252 253 return mappings; 254 } 255 } 256 | Popular Tags |