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


Java SOAP12Constants类代码示例

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


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

示例1: getResponse

import org.apache.axiom.soap.SOAP12Constants; //导入依赖的package包/类
private SOAPEnvelope getResponse(SOAPEnvelope inEnvelope) throws AxisFault {
    ConfigurationContext confctx = ConfigurationContextFactory.
            createConfigurationContextFromFileSystem(TestingUtils.prefixBaseDirectory("target/test-resources/integrationRepo"),
                                                     null);
    ServiceClient client = new ServiceClient(confctx, null);
    Options options = new Options();
    client.setOptions(options);
    options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
    options.setTo(targetEPR);
    options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
    options.setExceptionToBeThrownOnSOAPFault(false);
    MessageContext msgctx = new MessageContext();
    msgctx.setEnvelope(inEnvelope);
    OperationClient opClient = client.createClient(ServiceClient.ANON_OUT_IN_OP);
    opClient.addMessageContext(msgctx);
    opClient.execute(true);
    return opClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE).getEnvelope();
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:19,代码来源:FaultHandlingTest.java

示例2: createDefaultSOAPEnvelope

import org.apache.axiom.soap.SOAP12Constants; //导入依赖的package包/类
private SOAPEnvelope createDefaultSOAPEnvelope(MessageContext inMsgCtx) {

        String soapNamespace = inMsgCtx.getEnvelope().getNamespace()
                .getNamespaceURI();
        SOAPFactory soapFactory = null;
        if (soapNamespace.equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
            soapFactory = OMAbstractFactory.getSOAP11Factory();
        } else if (soapNamespace
                .equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
            soapFactory = OMAbstractFactory.getSOAP12Factory();
        } else {
            log.error("Unknown SOAP Envelope");
        }
        if (soapFactory != null) {
            return soapFactory.getDefaultEnvelope();
        }

        return null;
    }
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:20,代码来源:WSXACMLMessageReceiver.java

示例3: getOptions

import org.apache.axiom.soap.SOAP12Constants; //导入依赖的package包/类
protected Options getOptions(String action, boolean enableMTOM, String url) {
		Options options = new Options();
		options.setAction(action);		
	    options.setProperty(WSDL2Constants.ATTRIBUTE_MUST_UNDERSTAND,"1");
	    options.setTo( new EndpointReference(url) );
		options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
//		try {
//			String from = InetAddress.getLocalHost().getHostAddress();	
//			options.setFrom(new EndpointReference(from));
//		}catch(UnknownHostException e) {
//			//ignore From
//		}
		if (enableMTOM)
			options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
		else
			options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_FALSE);
		//use SOAP12, 
		options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
		return options;
	}
 
开发者ID:jembi,项目名称:openxds,代码行数:21,代码来源:XdsTest.java

示例4: testEchoXMLSync

import org.apache.axiom.soap.SOAP12Constants; //导入依赖的package包/类
public void testEchoXMLSync() throws Exception {

        OMElement payload = TestingUtils.createDummyOMElement();
        Options options = new Options();
        options.setTo(targetEPR);
        options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);

        ConfigurationContext configContext =
                ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
        ServiceClient sender = new ServiceClient(configContext, null);
        sender.setOptions(options);

        OMElement result = sender.sendReceive(payload);

        TestingUtils.compareWithCreatedOMElement(result);
    }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:18,代码来源:EchoRawXMLTest.java

示例5: testLocalEchoXMLSync

import org.apache.axiom.soap.SOAP12Constants; //导入依赖的package包/类
public void testLocalEchoXMLSync() throws Exception {
    OMElement payload = TestingUtils.createDummyOMElement();
    Options options = new Options();
    options.setTo(targetEPR);
    options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
    options.setTransportInProtocol(Constants.TRANSPORT_HTTP);

    ConfigurationContext configContext =
            ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
    ServiceClient sender = new ServiceClient(configContext, null);
    sender.setOptions(options);

    OMElement result = sender.sendReceive(payload);

    TestingUtils.compareWithCreatedOMElement(result);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:17,代码来源:EchoRawXMLTest.java

示例6: testSaveAndRestoreOfMessage

import org.apache.axiom.soap.SOAP12Constants; //导入依赖的package包/类
public void testSaveAndRestoreOfMessage() throws Exception {
    OMElement payload = TestingUtils.createDummyOMElement();
    Options options = new Options();
    options.setTo(TestConstants.targetEPR);
    options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
    options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
    options.setAction(TestConstants.operationName.getLocalPart());
    options.setUseSeparateListener(true);

    ConfigurationContext configContext = UtilServer.createClientConfigurationContext();

    ServiceClient sender = new ServiceClient(configContext, null);
    sender.setOptions(options);
    sender.engageModule("addressing");

    OMElement result = sender.sendReceive(payload);

    TestingUtils.compareWithCreatedOMElement(result);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:20,代码来源:MessageSaveAndRestoreTest.java

示例7: testSendRobust

import org.apache.axiom.soap.SOAP12Constants; //导入依赖的package包/类
public void testSendRobust() throws Exception {

        EndpointReference targetEPR = new EndpointReference(
                "http://127.0.0.1:" + (UtilServer.TESTING_PORT)
//            "http://127.0.0.1:" + 5556
                        + "/axis2/services/Echo/echoOMElementNoResponse");
        OMElement payload = createDummyOMElement();
        Options options = new Options();
        options.setTo(targetEPR);
        options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
        options.setAction("urn:echoOMElementNoResponse");
        ConfigurationContext configContext =
                ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
        ServiceClient sender = new ServiceClient(configContext, null);
        sender.setOptions(options);

        sender.sendRobust(payload);
        String value = System.getProperty("echoOMElementNoResponse");
        System.setProperty("echoOMElementNoResponse", "");
        assertEquals(value, "echoOMElementNoResponse");
    }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:23,代码来源:ServiceClientTest.java

示例8: testFireAndForget

import org.apache.axiom.soap.SOAP12Constants; //导入依赖的package包/类
public void testFireAndForget() throws Exception {

        EndpointReference targetEPR = new EndpointReference(
                "http://127.0.0.1:" + (UtilServer.TESTING_PORT)
//            "http://127.0.0.1:" + 5556
                        + "/axis2/services/Echo/echoOMElementNoResponse");
        OMElement payload = createDummyOMElement();
        Options options = new Options();
        options.setTo(targetEPR);
        options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
        options.setAction("urn:echoOMElementNoResponse");
        ConfigurationContext configContext =
                ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
        ServiceClient sender = new ServiceClient(configContext, null);
        sender.setOptions(options);

        sender.fireAndForget(payload);
        Thread.sleep(100);
        String value = System.getProperty("echoOMElementNoResponse");
        System.setProperty("echoOMElementNoResponse", "");
        assertEquals(value, "echoOMElementNoResponse");
    }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:24,代码来源:ServiceClientTest.java

示例9: testSendRobustException

import org.apache.axiom.soap.SOAP12Constants; //导入依赖的package包/类
public void testSendRobustException() throws Exception {

        EndpointReference targetEPR = new EndpointReference(
            "http://127.0.0.1:" + (UtilServer.TESTING_PORT)
//                "http://127.0.0.1:" + 5556
                        + "/axis2/services/Echo/echoWithExeption");
        OMElement payload = createDummyOMElement();
        Options options = new Options();
        options.setTo(targetEPR);
        options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
        options.setAction("urn:echoWithExeption");
        ConfigurationContext configContext =
                ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
        ServiceClient sender = new ServiceClient(configContext, null);
        sender.setOptions(options);

        try {
            sender.sendRobust(payload);
            TestCase.fail("Shoud get an exception");
        } catch (AxisFault axisFault) {
            assertEquals("Invoked the service", axisFault.getMessage());
        }

    }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:26,代码来源:ServiceClientTest.java

示例10: testMutipleInvocation

import org.apache.axiom.soap.SOAP12Constants; //导入依赖的package包/类
public void testMutipleInvocation() throws Exception {

        OMElement payload = TestingUtils.createDummyOMElement();
        Options options = new Options();
        options.setAction("urn:echoOM");
        options.setTo(targetEPR);
        options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
        options.setCallTransportCleanup(true);

        ConfigurationContext configContext =
                ConfigurationContextFactory.createConfigurationContextFromFileSystem(
                        TestingUtils.prefixBaseDirectory(Constants.TESTING_REPOSITORY), null);
        ServiceClient sender = new ServiceClient(configContext, null);
        sender.engageModule("addressing");
        sender.setOptions(options);
        OMElement result = sender.sendReceive(payload);
        TestingUtils.compareWithCreatedOMElement(result);
        result = sender.sendReceive(payload);
        TestingUtils.compareWithCreatedOMElement(result);
        result = sender.sendReceive(payload);
        TestingUtils.compareWithCreatedOMElement(result);
        result = sender.sendReceive(payload);
        TestingUtils.compareWithCreatedOMElement(result);
    }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:26,代码来源:MultipleInvocationTest.java

示例11: echoWithFault

import org.apache.axiom.soap.SOAP12Constants; //导入依赖的package包/类
public OMElement echoWithFault(OMElement echoOMElement) throws AxisFault {
    String text = echoOMElement.getText();
    if (THROW_FAULT_AS_AXIS_FAULT.equalsIgnoreCase(text)) {
        throw new AxisFault(new QName("http://test.org", "TestFault", "test"), "FaultReason",
                            new Exception("This is a test Exception"));
    } else if (THROW_FAULT_WITH_MSG_CTXT.equalsIgnoreCase(text)) {
        MessageContext inMessageContext = MessageContext.getCurrentMessageContext();
        initFaultInformation(inMessageContext);

        inMessageContext.setProperty(SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME, soapFaultCode);
        inMessageContext
                .setProperty(SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME, soapFaultReason);
        inMessageContext
                .setProperty(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME, soapFaultDetail);
        throw new AxisFault("Fake exception occurred !!");
    } else {
        return echoOMElement;
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:20,代码来源:FaultThrowingService.java

示例12: createClient

import org.apache.axiom.soap.SOAP12Constants; //导入依赖的package包/类
private ServiceClient createClient() throws Exception {
    Options options = new Options();
    options.setTo(targetEPR);
    options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
    options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
    options.setAction(operationName.getLocalPart());
    options.setUseSeparateListener(true);
    options.setTimeOutInMilliSeconds(50000);

    ConfigurationContext configContext = UtilServer.createClientConfigurationContext();

    ServiceClient sender = new ServiceClient(configContext, null);
    sender.setOptions(options);
    sender.engageModule("addressing");
    return sender;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:17,代码来源:PausingHandlerExecutionTest.java

示例13: testSendingMustUnderstandWithNextRole

import org.apache.axiom.soap.SOAP12Constants; //导入依赖的package包/类
public void testSendingMustUnderstandWithNextRole() throws Exception {
    ServiceClient serviceClient = getClient(Echo.SERVICE_NAME, Echo.ECHO_OM_ELEMENT_OP_NAME);
    
    SOAPFactory fac = OMAbstractFactory.getSOAP12Factory();
    OMNamespace headerNs = fac.createOMNamespace("http://dummyHeader", "dh");
    SOAPHeaderBlock h1 = fac.createSOAPHeaderBlock("DummyHeader", headerNs);
    h1.setMustUnderstand(true);
    h1.addChild(fac.createOMText("Dummy String"));
    h1.setRole(SOAP12Constants.SOAP_ROLE_NEXT);
    
    serviceClient.addHeader(h1);
    
    OMElement payload = TestingUtils.createDummyOMElement();

    serviceClient.getOptions().setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
    
    try {
    	serviceClient.sendReceive(payload);
    } catch (AxisFault fault) {
        // This should be a MustUnderstand fault
        assertEquals(fault.getFaultCode(), SOAP12Constants.QNAME_MU_FAULTCODE);
        return;
    }
    fail("MU header was processed");
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:26,代码来源:SoapProcessingModelTest.java

示例14: testEchoXMLSyncSeperateListener

import org.apache.axiom.soap.SOAP12Constants; //导入依赖的package包/类
public void testEchoXMLSyncSeperateListener() throws Exception {
    OMElement payload = createEnvelope();
    Options options = new Options();
    options.setTo(targetEPR);
    options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
    options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
    options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
    ConfigurationContext configContext =
            ConfigurationContextFactory.createConfigurationContextFromFileSystem(
                    TestingUtils.prefixBaseDirectory("target/test-resources/integrationRepo"), null);

    ServiceClient sender = new ServiceClient(configContext, null);
    sender.engageModule(new QName("addressing"));
    options.setAction(Constants.AXIS2_NAMESPACE_URI + "/" + operationName.getLocalPart());
    sender.setOptions(options);
    options.setUseSeparateListener(true);
    options.setTo(targetEPR);
    OMElement result = sender.sendReceive(payload);

    OMElement ele = (OMElement)result.getFirstOMChild();
    OMText binaryNode = (OMText)ele.getFirstOMChild();
    // to the assert equal
    compareWithCreatedOMText(binaryNode);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:25,代码来源:EchoRawMTOMTest.java

示例15: testEchoXMLSync

import org.apache.axiom.soap.SOAP12Constants; //导入依赖的package包/类
public void testEchoXMLSync() throws Exception {

        OMElement payload = createEnvelope();

        Options options = new Options();
        options.setTo(targetEPR);
        options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);

        options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);

        ConfigurationContext configContext =
                ConfigurationContextFactory.createConfigurationContextFromFileSystem(
                        TestingUtils.prefixBaseDirectory(Constants.TESTING_PATH + "commons-http-enabledRepository"), null);
        ServiceClient sender = new ServiceClient(configContext, null);
        sender.setOptions(options);
        options.setTo(targetEPR);

        OMElement ret = sender.sendReceive(payload);
        ret.build();
        this.compareWithCreatedOMElement(ret);

    }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:24,代码来源:EchoRawMTOMCommonsChunkingTest.java


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