*/
public void removeExposedTransports(String serviceName, String transportProtocol)
throws Exception {
TransportSummary[] transports;
ServicePersistenceManager pm;
AxisService axisService;
if (serviceName == null) {
handleException("Invalid service name");
}
if (transportProtocol == null) {
handleException("Invalid transport name");
}
axisService = getAxisConfig().getServiceForActivation(serviceName);
if (axisService == null) {
handleException("No service exists by the name : " + serviceName);
}
try {
if (isUTEnabled(serviceName)) {
// If UT enabled, you can't remove HTTPS transport from this service.
if (ServerConstants.HTTPS_TRANSPORT.equalsIgnoreCase(transportProtocol)) {
throw new Exception("Cannot remove HTTPS transport binding for Service ["
+ serviceName + "] since a security scenario which requires the "
+ "service to contain only the HTTPS transport binding"
+ " has been applied to this service.");
}
}
if (!axisService.isEnableAllTransports()) {
if (axisService.getExposedTransports().size() == 1) {
log.warn("At least one transport binding must exist for a service. No bindings " +
"will be removed.");
return;
}
// Simply remove the transport from the list of exposed transport
axisService.removeExposedTransport(transportProtocol);
} else {
// This returns all the available transports - not just active ones.
transports = listTransports();
// populate the exposed transports list with the other transports
for (TransportSummary transport : transports) {
if (transport.isListenerActive() &&
!transport.getProtocol().equals(transportProtocol)) {
axisService.addExposedTransport(transport.getProtocol());
}
}
axisService.setEnableAllTransports(false);
}
pm = new ServicePersistenceManager(getAxisConfig());
pm.removeExposedTransports(serviceName, transportProtocol);
getAxisConfig().notifyObservers(
new AxisEvent(CarbonConstants.AxisEvent.TRANSPORT_BINDING_REMOVED, axisService),
axisService);