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


Java AxisConfiguration.addService方法代码示例

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


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

示例1: createAnonymousService

import org.apache.axis2.engine.AxisConfiguration; //导入方法依赖的package包/类
private static AxisService createAnonymousService(AxisConfiguration axisCfg, String serviceKey) {
    try {
        OutOnlyAxisOperation outOnlyOperation = new OutOnlyAxisOperation(ServiceClient.ANON_OUT_ONLY_OP);
        OutInAxisOperation outInOperation = new OutInAxisOperation(ServiceClient.ANON_OUT_IN_OP);

        AxisService axisAnonymousService = new AxisService(serviceKey);
        axisAnonymousService.addOperation(outOnlyOperation);
        axisAnonymousService.addOperation(outInOperation);

        // set a right default action *after* operations have been added to the service.
        outOnlyOperation.setSoapAction("");
        outInOperation.setSoapAction("");

        if (log.isDebugEnabled()) {
            log.debug("Creating Client Service: " + serviceKey);
        }
        axisAnonymousService.setClientSide(true);

        axisCfg.addService(axisAnonymousService);

        return axisAnonymousService;
    } catch (AxisFault axisFault) {
        handleException("Adding service to axis configuration failed.", axisFault);
    }
    return null;
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:27,代码来源:AnonymousServiceFactory.java

示例2: testVersion

import org.apache.axis2.engine.AxisConfiguration; //导入方法依赖的package包/类
public void testVersion() {
    XMLUnit.setIgnoreWhitespace(true);
    File testResourceFile = new File(wsdlLocation);
    try {
        WSDL11ToAllAxisServicesBuilder builder = new WSDL11ToAllAxisServicesBuilder(
                new FileInputStream(testResourceFile));
        AxisService axisService = builder.populateService();
        ConfigurationContext configContext = ConfigurationContextFactory.createDefaultConfigurationContext();
        AxisConfiguration axisConfig = configContext.getAxisConfiguration();
        axisConfig.addService(axisService);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        axisService.printWSDL(baos);
        assertXMLEqual(new FileReader(testResourceFile), new StringReader(new String(baos.toByteArray())));
    } catch (Exception e) {
        System.out.println("Error in WSDL : " + testResourceFile.getName());
        System.out.println("Exception: " + e.toString());
        fail("Caught exception " + e.toString());
    } finally {
        XMLUnit.setIgnoreWhitespace(false);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:22,代码来源:WSDL11ToAxisServiceBuilderTest.java

示例3: testFindService

import org.apache.axis2.engine.AxisConfiguration; //导入方法依赖的package包/类
public void testFindService() throws AxisFault {
    MessageContext messageContext;
    AxisService as1 = new AxisService("Service1");
    AxisService as2 = new AxisService("Service2");
    ConfigurationContext cc = ConfigurationContextFactory.createEmptyConfigurationContext();
    AxisConfiguration ac = cc.getAxisConfiguration();
    ac.addService(as1);
    ac.addService(as2);
    messageContext = cc.createMessageContext();

    SOAPEnvelope se = OMAbstractFactory.getSOAP11Factory().createSOAPEnvelope();
    SOAPBody sb = OMAbstractFactory.getSOAP11Factory().createSOAPBody(se);
    sb.addChild(OMAbstractFactory.getSOAP11Factory().createOMElement("operation2",
                                                                     "http://127.0.0.1:8080/axis2/services/Service2",
                                                                     "pfx"));
    messageContext.setEnvelope(se);


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

    assertEquals(as2, messageContext.getAxisService());
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:24,代码来源:SOAPMessageBodyBasedServiceDispatcherTest.java

示例4: testFindServiceWithExtraName

import org.apache.axis2.engine.AxisConfiguration; //导入方法依赖的package包/类
/**
 * Test that with extra name information, an axis service can be found even if the 
 * AxisService names don't match
 * @throws AxisFault 
 */
public void testFindServiceWithExtraName() throws AxisFault {
    AxisConfiguration axisCfg = new AxisConfiguration();

    AxisService svc1 = new AxisService();
    QName svc1QN = new QName("http://service.name/space/1", "service1");
    String portName = "port1";
    setupAxisService(svc1, svc1QN, portName);
    axisCfg.addService(svc1);
    
    String extraName = ActivateUtils.getAxisServiceExternalizeExtraName(svc1);
    AxisService foundService = ActivateUtils.findService(axisCfg, AxisService.class.getName(), 
            generateAxisServiceName(svc1QN, portName + "_NoMatch"), extraName);
    assertSame("Did not find expected AxisService using null extraName", svc1, foundService);
    
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:21,代码来源:ActivateUtilsTest.java

示例5: testFindServiceWithNoParametersFound

import org.apache.axis2.engine.AxisConfiguration; //导入方法依赖的package包/类
/**
 * Test that with extra name information but no Parameters on the AxisService that the  
 * service is found. 
 * @throws AxisFault 
 */
public void testFindServiceWithNoParametersFound() throws AxisFault {
    AxisConfiguration axisCfg = new AxisConfiguration();

    AxisService svc1 = new AxisService();
    QName svc1QN = new QName("http://service.name/space/1", "service1");
    String portName = "port1";
    // We don't use the setup method since we do not want the parameters set on this
    // service
    // setupAxisService(svc1, svc1QN, portName);
    svc1.setName(generateAxisServiceName(svc1QN, portName));
    axisCfg.addService(svc1);
    
    String extraName = ActivateUtils.getAxisServiceExternalizeExtraName(svc1) + "_NoMatch";
    AxisService foundService = ActivateUtils.findService(axisCfg, AxisService.class.getName(), 
            generateAxisServiceName(svc1QN, portName), extraName);
    assertSame("Should have found matching service without matching extraname", svc1, foundService);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:23,代码来源:ActivateUtilsTest.java

示例6: createAdressedEnabledClientSide

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

    AxisConfiguration axisConfiguration = configContext.getAxisConfiguration();
    axisConfiguration.addModule(axisModule);
    axisConfiguration.addService(service);
    ServiceGroupContext serviceGroupContext =
            configContext.createServiceGroupContext((AxisServiceGroup) service.getParent());
    return serviceGroupContext.getServiceContext(service);
}
 
开发者ID:wso2,项目名称:carbon-data,代码行数:18,代码来源:UtilServer.java

示例7: testFindOperation

import org.apache.axis2.engine.AxisConfiguration; //导入方法依赖的package包/类
public void testFindOperation() throws AxisFault {
    MessageContext messageContext;
    AxisService as1 = new AxisService("Service1");


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

    ConfigurationContext cc = ConfigurationContextFactory.createEmptyConfigurationContext();
    AxisConfiguration ac = cc.getAxisConfiguration();
    ac.addService(as1);
    messageContext = cc.createMessageContext();

    messageContext.setAxisService(as1);

    SOAPEnvelope se = OMAbstractFactory.getSOAP11Factory().createSOAPEnvelope();
    SOAPBody sb = OMAbstractFactory.getSOAP11Factory().createSOAPBody(se);
    sb.addChild(OMAbstractFactory.getSOAP11Factory().createOMElement("operation2",
                                                                     "http://test", "pfx"));
    messageContext.setEnvelope(se);


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

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

示例8: testFindService

import org.apache.axis2.engine.AxisConfiguration; //导入方法依赖的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

示例9: testFindOperation

import org.apache.axis2.engine.AxisConfiguration; //导入方法依赖的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

示例10: testFindServiceNoExtraNameFound

import org.apache.axis2.engine.AxisConfiguration; //导入方法依赖的package包/类
/**
 * Try to find an AxisService in which the name matches and extraName is null.  This simulates
 * deserializaing and activating an older version a MessageContext in which the extraName
 * on the AxisService was not specified. 
 * @throws AxisFault 
 */
public void testFindServiceNoExtraNameFound() throws AxisFault {
    AxisConfiguration axisCfg = new AxisConfiguration();

    AxisService svc1 = new AxisService();
    QName svc1QN = new QName("http://service.name/space/1", "service1");
    String portName = "port1";
    setupAxisService(svc1, svc1QN, portName);
    axisCfg.addService(svc1);
    
    AxisService foundService = ActivateUtils.findService(axisCfg, AxisService.class.getName(), 
            generateAxisServiceName(svc1QN, portName), null);
    assertSame("Did not find expected AxisService using null extraName", svc1, foundService);
    
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:21,代码来源:ActivateUtilsTest.java

示例11: testFindServiceNoExtraNameNotFound

import org.apache.axis2.engine.AxisConfiguration; //导入方法依赖的package包/类
/**
 * Test that with no extra name information, an axis service can not be found if the names
 * don't match
 * @throws AxisFault 
 */
public void testFindServiceNoExtraNameNotFound() throws AxisFault {
    AxisConfiguration axisCfg = new AxisConfiguration();

    AxisService svc1 = new AxisService();
    QName svc1QN = new QName("http://service.name/space/1", "service1");
    String portName = "port1";
    setupAxisService(svc1, svc1QN, portName);
    axisCfg.addService(svc1);
    
    AxisService foundService = ActivateUtils.findService(axisCfg, AxisService.class.getName(), 
            generateAxisServiceName(svc1QN, portName + "_NoMatch"), null);
    assertNull("Should not have found a matching AxisService", foundService);
    
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:20,代码来源:ActivateUtilsTest.java

示例12: testFindServiceWithExtraNameMistmatchNotFound

import org.apache.axis2.engine.AxisConfiguration; //导入方法依赖的package包/类
/**
 * Test that with extra name information that does not match the service, an axis service 
 * is not found even if the service names DO match.  This test makes sure an AxisService that 
 * happens to have the same name as a previously serialized one BUT is actually different since
 * the Service QNames and Port Names are different is not found.
 * @throws AxisFault 
 */
public void testFindServiceWithExtraNameMistmatchNotFound() throws AxisFault {
    AxisConfiguration axisCfg = new AxisConfiguration();

    AxisService svc1 = new AxisService();
    QName svc1QN = new QName("http://service.name/space/1", "service1");
    String portName = "port1";
    setupAxisService(svc1, svc1QN, portName);
    axisCfg.addService(svc1);
    
    String extraName = ActivateUtils.getAxisServiceExternalizeExtraName(svc1) + "_NoMatch";
    AxisService foundService = ActivateUtils.findService(axisCfg, AxisService.class.getName(), 
            generateAxisServiceName(svc1QN, portName), extraName);
    assertNull("Should not have found matching service without matching extraname", foundService);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:22,代码来源:ActivateUtilsTest.java

示例13: setUp

import org.apache.axis2.engine.AxisConfiguration; //导入方法依赖的package包/类
protected void setUp() throws Exception {
    axisOperation = new InOutAxisOperation(new QName("Temp"));
    axisMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
    axisService = new AxisService("Temp");
    axisConfiguration = new AxisConfiguration();
    axisService.addOperation(axisOperation);
    axisConfiguration.addService(axisService);
    configurationContext = new ConfigurationContext(axisConfiguration);
    msgctx = configurationContext.createMessageContext();
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:11,代码来源:ContextHierarchyTest.java

示例14: testCheckUsingAdressingOnClient

import org.apache.axis2.engine.AxisConfiguration; //导入方法依赖的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

示例15: createMessageContext

import org.apache.axis2.engine.AxisConfiguration; //导入方法依赖的package包/类
private MessageContext createMessageContext(SOAPFactory soapFactory) {
    MessageContext messageContext = null;
    AxisService as1 = new AxisService("Service1");
    ConfigurationContext cc = null;
    try {
        cc = ConfigurationContextFactory.createEmptyConfigurationContext();
        AxisConfiguration ac = cc.getAxisConfiguration();
        ac.addService(as1);
        messageContext = cc.createMessageContext();
        messageContext.setAxisService(as1);

        SOAPEnvelope se = soapFactory.createSOAPEnvelope();

        SOAPHeader sh = soapFactory.createSOAPHeader(se);

        SOAPHeaderBlock shb1 = sh.addHeaderBlock(header_ultimateReceiver, 
                                                 omFactory.createOMNamespace(namespace, header_ultimateReceiver));
        // Since no role was set on the shb1, default is ultimate receiver
        shb1.setMustUnderstand(true);
        
        SOAPHeaderBlock shb2 = sh.addHeaderBlock(header_rolePlayed, 
                                                 omFactory.createOMNamespace(namespace, header_rolePlayed));
        shb2.setRole(rolePlayed1);
        shb2.setMustUnderstand(true);
        
        SOAPHeaderBlock shb3 = sh.addHeaderBlock(header_roleNotPlayed, 
                                                 omFactory.createOMNamespace(namespace, header_roleNotPlayed));
        shb3.setRole(roleNotPlayed);
        shb3.setMustUnderstand(true);
        
        SOAPHeaderBlock shb4 = sh.addHeaderBlock(header_bindingAdded,
                                                 omFactory.createOMNamespace(namespace, header_bindingAdded));
        shb4.setRole(roleBindingAdded);
        shb4.setMustUnderstand(true);
        
        // This header is destined for the ulmiate receiver, but it is already processed
        // so it shouldn't cause mustUnderstand fault
        SOAPHeaderBlock shb5 = sh.addHeaderBlock(header_ultimateReceiver_processed,
                                                 omFactory.createOMNamespace(namespace, header_ultimateReceiver_processed));
        // Since no role was set on the shb1, default is ultimate receiver
        shb5.setMustUnderstand(true);
        shb5.setProcessed();
        
        // Header targeted for SOAP11 role of Next, not set to MustUnderstand
        SOAPHeaderBlock shb6 = sh.addHeaderBlock(header_SoapNext,
                                                 omFactory.createOMNamespace(soap11Namespace, header_SoapNext));
        shb6.setRole(roleSoap11Next);

        messageContext.setEnvelope(se);
    } catch (AxisFault e) {
        fail("Caught unexpected exception creating message context" + e);
    }
    return messageContext;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:55,代码来源:RoleBasedMustUndertandTests.java


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