use of org.apache.axis2.addressing.metadata.ServiceName in project axis-axis2-java-core by apache.
the class SOAPMessageBodyBasedServiceDispatcher method findService.
public AxisService findService(MessageContext messageContext) throws AxisFault {
String serviceName = null;
String localPart = messageContext.getEnvelope().getSOAPBodyFirstElementLocalName();
if (localPart != null) {
OMNamespace ns = messageContext.getEnvelope().getSOAPBodyFirstElementNS();
if (ns != null) {
String filePart = ns.getNamespaceURI();
if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
log.debug(messageContext.getLogIDString() + "Checking for Service using SOAP message body's first child's namespace : " + filePart);
}
String[] values = Utils.parseRequestURLForServiceAndOperation(filePart, messageContext.getConfigurationContext().getServiceContextPath());
if (values[0] != null) {
serviceName = values[0];
AxisConfiguration registry = messageContext.getConfigurationContext().getAxisConfiguration();
return registry.getService(serviceName);
}
}
}
return null;
}
use of org.apache.axis2.addressing.metadata.ServiceName in project axis-axis2-java-core by apache.
the class AxisConfiguration method startService.
public void startService(String serviceName) throws AxisFault {
AxisService service = allServices.get(serviceName);
if (service == null) {
throw new AxisFault(Messages.getMessage("servicenamenotvalid", serviceName));
}
service.setActive(true);
notifyObservers(new AxisEvent(AxisEvent.SERVICE_START, service), service);
}
use of org.apache.axis2.addressing.metadata.ServiceName in project axis-axis2-java-core by apache.
the class AxisConfiguration method stopService.
public void stopService(String serviceName) throws AxisFault {
AxisService service = allServices.get(serviceName);
if (service == null) {
throw new AxisFault(Messages.getMessage("servicenamenotvalid", serviceName));
}
service.setActive(false);
notifyObservers(new AxisEvent(AxisEvent.SERVICE_STOP, service), service);
}
use of org.apache.axis2.addressing.metadata.ServiceName in project axis-axis2-java-core by apache.
the class AxisConfiguration method addServiceToExistingServiceGroup.
/**
* This method is used to add a service to an existing active service group in the axis configuration
*
* @param axisService service to be added to the existing service group provided
* @param serviceGroupName name of the service group which should be existing in the axis configuration
* @throws AxisFault in case of an error in adding the service to the group specified or if the group is not existing
*/
public void addServiceToExistingServiceGroup(AxisService axisService, String serviceGroupName) throws AxisFault {
AxisServiceGroup serviceGroup = getServiceGroup(serviceGroupName);
if (serviceGroup == null) {
String message = "A ServiceGroup with the provided name " + serviceGroupName + " is not existing";
log.error(message);
throw new AxisFault(message);
}
if (axisService.getSchemaTargetNamespace() == null) {
axisService.setSchemaTargetNamespace(Java2WSDLConstants.AXIS2_XSD);
}
if (axisService.isUseDefaultChains()) {
Iterator<AxisOperation> operations = axisService.getOperations();
while (operations.hasNext()) {
AxisOperation operation = operations.next();
phasesinfo.setOperationPhases(operation);
}
}
Map<String, AxisEndpoint> endpoints = axisService.getEndpoints();
if (endpoints == null || endpoints.size() == 0) {
org.apache.axis2.deployment.util.Utils.addEndpointsToService(axisService, axisService.getAxisConfiguration());
endpoints = axisService.getEndpoints();
}
String serviceName = axisService.getName();
addToAllServicesMap(axisService);
if (endpoints != null) {
Iterator<String> endpointNameIter = endpoints.keySet().iterator();
while (endpointNameIter.hasNext()) {
String endpointName = endpointNameIter.next();
if (log.isDebugEnabled()) {
log.debug("Adding service to allEndpoints map: (" + serviceName + "," + endpointName + ") ");
}
allEndpoints.put(serviceName + "." + endpointName, axisService);
}
if (log.isDebugEnabled()) {
log.debug("After adding to allEndpoints map, size is " + allEndpoints.size());
}
}
serviceGroup.addService(axisService);
if (!axisService.isClientSide()) {
notifyObservers(new AxisEvent(AxisEvent.SERVICE_DEPLOY, axisService), axisService);
}
}
use of org.apache.axis2.addressing.metadata.ServiceName in project axis-axis2-java-core by apache.
the class AxisConfiguration method addServiceGroup.
public synchronized void addServiceGroup(AxisServiceGroup axisServiceGroup) throws AxisFault {
axisServiceGroup.setParent(this);
notifyObservers(new AxisEvent(AxisEvent.SERVICE_DEPLOY, axisServiceGroup), axisServiceGroup);
AxisService axisService;
Iterator<AxisService> services = axisServiceGroup.getServices();
while (services.hasNext()) {
axisService = services.next();
if (axisService.getSchemaTargetNamespace() == null) {
axisService.setSchemaTargetNamespace(Java2WSDLConstants.AXIS2_XSD);
}
}
services = axisServiceGroup.getServices();
while (services.hasNext()) {
axisService = services.next();
if (axisService.isUseDefaultChains()) {
Iterator<AxisOperation> operations = axisService.getOperations();
while (operations.hasNext()) {
AxisOperation operation = operations.next();
phasesinfo.setOperationPhases(operation);
}
}
}
Iterator<AxisModule> enModule = getEngagedModules().iterator();
while (enModule.hasNext()) {
axisServiceGroup.engageModule(enModule.next());
}
services = axisServiceGroup.getServices();
ArrayList<AxisService> servicesIAdded = new ArrayList<AxisService>();
while (services.hasNext()) {
axisService = services.next();
processEndpoints(axisService, axisService.getAxisConfiguration());
Map<String, AxisEndpoint> endpoints = axisService.getEndpoints();
String serviceName = axisService.getName();
try {
addToAllServicesMap(axisService);
} catch (AxisFault axisFault) {
// remove all the ones we added...
for (AxisService service : servicesIAdded) {
allServices.remove(service.getName());
}
// And toss this in case anyone wants it?
throw axisFault;
}
servicesIAdded.add(axisService);
if (endpoints != null) {
Iterator<String> endpointNameIter = endpoints.keySet().iterator();
while (endpointNameIter.hasNext()) {
String endpointName = endpointNameIter.next();
if (log.isDebugEnabled()) {
log.debug("Adding service to allEndpoints map: (" + serviceName + "," + endpointName + ") ");
}
allEndpoints.put(serviceName + "." + endpointName, axisService);
}
if (log.isDebugEnabled()) {
log.debug("After adding to allEndpoints map, size is " + allEndpoints.size());
}
}
if (!axisService.isClientSide()) {
notifyObservers(new AxisEvent(AxisEvent.SERVICE_DEPLOY, axisService), axisService);
}
}
// serviceGroups.put(axisServiceGroup.getServiceGroupName(),
// axisServiceGroup);
addChild(axisServiceGroup);
}
Aggregations