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


Java AxisOperation.findOperationContext方法代码示例

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


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

示例1: testMEPfindingOnRelatesTO

import org.apache.axis2.description.AxisOperation; //导入方法依赖的package包/类
public void testMEPfindingOnRelatesTO() throws Exception {

        AxisService axisService = new AxisService("TempSC");
        configContext.getAxisConfiguration().addService(axisService);
        ServiceGroupContext sgc = configContext.createServiceGroupContext(
                axisService.getAxisServiceGroup());
        ServiceContext sessionContext = sgc.getServiceContext(axisService);
        MessageContext messageContext1 = this.getBasicMessageContext();

        messageContext1.setMessageID(UIDGenerator.generateURNString());
        AxisOperation axisOperation = new InOutAxisOperation(new QName("test"));
        OperationContext operationContext1 = axisOperation
                .findOperationContext(messageContext1, sessionContext);
        axisOperation.registerOperationContext(messageContext1, operationContext1);

        MessageContext messageContext2 = this.getBasicMessageContext();
        messageContext2.setMessageID(UIDGenerator.generateURNString());
        messageContext2.getOptions().addRelatesTo(
                new RelatesTo(messageContext1.getMessageID()));
        messageContext2.setAxisOperation(axisOperation);
        OperationContext operationContext2 = axisOperation
                .findOperationContext(messageContext2, sessionContext);
        assertEquals(operationContext1, operationContext2);
    }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:25,代码来源:OperationContextTest.java

示例2: testCheckUsingAdressingOnClient

import org.apache.axis2.description.AxisOperation; //导入方法依赖的package包/类
public void testCheckUsingAdressingOnClient() throws Exception {
    // Need to create full description hierarchy to prevent NullPointerExceptions
    AxisOperation axisOperation = new OutInAxisOperation(new QName("Temp"));
    AxisService axisService = new AxisService("Temp");
    AxisConfiguration axisConfiguration = new AxisConfiguration();
    axisService.addOperation(axisOperation);
    axisConfiguration.addService(axisService);
    ConfigurationContext configurationContext = new ConfigurationContext(axisConfiguration);

    // Make addressing required using the same property as the AddressingConfigurator on the request
    MessageContext request = configurationContext.createMessageContext();
    request.setProperty(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER, AddressingConstants.ADDRESSING_REQUIRED);
    
    // Create a response to invoke the in handler on        
    MessageContext response = configurationContext.createMessageContext();

    // Link the response to the request message context using the context hierarchy
    ServiceGroupContext serviceGroupContext = configurationContext.createServiceGroupContext(axisService.getAxisServiceGroup());
    ServiceContext serviceContext = serviceGroupContext.getServiceContext(axisService);
    OperationContext opContext = axisOperation.findOperationContext(request, serviceContext);
    axisOperation.registerOperationContext(request, opContext);
    request.setServiceContext(serviceContext);
    response.setServiceContext(serviceContext);
    request.setOperationContext(opContext);
    response.setOperationContext(opContext);
    
    // Invoke the in handler for a response message without addressing headers
    response.setEnvelope(TestUtil.getSOAPEnvelope("addressingDisabledTest.xml"));
    inHandler.invoke(response);
    
    // Check an exception is thrown by the validation handler because the client
    // requires addressing but the response message does not have addressing headers
    try {
        validationHandler.invoke(response);
        fail("An AxisFault should have been thrown due to the absence of addressing headers.");
    } catch (AxisFault axisFault) {
        // Confirm this is the correct fault
        assertEquals("Wrong fault code",
                     new QName(Final.FAULT_ADDRESSING_HEADER_REQUIRED),
                     axisFault.getFaultCode());
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:43,代码来源:AddressingValidationHandlerTest.java


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