String passWord = csgServer.getPassWord();
String domainName = csgServer.getDomainName();
String sessionCookie = CSGAgentUtils.getSessionCookie(getAuthServiceURL(csgServer),
userName, passWord, domainName, csgServer.getHost());
CSGAdminClient csgAdminClient;
if (CSGAgentUtils.isClientAxis2XMLExists()) {
ConfigurationContext configCtx = ConfigurationContextFactory.
createConfigurationContextFromFileSystem(null, CSGConstant.CLIENT_AXIS2_XML);
csgAdminClient = new CSGAdminClient(sessionCookie, getProxyURL(csgServer), configCtx);
} else {
csgAdminClient = new CSGAdminClient(sessionCookie, getProxyURL(csgServer));
}
boolean isExposedOnJMS = isExposedOnJMS(serviceName);
ServiceAdmin serverAdmin = new ServiceAdmin(axis2Conf);
serverAdmin.addTransportBinding(serviceName, CSGConstant.JMS_PREFIX);
AxisService service = axis2Conf.getService(serviceName);
// enable JMS transport sender if required
// Note: we need to enable JMS sender before JMS listener otherwise
// AbstractTransportListener.java:96 ( where we initialize transportOut) will be initialized
// to a null value which causes the response to be lost and JMSSender at client side is
// end up with a warning for not receiving the response
if(hasInOutOperations(service)){
enableJMSTransportSender(serviceName);
}
// enable JMS listener for this service
enableJMSTransportListner(serviceName, csgAdminClient, userName, passWord,
csgServer.getHost(), csgServer.getDomainName());
// deploy the proxy on CSG server
csgAdminClient.deployProxy(getServiceMetaData(service, domainName));
// flag the service as published
flagServicePublishing(serviceName, serverName, true, isExposedOnJMS);
} catch (Exception e) {
handleException("Cloud not publish service '" + serviceName + "'", e);