当前位置: 首页>>代码示例>>Java>>正文


Java ServiceContext类代码示例

本文整理汇总了Java中org.apache.axis2.context.ServiceContext的典型用法代码示例。如果您正苦于以下问题:Java ServiceContext类的具体用法?Java ServiceContext怎么用?Java ServiceContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ServiceContext类属于org.apache.axis2.context包,在下文中一共展示了ServiceContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: greet

import org.apache.axis2.context.ServiceContext; //导入依赖的package包/类
public String greet(String name) {
    ServiceContext serviceContext =
            MessageContext.getCurrentMessageContext().getServiceContext();
    serviceContext.setProperty(HELLO_SERVICE_NAME, name);
    try {
        Replicator.replicate(serviceContext, new String[]{HELLO_SERVICE_NAME});
    } catch (ClusteringFault clusteringFault) {
        clusteringFault.printStackTrace();
    }

    if (name != null) {
        return "Hello World, " + name + " !!!";
    } else {
        return "Hello World !!!";
    }
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:17,代码来源:HelloService.java

示例2: getOperationClient

import org.apache.axis2.context.ServiceContext; //导入依赖的package包/类
private static OperationClient getOperationClient(MessageContext partnerMessageContext,
                                                  ConfigurationContext clientConfigCtx)
        throws AxisFault {

    AxisService anonymousService =
            AnonymousServiceFactory.getAnonymousService(Constants.registrationService,
                    Constants.REGISTRATION_PORT,
                    clientConfigCtx.getAxisConfiguration(), Constants.HUMANTASK_COORDINATION_MODULE_NAME);

    anonymousService.getParent().addParameter("hiddenService", "true");
    ServiceGroupContext sgc = new ServiceGroupContext(clientConfigCtx, (AxisServiceGroup) anonymousService.getParent());
    ServiceContext serviceCtx = sgc.getServiceContext(anonymousService);

    AxisOperation axisAnonymousOperation = anonymousService.getOperation(ServiceClient.ANON_OUT_IN_OP);

    Options clientOptions = cloneOptions(partnerMessageContext.getOptions());
    clientOptions.setExceptionToBeThrownOnSOAPFault(false);
    /* This value doesn't overrideend point config. */
    clientOptions.setTimeOutInMilliSeconds(60000);

    return axisAnonymousOperation.createClient(serviceCtx, clientOptions);
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:23,代码来源:ServiceUtils.java

示例3: getOperationClient

import org.apache.axis2.context.ServiceContext; //导入依赖的package包/类
private static OperationClient getOperationClient(ServiceInvocationContext partnerMessageContext,
                                                  ConfigurationContext clientConfigCtx)
        throws AxisFault {
    AxisService anonymousService =
            AnonymousServiceFactory.getAnonymousService(partnerMessageContext.getService(),
                    partnerMessageContext.getPort(),
                    clientConfigCtx.getAxisConfiguration(), partnerMessageContext.getCaller());
    anonymousService.engageModule(clientConfigCtx.getAxisConfiguration().getModule("UEPModule"));
    anonymousService.getParent().addParameter(
            "hiddenService", "true");
    ServiceGroupContext sgc = new ServiceGroupContext(
            clientConfigCtx, (AxisServiceGroup) anonymousService.getParent());
    ServiceContext serviceCtx = sgc.getServiceContext(anonymousService);

    // get a reference to the DYNAMIC operation of the Anonymous Axis2 service
    AxisOperation axisAnonymousOperation = anonymousService.getOperation(
            partnerMessageContext.isTwoWay() ? ServiceClient.ANON_OUT_IN_OP :
                    ServiceClient.ANON_OUT_ONLY_OP);

    Options clientOptions = cloneOptions(partnerMessageContext.getInMessageContext().getOptions());
    clientOptions.setExceptionToBeThrownOnSOAPFault(false);
    /* This value doesn't overrideend point config. */
    clientOptions.setTimeOutInMilliSeconds(60000);

    return axisAnonymousOperation.createClient(serviceCtx, clientOptions);
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:27,代码来源:AxisServiceUtils.java

示例4: getOperationClient

import org.apache.axis2.context.ServiceContext; //导入依赖的package包/类
public static OperationClient getOperationClient(BPELMessageContext partnerMessageContext,
                                                 ConfigurationContext clientConfigCtx)
        throws AxisFault {
    AxisService anonymousService =
            AnonymousServiceFactory.getAnonymousService(partnerMessageContext.getService(),
                    partnerMessageContext.getPort(),
                    clientConfigCtx.getAxisConfiguration(), partnerMessageContext.getCaller());
    anonymousService.engageModule(clientConfigCtx.getAxisConfiguration().getModule("UEPModule"));
    anonymousService.getParent().addParameter(
            BPELConstants.HIDDEN_SERVICE_PARAM, "true");
    ServiceGroupContext sgc = new ServiceGroupContext(
            clientConfigCtx, (AxisServiceGroup) anonymousService.getParent());
    ServiceContext serviceCtx = sgc.getServiceContext(anonymousService);

    // get a reference to the DYNAMIC operation of the Anonymous Axis2 service
    AxisOperation axisAnonymousOperation = anonymousService.getOperation(
            partnerMessageContext.isTwoWay() ? ServiceClient.ANON_OUT_IN_OP :
                    ServiceClient.ANON_OUT_ONLY_OP);

    Options clientOptions = cloneOptions(partnerMessageContext.getInMessageContext().getOptions());
    clientOptions.setExceptionToBeThrownOnSOAPFault(false);
    /* This value doesn't overrideend point config. */
    clientOptions.setTimeOutInMilliSeconds(60000);

    return axisAnonymousOperation.createClient(serviceCtx, clientOptions);
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:27,代码来源:AxisServiceUtils.java

示例5: login

import org.apache.axis2.context.ServiceContext; //导入依赖的package包/类
public String login(String userName, String password, String host)
        throws LoginAuthenticationExceptionException, RemoteException {
    Boolean loginStatus;
    ServiceContext serviceContext;
    String sessionCookie;
    loginStatus = authenticationAdminStub.login(userName, password, host);
    if (!loginStatus) {
        throw new LoginAuthenticationExceptionException("Login Unsuccessful. Return false as a login status by Server");
    }
    log.info("Login Successful");
    serviceContext = authenticationAdminStub._getServiceClient().getLastOperationContext().getServiceContext();
    sessionCookie = (String) serviceContext.getProperty(HTTPConstants.COOKIE_STRING);
    if (log.isDebugEnabled()) {
        log.debug("SessionCookie :" + sessionCookie);
    }
    return sessionCookie;
}
 
开发者ID:wso2,项目名称:carbon-platform-integration-utils,代码行数:18,代码来源:AuthenticatorClient.java

示例6: createAdressedEnabledClientSide

import org.apache.axis2.context.ServiceContext; //导入依赖的package包/类
public static ServiceContext createAdressedEnabledClientSide(
        AxisService service) throws AxisFault {
    File file = getAddressingMARFile();
    TestCase.assertTrue(file.exists());
    ConfigurationContext configContext = ConfigurationContextFactory
            .createConfigurationContextFromFileSystem(
                    TestingUtils.prefixBaseDirectory("target/test-resources/integrationRepo"), null);
    AxisModule axisModule = DeploymentEngine.buildModule(file,
                                                         configContext.getAxisConfiguration());
    configContext.getAxisConfiguration().addModule(axisModule);

    configContext.getAxisConfiguration().addService(service);


    ServiceGroupContext serviceGroupContext =
            configContext.createServiceGroupContext(service.getAxisServiceGroup());
    return serviceGroupContext.getServiceContext(service);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:19,代码来源:UtilServer.java

示例7: invoke

import org.apache.axis2.context.ServiceContext; //导入依赖的package包/类
public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
    String title = "TempHandler[" + getHandlerID() + "]:invoke(): ";

    // get the service context from the message context
    ServiceContext serviceContext = msgContext.getServiceContext();

    if (serviceContext == null) {
        // get the service context from the operation context
        OperationContext operationContext = msgContext.getOperationContext();
        serviceContext = operationContext.getServiceContext();
    }

    if (serviceContext != null) {
        for (int j = 0; j < numberProperties; j++) {
            count++;
            String key = new String(propertyKey + ".ID[" + getHandlerID() + "]." + count);
            String value = new String(propertyValue + "[" + count + "]");
            serviceContext.setProperty(key, value);
        }
    }

    log.debug(title + "executedHandlers.add(" + handlerID + ")");
    executedHandlers.add(handlerID);

    return InvocationResponse.CONTINUE;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:27,代码来源:MessageContextSaveCTest.java

示例8: getServiceProperties

import org.apache.axis2.context.ServiceContext; //导入依赖的package包/类
private Map getServiceProperties(MessageContext mc) {
    Map properties = null;

    // get the service context from the message context
    ServiceContext serviceContext = mc.getServiceContext();

    if (serviceContext == null) {
        // get the service context from the operation context
        OperationContext operationContext = mc.getOperationContext();
        serviceContext = operationContext.getServiceContext();
    }

    if (serviceContext != null) {
        properties = serviceContext.getProperties();
    }

    return properties;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:19,代码来源:MessageContextSaveBTest.java

示例9: addServiceProperties

import org.apache.axis2.context.ServiceContext; //导入依赖的package包/类
private void addServiceProperties(MessageContext mc, String suffix) {
    // get the service context from the message context
    ServiceContext serviceContext = mc.getServiceContext();

    if (serviceContext == null) {
        // get the service context from the operation context
        OperationContext operationContext = mc.getOperationContext();
        serviceContext = operationContext.getServiceContext();
    }

    if (serviceContext != null) {
        for (int k = 0; k < serviceKeys.length; k++) {
            String key = serviceKeys[k];
            String value = serviceValues[k] + suffix;

            serviceContext.setProperty(key, value);
        }
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:20,代码来源:MessageContextSaveBTest.java

示例10: getRequestCount

import org.apache.axis2.context.ServiceContext; //导入依赖的package包/类
public OMElement getRequestCount(OMElement oe) {
	MessageContext msg = MessageContext.getCurrentMessageContext();
	
	Integer requestCount = (Integer)msg.getProperty(REQUEST_COUNT);
	if (requestCount == null) {
		requestCount = new Integer(1);
	} else {
		requestCount = new Integer(requestCount.intValue() + 1);
	}
       ServiceContext sgc = msg.getServiceContext();
	sgc.setProperty(REQUEST_COUNT, requestCount);
	
	QName qn = new QName("http://ws.apache.org/axis2/namespaces/", "RequestCount","axis2");
	OMElement response = OMAbstractFactory.getOMFactory().createOMElement(qn);
	response.setText(requestCount.toString());
	
	return response;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:19,代码来源:RequestCounter.java

示例11: processviewServiceContext

import org.apache.axis2.context.ServiceContext; //导入依赖的package包/类
public void processviewServiceContext(HttpServletRequest req, HttpServletResponse res)
        throws IOException, ServletException {
    String type = req.getParameter("TYPE");
    String sgID = req.getParameter("PID");
    String ID = req.getParameter("ID");
    ServiceGroupContext sgContext = configContext.getServiceGroupContext(sgID);
    if (sgContext != null) {
        AxisService service = sgContext.getDescription().getService(ID);
        ServiceContext serviceContext = sgContext.getServiceContext(service);
        req.setAttribute("ServiceContext",serviceContext);
        req.setAttribute("TYPE",type);
    } else {
        req.setAttribute("ServiceContext",null);
        req.setAttribute("TYPE",type);
    }
    renderView("viewServiceContext.jsp", req, res);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:18,代码来源:AdminAgent.java

示例12: toUpdateContextCommand

import org.apache.axis2.context.ServiceContext; //导入依赖的package包/类
private static UpdateStateCommand toUpdateContextCommand(AbstractContext context) {
    UpdateStateCommand cmd = null;
    if (context instanceof ConfigurationContext) {
        cmd = new UpdateConfigurationStateCommand();
    } else if (context instanceof ServiceGroupContext) {
        ServiceGroupContext sgCtx = (ServiceGroupContext) context;
        cmd = new UpdateServiceGroupStateCommand();
        UpdateServiceGroupStateCommand updateSgCmd = (UpdateServiceGroupStateCommand) cmd;
        updateSgCmd.setServiceGroupName(sgCtx.getDescription().getServiceGroupName());
        updateSgCmd.setServiceGroupContextId(sgCtx.getId());
    } else if (context instanceof ServiceContext) {
        ServiceContext serviceCtx = (ServiceContext) context;
        cmd = new UpdateServiceStateCommand();
        UpdateServiceStateCommand updateServiceCmd = (UpdateServiceStateCommand) cmd;
        String sgName =
                serviceCtx.getServiceGroupContext().getDescription().getServiceGroupName();
        updateServiceCmd.setServiceGroupName(sgName);
        updateServiceCmd.setServiceGroupContextId(serviceCtx.getServiceGroupContext().getId());
        updateServiceCmd.setServiceName(serviceCtx.getAxisService().getName());
    }
    return cmd;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:23,代码来源:StateClusteringCommandFactory.java

示例13: create

import org.apache.axis2.context.ServiceContext; //导入依赖的package包/类
/**
 * Create and add a listener
 * @param sc ServiceContext
 */
public static void create(ServiceContext sc) {
    if(log.isDebugEnabled()){
        log.debug("Start ProviderOMContextListener.create(ServiceContext)");
    }
    if (sc == null || 
        sc.getAxisService() == null ||
        sc.getAxisService().
        hasMessageContextListener(ProviderOMContextListener.class)){
        if(log.isDebugEnabled()){
            log.debug("ProviderOMContextListener already installed on AxisService");
        }
        return;
    }
    ProviderOMContextListener listener = new ProviderOMContextListener();
    sc.getAxisService().addMessageContextListener(listener);
    if(log.isDebugEnabled()){
        log.debug("End ProviderOMContextListener.create(ServiceContext)");
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:24,代码来源:ProviderOMContextListener.java

示例14: installParserInputStreamCustomBuilder

import org.apache.axis2.context.ServiceContext; //导入依赖的package包/类
/**
 * Attach the ParserInputStreamCustomBuilder on the Axiom builder.
 * This will create ParserInputStreamCustomBuilder and register it with StAXOMBuilder which will 
 * use ByteArrayCustomBuilder to create byteArray backed OM.
 * @param sc
 * @param mc
 */
private void installParserInputStreamCustomBuilder(ServiceContext sc, MessageContext mc) {
    if (log.isDebugEnabled()) {
        log.debug("attachEvent for sc= " + sc.getName() + "and  mc=" + mc.getLogCorrelationID());
    }

    // Make sure the MessageContext has a SOAPEnvelope and Builder
    SOAPEnvelope envelope = mc.getEnvelope();

    if (envelope == null) {
        return;
    }
    if (!(envelope.getBuilder() instanceof StAXOMBuilder)) {
        return;
    }

    AxisOperation axisOp = mc.getAxisOperation();
    if (axisOp == null) {
        return;
    }

    ParserInputStreamCustomBuilder pacb = new ParserInputStreamCustomBuilder(null);
    ((StAXOMBuilder) envelope.getBuilder()).registerCustomBuilderForPayload(pacb);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:31,代码来源:ProviderOMContextListener.java

示例15: createAndFillContexts

import org.apache.axis2.context.ServiceContext; //导入依赖的package包/类
private void createAndFillContexts(AxisService service,
                                   MessageContext msgContext,
                                   SessionContext sessionContext) throws AxisFault {
    ServiceGroupContext serviceGroupContext;
    AxisServiceGroup axisServiceGroup = service.getAxisServiceGroup();
    ConfigurationContext configCtx = msgContext.getConfigurationContext();
    serviceGroupContext = configCtx.createServiceGroupContext(axisServiceGroup);

    msgContext.setServiceGroupContext(serviceGroupContext);
    ServiceContext serviceContext = serviceGroupContext.getServiceContext(service);
    msgContext.setServiceContext(serviceContext);
    if (sessionContext != null) {
        sessionContext.addServiceContext(serviceContext);
        sessionContext.addServiceGroupContext(serviceGroupContext);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:17,代码来源:DispatchPhase.java


注:本文中的org.apache.axis2.context.ServiceContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。