本文整理汇总了Java中org.apache.axis2.description.AxisServiceGroup.addService方法的典型用法代码示例。如果您正苦于以下问题:Java AxisServiceGroup.addService方法的具体用法?Java AxisServiceGroup.addService怎么用?Java AxisServiceGroup.addService使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.axis2.description.AxisServiceGroup
的用法示例。
在下文中一共展示了AxisServiceGroup.addService方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deployService
import org.apache.axis2.description.AxisServiceGroup; //导入方法依赖的package包/类
private void deployService(List alreadyDeployed, DeploymentFileData archiveFileData) throws AxisFault {
File file = archiveFileData.getFile();
File wsdlFile;
File scriptFile;
if (file.toString().endsWith(".wsdl")) {
wsdlFile = file;
scriptFile = getScriptForWSDL(wsdlFile);
} else {
scriptFile = file;
wsdlFile = getWSDLForScript(scriptFile);
}
if (scriptFile != null && wsdlFile != null && !alreadyDeployed.contains(scriptFile.toURI()) && scriptFile.exists() && wsdlFile.exists()) {
AxisService axisService = createService(wsdlFile, scriptFile);
AxisServiceGroup axisServiceGroup = new AxisServiceGroup(axisConfig);
axisServiceGroup.setServiceGroupClassLoader(axisService.getClassLoader());
axisServiceGroup.setServiceGroupName(axisService.getName());
axisServiceGroup.addService(axisService);
realAxisConfig.addServiceGroup(axisServiceGroup);
alreadyDeployed.add(scriptFile.toURI());
log.info("Deployed script service '" + axisService.getName() + "' for script: " + scriptFile.getName());
}
}
示例2: createMockMessageContext
import org.apache.axis2.description.AxisServiceGroup; //导入方法依赖的package包/类
public static MessageContext createMockMessageContext(String payload) throws AxisFault {
MessageContext inMC = new MessageContext();
SOAPEnvelope envelope = OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
OMDocument omDoc = OMAbstractFactory.getSOAP11Factory().createOMDocument();
omDoc.addChild(envelope);
envelope.getBody().addChild(TestUtils.createOMElement(payload));
inMC.setEnvelope(envelope);
AxisConfiguration axisConfig = new AxisConfiguration();
AxisService as = new AxisService();
as.setName("ScriptService");
AxisServiceGroup asg = new AxisServiceGroup(axisConfig);
asg.addService(as);
as.addParameter(new Parameter("script.js",
"function invoke(inMC, outMC) { outMC.setPayloadXML(" +
payload + ")}"));
ConfigurationContext cfgCtx = new ConfigurationContext(axisConfig);
ServiceGroupContext sgc = cfgCtx.createServiceGroupContext(asg);
inMC.setAxisService(as);
inMC.setServiceContext(sgc.getServiceContext(as));
return inMC;
}
示例3: createServiceGroupForService
import org.apache.axis2.description.AxisServiceGroup; //导入方法依赖的package包/类
private AxisServiceGroup createServiceGroupForService(AxisService svc) throws AxisFault {
AxisServiceGroup svcGroup = new AxisServiceGroup();
svcGroup.setServiceGroupName(svc.getName());
svcGroup.addService(svc);
svcGroup.addParameter(new Parameter(CarbonConstants.PRESERVE_SERVICE_HISTORY_PARAM, "true"));
return svcGroup;
}
示例4: createServiceGroupForService
import org.apache.axis2.description.AxisServiceGroup; //导入方法依赖的package包/类
private AxisServiceGroup createServiceGroupForService(AxisService svc) throws AxisFault {
AxisServiceGroup svcGroup = new AxisServiceGroup();
svcGroup.setServiceGroupName(svc.getName());
svcGroup.addService(svc);
// Checking configured using files param is not a good solution. We must figure out a way to handle this
// at Carbon persistence manager layer.
if (svc.getParameter(CarbonConstants.PRESERVE_SERVICE_HISTORY_PARAM) != null &&
svc.getParameter(BusinessProcessConstants.CONFIGURED_USING_BPEL_PKG_CONFIG_FILES) == null) {
svcGroup.addParameter(new Parameter(CarbonConstants.PRESERVE_SERVICE_HISTORY_PARAM, "true"));
}
return svcGroup;
}
示例5: testFindService
import org.apache.axis2.description.AxisServiceGroup; //导入方法依赖的package包/类
public void testFindService() throws AxisFault {
MessageContext messageContext;
AxisConfiguration ac = new AxisConfiguration();
ConfigurationContext cc = new ConfigurationContext(ac);
AxisService as1 = new AxisService("Service1");
AxisServiceGroup sg = new AxisServiceGroup(ac);
sg.addService(as1);
ServiceGroupContext sgc = cc.createServiceGroupContext(sg);
ServiceContext sc1 = sgc.getServiceContext(as1);
AxisService as2 = new AxisService("Service2");
sg.addService(as2);
ServiceContext sc2 = sgc.getServiceContext(as2);
ac.addService(as1);
ac.addService(as2);
AxisOperation operation1 = new InOnlyAxisOperation(new QName("operation1"));
AxisOperation operation2 = new InOnlyAxisOperation(new QName("operation2"));
as1.addOperation(operation1);
as2.addOperation(operation2);
OperationContext oc1 = sc1.createOperationContext(operation1);
OperationContext oc2 = sc2.createOperationContext(operation2);
cc.registerOperationContext("urn:org.apache.axis2.dispatchers.messageid:123", oc1);
cc.registerOperationContext("urn:org.apache.axis2.dispatchers.messageid:456", oc2);
messageContext = cc.createMessageContext();
messageContext
.addRelatesTo(new RelatesTo("urn:org.apache.axis2.dispatchers.messageid:456"));
RelatesToBasedServiceDispatcher ruisd = new RelatesToBasedServiceDispatcher();
ruisd.invoke(messageContext);
assertEquals(as2, messageContext.getAxisService());
}
示例6: createAxisService
import org.apache.axis2.description.AxisServiceGroup; //导入方法依赖的package包/类
protected AxisService createAxisService(AxisServiceGroup serviceGroup) throws AxisFault {
AxisService service = new AxisService(TEST_SERVICE_NAME);
serviceGroup.addService(service);
return service;
}
示例7: setUp
import org.apache.axis2.description.AxisServiceGroup; //导入方法依赖的package包/类
protected void setUp() throws Exception {
Thread.sleep(3000);
configurationContext1 = ConfigurationContextFactory.createDefaultConfigurationContext();
configurationContext2 = ConfigurationContextFactory.createDefaultConfigurationContext();
clusterManager1 = getClusterManager(configurationContext1);
clusterManager2 = getClusterManager(configurationContext2);
clusterManager1.getStateManager().setConfigurationContext(configurationContext1);
clusterManager2.getStateManager().setConfigurationContext(configurationContext2);
clusterManager1.getNodeManager().setConfigurationContext(configurationContext1);
clusterManager2.getNodeManager().setConfigurationContext(configurationContext2);
//giving both Nodes the same deployment configuration
axisConfiguration1 = configurationContext1.getAxisConfiguration();
serviceGroup1 = new AxisServiceGroup(axisConfiguration1);
service1 = new AxisService(serviceName);
serviceGroup1.addService(service1);
axisConfiguration1.addServiceGroup(serviceGroup1);
axisConfiguration2 = configurationContext2.getAxisConfiguration();
serviceGroup2 = new AxisServiceGroup(axisConfiguration2);
service2 = new AxisService(serviceName);
serviceGroup2.addService(service2);
axisConfiguration2.addServiceGroup(serviceGroup2);
//Initiating ClusterManagers
System.setProperty(ClusteringConstants.LOCAL_IP_ADDRESS, Utils.getIpAddress());
try {
clusterManager1.init();
System.out.println("ClusteringAgent-1 successfully initialized");
System.out.println("*** PLEASE IGNORE THE java.net.ConnectException STACKTRACES. THIS IS EXPECTED ***");
clusterManager2.init();
System.out.println("ClusteringAgent-2 successfully initialized");
} catch (ClusteringFault e) {
String message =
"Could not initialize ClusterManagers. Please check the network connection";
System.out.println(message + ": " + e);
e.printStackTrace();
skipChannelTests = true;
}
}
示例8: addServiceToExistingServiceGroup
import org.apache.axis2.description.AxisServiceGroup; //导入方法依赖的package包/类
/**
* 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);
}
}
示例9: testServiceGroup
import org.apache.axis2.description.AxisServiceGroup; //导入方法依赖的package包/类
public void testServiceGroup() throws AxisFault {
final String SERVICE1 = "serevice1";
final String SERVICE2 = "serevice2";
final String SERVICE4 = "serevice4";
final String SERVICE_GROUP2 = "ServiceGroup2";
config = ConfigurationContextFactory.createEmptyConfigurationContext()
.getAxisConfiguration();
// First create a ServiceGroup with S1 and S4
AxisServiceGroup axisServiceGroup1 = new AxisServiceGroup();
axisServiceGroup1.setServiceGroupName("ServiceGroup1");
AxisService service1 = new AxisService();
service1.setName(SERVICE1);
axisServiceGroup1.addService(service1);
AxisService service4 = new AxisService();
service4.setName(SERVICE4);
axisServiceGroup1.addService(service4);
config.addServiceGroup(axisServiceGroup1);
// Now create another ServiceGroup with S2 and S4
AxisServiceGroup axisServiceGroup2 = new AxisServiceGroup();
axisServiceGroup2.setServiceGroupName(SERVICE_GROUP2);
AxisService service2 = new AxisService();
service2.setName(SERVICE2);
axisServiceGroup2.addService(service2);
AxisService service24 = new AxisService();
service24.setName(SERVICE4);
axisServiceGroup2.addService(service24);
try {
// This should fail!
config.addServiceGroup(axisServiceGroup2);
} catch (AxisFault axisFault) {
// This is expected because S4 was a duplicate name to an already existing service
assertTrue("Caught the wrong fault!", axisFault.getMessage().indexOf(SERVICE4) > -1);
}
AxisService service = config.getService(SERVICE1);
assertNotNull("Service 1 wasn't deployed!", service);
service = config.getService(SERVICE4);
assertNotNull("Service 4 wasn't deployed!", service);
service = config.getService(SERVICE2);
assertNull("Service 2 wasn't supposed to be deployed!", service);
assertNull("ServiceGroup2 wasn't supposed to be deployed!",
config.getServiceGroup("service2"));
}
示例10: testContextListener
import org.apache.axis2.description.AxisServiceGroup; //导入方法依赖的package包/类
/**
* Confirm that creating contexts at various levels correctly causes notifications to
* ContextListeners that are registered on a given ConfigurationContext.
*
* @throws Exception if an error occurs
*/
public void testContextListener() throws Exception {
// Set up metadata
AxisConfiguration axisConfig = new AxisConfiguration();
ConfigurationContext configCtx = new ConfigurationContext(axisConfig);
AxisServiceGroup serviceGroup = new AxisServiceGroup(axisConfig);
AxisService service = new AxisService("TestService");
AxisOperation operation = new InOutAxisOperation(new QName("ns", "op1"));
service.addOperation(operation);
serviceGroup.addService(service);
// Register a listener and make sure it starts out clean
MyListener listener = new MyListener();
configCtx.addContextListener(listener);
assertNull(listener.getLastContext());
MessageContext mc = configCtx.createMessageContext();
assertNotNull(mc);
assertEquals("MessageContext not stored", mc, listener.getLastContext());
ServiceGroupContext sgc = configCtx.createServiceGroupContext(serviceGroup);
assertNotNull(sgc);
assertEquals("ServiceGroupContext not stored", sgc, listener.getLastContext());
ServiceContext sc = sgc.getServiceContext(service);
assertNotNull(sc);
assertEquals("ServiceContext not stored", sc, listener.getLastContext());
OperationContext oc = sc.createOperationContext(operation);
assertNotNull(oc);
assertEquals("OperationContext not stored", oc, listener.getLastContext());
// Try a second listener and make sure they both get notified
MyListener listener2 = new MyListener();
configCtx.addContextListener(listener2);
mc = configCtx.createMessageContext();
assertNotNull(mc);
assertEquals("MessageContext not stored", mc, listener.getLastContext());
assertEquals("MessageContext not stored in listener 2", mc, listener2.getLastContext());
}
示例11: addService
import org.apache.axis2.description.AxisServiceGroup; //导入方法依赖的package包/类
/**
* Add an AxisService to our global configuration. Since services must
* be in ServiceGroups, we construct an anonymous AxisServiceGroup around
* the passed AxisService and then call addServiceGroup().
*
* @param service an AxisService to deploy.
* @throws AxisFault if something goes wrong (invalid service, service is
* already deployed, etc...)
*/
public synchronized void addService(AxisService service) throws AxisFault {
AxisServiceGroup axisServiceGroup = new AxisServiceGroup();
axisServiceGroup.setServiceGroupName(service.getName());
axisServiceGroup.setParent(this);
axisServiceGroup.addService(service);
addServiceGroup(axisServiceGroup);
// processEndpoints(service, service.getAxisConfiguration());
}