ConfigurationContext synapseConfigCtx = ConfigurationContextFactory
.createConfigurationContextFromFileSystem(
"./target/test_repos/synapse",
"./target/test_repos/axis2.xml");
TransportInDescription synTrsIn =
synapseConfigCtx.getAxisConfiguration().getTransportsIn().get("http");
synTrsIn.getParameter("port").setValue("10100");
synTrsIn =
synapseConfigCtx.getAxisConfiguration().getTransportsIn().get("https");
synTrsIn.getParameter("port").setValue("12100");
startServer(synapseConfigCtx);
ServerContextInformation contextInformation =
new ServerContextInformation(synapseConfigCtx, information);
ServerManager serverManager = new ServerManager();
serverManager.init(information, contextInformation);
serverManager.start();
// Initializing Business Endpoint
// Set a different agent name to avoid collisions between the MBeans registered
// by the two servers.
System.setProperty("jmx.agent.name", "business");
ConfigurationContext businessConfigCtx = ConfigurationContextFactory
.createConfigurationContextFromFileSystem(
"./target/test_repos/synapse",
"./target/test_repos/axis2.xml");
HashMap messageReciverMap = new HashMap();
Class inOnlyMessageReceiver = org.apache.axis2.util.Loader.loadClass(
"org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver");
org.apache.axis2.engine.MessageReceiver messageReceiver =
(org.apache.axis2.engine.MessageReceiver) inOnlyMessageReceiver.newInstance();
messageReciverMap.put(
org.apache.axis2.description.WSDL2Constants.MEP_URI_IN_ONLY,
messageReceiver);
Class inoutMessageReceiver = org.apache.axis2.util.Loader.loadClass(
"org.apache.axis2.rpc.receivers.RPCMessageReceiver");
MessageReceiver inOutmessageReceiver =
(MessageReceiver) inoutMessageReceiver.newInstance();
messageReciverMap.put(
org.apache.axis2.description.WSDL2Constants.MEP_URI_IN_OUT,
inOutmessageReceiver);
messageReciverMap.put(org.apache.axis2.description.WSDL2Constants.MEP_URI_ROBUST_IN_ONLY,
inOutmessageReceiver);
AxisService businessService =
AxisService.createService(Services.class.getName(),
businessConfigCtx.getAxisConfiguration(),
messageReciverMap,
"http://business.org", "http://business.org",
Services.class.getClassLoader());
businessConfigCtx.getAxisConfiguration().addService(businessService);
TransportInDescription busTrsIn =
businessConfigCtx.getAxisConfiguration().getTransportsIn().get("http");
busTrsIn.getParameter("port").setValue("10101");
busTrsIn =
businessConfigCtx.getAxisConfiguration().getTransportsIn().get("https");
busTrsIn.getParameter("port").setValue("12101");
startServer(businessConfigCtx);
}