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


Java ServiceContext.createOperationContext方法代码示例

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


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

示例1: OperationClient

import org.apache.axis2.context.ServiceContext; //导入方法依赖的package包/类
protected OperationClient(AxisOperation axisOp, ServiceContext sc, Options options) {
    this.axisOp = axisOp;
    this.sc = sc;
    this.options = new Options(options);
    completed = false;
    oc = sc.createOperationContext(axisOp);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:8,代码来源:OperationClient.java

示例2: findOperationContext

import org.apache.axis2.context.ServiceContext; //导入方法依赖的package包/类
/**
 * Finds an OperationContext for an incoming message. An incoming message can be of two states.
 * <p/>
 * 1)This is a new incoming message of a given MEP. 2)This message is a part of an MEP which has
 * already begun.
 * <p/>
 * The method is special cased for the two MEPs
 * <p/>
 * #IN_ONLY #IN_OUT
 * <p/>
 * for two reasons. First reason is the wide usage and the second being that the need for the
 * MEPContext to be saved for further incoming messages.
 * <p/>
 * In the event that MEP of this operation is different from the two MEPs defaulted above the
 * decision of creating a new or this message relates to a MEP which already in business is
 * decided by looking at the WSA Relates TO of the incoming message.
 *
 * @param msgContext     MessageContext to search
 * @param serviceContext ServiceContext (TODO - why pass this? (GD))
 * @return the active OperationContext
 */
public OperationContext findOperationContext(MessageContext msgContext,
                                             ServiceContext serviceContext)
        throws AxisFault {
    OperationContext operationContext;

    if (null == msgContext.getRelatesTo()) {

        // Its a new incoming message so get the factory to create a new
        // one
        operationContext = serviceContext.createOperationContext(this);
    } else {

        // So this message is part of an ongoing MEP
        ConfigurationContext configContext = msgContext.getConfigurationContext();

        operationContext =
                configContext.getOperationContext(msgContext.getRelatesTo().getValue());

        if (null == operationContext) {
            throw new AxisFault(Messages.getMessage("cannotCorrelateMsg",
                                                    this.name.toString(),
                                                    msgContext.getRelatesTo().getValue()));
        }
    }
    return operationContext;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:48,代码来源:AxisOperation.java

示例3: testFindService

import org.apache.axis2.context.ServiceContext; //导入方法依赖的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());
    }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:41,代码来源:RelatesToBasedServiceDispatcherTest.java

示例4: testFindOperation

import org.apache.axis2.context.ServiceContext; //导入方法依赖的package包/类
public void testFindOperation() throws AxisFault {

        MessageContext messageContext;
        AxisService as1 = new AxisService("Service1");
        AxisConfiguration ac = new AxisConfiguration();
        ac.addService(as1);

        AxisOperation operation1 = new InOnlyAxisOperation(new QName("operation1"));
        AxisOperation operation2 = new InOnlyAxisOperation(new QName("operation2"));
        as1.addOperation(operation1);
        as1.addOperation(operation2);

        ConfigurationContext cc = new ConfigurationContext(ac);
        ServiceGroupContext sgc = cc.createServiceGroupContext(as1.getAxisServiceGroup());
        ServiceContext serviceContext = sgc.getServiceContext(as1);
        OperationContext oc1 = serviceContext.createOperationContext(operation1);
        OperationContext oc2 = serviceContext.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"));
        messageContext.setAxisService(as1);

        RelatesToBasedOperationDispatcher ruisd = new RelatesToBasedOperationDispatcher();
        ruisd.invoke(messageContext);

        assertEquals(operation2, messageContext.getAxisOperation());
    }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:30,代码来源:RelatesToBasedOperationDispatcherTest.java

示例5: setUp

import org.apache.axis2.context.ServiceContext; //导入方法依赖的package包/类
protected void setUp() throws Exception {

        AxisConfiguration engineRegistry = new AxisConfiguration();
        configContext = new ConfigurationContext(engineRegistry);

        TransportOutDescription transport = new TransportOutDescription("null");
        transport.setSender(new CommonsHTTPTransportSender());

        TransportInDescription transportIn = new TransportInDescription("null");
        AxisOperation axisOp = new InOutAxisOperation(operationName);

        AxisService service = new AxisService(serviceName.getLocalPart());
        axisOp.setMessageReceiver(new MessageReceiver() {
            public void receive(MessageContext messageCtx) throws AxisFault {
                // TODO Auto-generated method stub

            }
        });
        engineRegistry.addService(service);
        service.addOperation(axisOp);

        mc = configContext.createMessageContext();
        mc.setTransportIn(transportIn);
        mc.setTransportOut(transport);

        ServiceGroupContext sgc = configContext.createServiceGroupContext(
                service.getAxisServiceGroup());
        ServiceContext sc = sgc.getServiceContext(service);

        OperationContext opContext = sc.createOperationContext(axisOp);

        mc.setOperationContext(opContext);
        mc.setTransportOut(transport);
        mc.setProperty(MessageContext.TRANSPORT_OUT, System.out);
        mc.setServerSide(true);
        SOAPFactory omFac = OMAbstractFactory.getSOAP11Factory();
        mc.setEnvelope(omFac.getDefaultEnvelope());


        mc.setWSAAction(operationName.getLocalPart());
        mc.setSoapAction(operationName.getLocalPart());
        System.out.flush();
    }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:44,代码来源:EngineWithoutPhaseResolvingTest.java


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