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


Java SOAP11Constants类代码示例

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


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

示例1: createDefaultSOAPEnvelope

import org.apache.axiom.soap.SOAP11Constants; //导入依赖的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

示例2: testConvertToDOOM

import org.apache.axiom.soap.SOAP11Constants; //导入依赖的package包/类
public void testConvertToDOOM() throws Exception {
    String xml = "<?xml version='1.0' encoding='utf-8'?>" +
            "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
            "<soapenv:Body><ns1:createAccountRequest xmlns:ns1=\"http://www.wso2.com/types\">" +
            "<clientinfo xmlns=\"http://www.wso2.com/types\"><name>bob</name><ssn>123456789</ssn></clientinfo>" +
            "<password xmlns=\"\">passwd</password></ns1:createAccountRequest></soapenv:Body></soapenv:Envelope>";

    StAXSOAPModelBuilder builder2 = new StAXSOAPModelBuilder(
            getTestEnvelope().getXMLStreamReader(),
            DOOMAbstractFactory.getSOAP11Factory(),
            SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);

    SOAPEnvelope envelope = builder2.getSOAPEnvelope();
    envelope.build();

    StringWriter writer = new StringWriter();
    envelope.serialize(writer);
    writer.flush();

    String s2 = writer.toString();

    assertXMLEqual(s2, xml);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:24,代码来源:ADBSOAPModelBuilderTest.java

示例3: XMLSpineImpl

import org.apache.axiom.soap.SOAP11Constants; //导入依赖的package包/类
/**
 * Create spine from an existing OM tree
 *
 * @param envelope
 * @param style       Style
 * @param indirection (0 or 1) indicates location of body blocks
 * @throws WebServiceException
 */
public XMLSpineImpl(SOAPEnvelope envelope, Style style, int indirection, Protocol protocol)
        throws WebServiceException {
    super();
    this.style = style;
    this.indirection = indirection;
    this.protocol = protocol;
    init(envelope);
    // If null, detect protocol from soap namespace
    if (protocol == null) {
        if (root.getNamespace().getNamespaceURI()
                .equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
            this.protocol = Protocol.soap11;
        } else if (root.getNamespace().getNamespaceURI()
                .equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
            this.protocol = Protocol.soap12;
        }
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:27,代码来源:XMLSpineImpl.java

示例4: setEnvelope

import org.apache.axiom.soap.SOAP11Constants; //导入依赖的package包/类
/**
 * @param envelope
 */
public void setEnvelope(SOAPEnvelope envelope) throws AxisFault {
    this.envelope = envelope;

    if (this.envelope != null) {
        String soapNamespaceURI = envelope.getNamespace().getNamespaceURI();

        if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI
                .equals(soapNamespaceURI)) {
            isSOAP11 = false;
        } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI
                .equals(soapNamespaceURI)) {
            isSOAP11 = true;
        } else {
            throw new AxisFault(
                    "Unknown SOAP Version. Current Axis handles only SOAP 1.1 and SOAP 1.2 messages");
        }
        // Inform the listeners of an attach envelope event
        if (getAxisService() != null) {
            getAxisService().attachEnvelopeEvent(this);
        }
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:26,代码来源:MessageContext.java

示例5: getDocumentFromSOAPEnvelope

import org.apache.axiom.soap.SOAP11Constants; //导入依赖的package包/类
/**
 * Create a DOM Document using the org.apache.axiom.soap.SOAPEnvelope
 *
 * @param env An org.apache.axiom.soap.SOAPEnvelope instance
 * @return the DOM Document of the given SOAP Envelope
 */
public static Document getDocumentFromSOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope env) {
    env.build();

    //Check the namespace and find SOAP version and factory
    String nsURI;
    SOAPFactory factory;
    if (env.getNamespace().getNamespaceURI()
            .equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
        nsURI = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
        factory = DOOMAbstractFactory.getSOAP11Factory();
    } else {
        nsURI = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;
        factory = DOOMAbstractFactory.getSOAP12Factory();
    }

    StAXSOAPModelBuilder stAXSOAPModelBuilder =
            new StAXSOAPModelBuilder(env.getXMLStreamReader(), factory, nsURI);
    SOAPEnvelope envelope = (stAXSOAPModelBuilder).getSOAPEnvelope();
    envelope.build();

    Element envElem = (Element)envelope;
    return envElem.getOwnerDocument();
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:30,代码来源:SAAJUtil.java

示例6: toDOOMSOAPEnvelope

import org.apache.axiom.soap.SOAP11Constants; //导入依赖的package包/类
/**
 * Create a DOM Document using the org.apache.axiom.soap.SOAPEnvelope
 *
 * @param env An org.apache.axiom.soap.SOAPEnvelope instance
 * @return the org.apache.axis2.soap.impl.dom.SOAPEnvelopeImpl of the given SOAP Envelope
 */
public static org.apache.axiom.soap.impl.dom.SOAPEnvelopeImpl
        toDOOMSOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope env) {
    env.build();

    //Check the namespace and find SOAP version and factory
    String nsURI;
    SOAPFactory factory;
    if (env.getNamespace().getNamespaceURI()
            .equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
        nsURI = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
        factory = DOOMAbstractFactory.getSOAP11Factory();
    } else {
        nsURI = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;
        factory = DOOMAbstractFactory.getSOAP11Factory();
    }

    StAXSOAPModelBuilder stAXSOAPModelBuilder =
            new StAXSOAPModelBuilder(env.getXMLStreamReader(), factory, nsURI);
    SOAPEnvelope envelope = (stAXSOAPModelBuilder).getSOAPEnvelope();
    envelope.build();

    return (org.apache.axiom.soap.impl.dom.SOAPEnvelopeImpl)envelope;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:30,代码来源:SAAJUtil.java

示例7: getEnvelopeNamespace

import org.apache.axiom.soap.SOAP11Constants; //导入依赖的package包/类
public static String getEnvelopeNamespace(String contentType) {
    String soapNS = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
    if (contentType != null) {
        if (contentType.indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) > -1) {
            // it is SOAP 1.2
            soapNS = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;
        } else if (contentType.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) > -1) {
            // SOAP 1.1
            soapNS = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
        }
    }
    return soapNS;
}
 
开发者ID:wso2-attic,项目名称:carbon-gateway-framework,代码行数:14,代码来源:XMLUtil.java

示例8: getFactory

import org.apache.axiom.soap.SOAP11Constants; //导入依赖的package包/类
private static SOAPFactory getFactory(String soapVersionURI) {

        if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapVersionURI)) {
            return OMAbstractFactory.getSOAP11Factory();
        } else if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapVersionURI)) {
            return OMAbstractFactory.getSOAP12Factory();
        } else {
            throw new RuntimeException(org.apache.axis2.i18n.Messages
                    .getMessage("unknownsoapversion"));
        }
    }
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:12,代码来源:HTTPBindingHandler.java

示例9: invokeBusinessLogic

import org.apache.axiom.soap.SOAP11Constants; //导入依赖的package包/类
public void invokeBusinessLogic(MessageContext inMessageContext,
                                MessageContext outMessageContext) throws AxisFault {
    log.debug("Got The message to the MessageReceiver");


    String soapNamespace = inMessageContext.getEnvelope().getNamespace().getNamespaceURI();
    // creating a soap factory according the the soap namespce uri
    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 {
        System.out.println("Unknow soap message");
    }

    SOAPEnvelope responseEnvelope = soapFactory.getDefaultEnvelope();

    // creating a body element
    OMFactory omFactory = OMAbstractFactory.getOMFactory();
    OMNamespace omNamespace = omFactory.createOMNamespace("http://sms.test","ns1");
    OMElement omElement = omFactory.createOMElement("Response", omNamespace);
    omElement.setText("Sucess");
    responseEnvelope.getBody().addChild(omElement);

    outMessageContext.setEnvelope(responseEnvelope);
}
 
开发者ID:wso2,项目名称:wso2-axis2-transports,代码行数:28,代码来源:SimpleInOutMessageReceiver.java

示例10: testEchoXMLSync

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

        Options options = new Options();
        options.setTo(targetEPR);
        options.setProperty(Constants.Configuration.ENABLE_SWA, Constants.VALUE_TRUE);
        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
        options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
        options.setTimeOutInMilliSeconds(100000);
        options.setAction(Constants.AXIS2_NAMESPACE_URI + "/" + operationName.getLocalPart());
        options.setTo(targetEPR);

        ConfigurationContext configContext =
                ConfigurationContextFactory.createConfigurationContextFromFileSystem(
                        TestingUtils.prefixBaseDirectory("target/test-resources/integrationRepo"), null);

        ServiceClient sender = new ServiceClient(configContext, null);
        sender.setOptions(options);
        OperationClient mepClient = sender.createClient(ServiceClient.ANON_OUT_IN_OP);

        MessageContext mc = new MessageContext();
        mc.setEnvelope(createEnvelope());
        FileDataSource fileDataSource = new FileDataSource(TestingUtils.prefixBaseDirectory("test-resources/mtom/test.jpg"));
        DataHandler dataHandler = new DataHandler(fileDataSource);
        mc.addAttachment("FirstAttachment", dataHandler);

        mepClient.addMessageContext(mc);
        mepClient.execute(true);
        MessageContext response = mepClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
        DataHandler dataHandler2 = response.getAttachment("FirstAttachment");
        assertNotNull(dataHandler);
        compareDataHandlers(dataHandler, dataHandler2);
    }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:33,代码来源:EchoRawSwATest.java

示例11: testSOAP11

import org.apache.axiom.soap.SOAP11Constants; //导入依赖的package包/类
public void testSOAP11() throws AxisFault {
    ServiceClient serviceClient = getClient(Echo.SERVICE_NAME, Echo.ECHO_OM_ELEMENT_OP_NAME);
    serviceClient.getOptions().setSoapVersionURI(
            SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
    serviceClient.setCachingOperationContext(true);
    serviceClient.sendReceive(TestingUtils.createDummyOMElement());
    SOAPEnvelope result = serviceClient.getLastOperationContext().getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE).getEnvelope();

    assertEquals("SOAP Version received is not compatible",
                 SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,
                 result.getNamespace().getNamespaceURI());
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:13,代码来源:SOAPversionTest.java

示例12: getSOAPFactory

import org.apache.axiom.soap.SOAP11Constants; //导入依赖的package包/类
private SOAPFactory getSOAPFactory(MessageContext msgContext) throws AxisFault {
    String nsURI = msgContext.getEnvelope().getNamespace().getNamespaceURI();
    if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
        return OMAbstractFactory.getSOAP12Factory();
    } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
        return OMAbstractFactory.getSOAP11Factory();
    } else {
        throw new AxisFault(Messages.getMessage("invalidSOAPversion"));
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:11,代码来源:JavaTransportSender.java

示例13: testConvertToDOOM2

import org.apache.axiom.soap.SOAP11Constants; //导入依赖的package包/类
public void testConvertToDOOM2() throws Exception {
    String xml =
            "<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"><soapenv:Header /><soapenv:Body><ns1:createAccountRequest xmlns:ns1=\"http://www.wso2.com/types\"><ns1:clientinfo><name xmlns=\"\">bob</name><ssn xmlns=\"\">123456789</ssn></ns1:clientinfo><password xmlns=\"\">passwd</password></ns1:createAccountRequest></soapenv:Body></soapenv:Envelope>";

    CreateAccountRequest request = new CreateAccountRequest();
    ClientInfo clientInfo = new ClientInfo();
    clientInfo.setName("bob");
    clientInfo.setSsn("123456789");
    request.setClientInfo(clientInfo);
    request.setPassword("passwd");

    ADBSOAPModelBuilder builder = new ADBSOAPModelBuilder(request
            .getPullParser(CreateAccountRequest.MY_QNAME),
                                                          OMAbstractFactory.getSOAP11Factory());

    SOAPEnvelope env = builder.getEnvelope();

    StAXSOAPModelBuilder builder2 = new StAXSOAPModelBuilder(
            getTestEnvelope().getXMLStreamReaderWithoutCaching(),
            DOOMAbstractFactory.getSOAP11Factory(),
            SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
    SOAPEnvelope envelope = builder2.getSOAPEnvelope();
    envelope.build();

    StringWriter writer = new StringWriter();
    envelope.serialize(writer);
    writer.flush();

    XMLStreamReader r = StAXUtils.createXMLStreamReader(new StringReader(writer.toString()));
    PrintEvents.print(r);

    //TODO: FIXME. Simpler test in testPrintEvents2
    //assertXMLEqual(writer.toString(),xml);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:35,代码来源:ADBSOAPModelBuilderTest.java

示例14: getSOAPVersion

import org.apache.axiom.soap.SOAP11Constants; //导入依赖的package包/类
/**
 * Answer SOAPVersion for specified envelope
 * @param envelope SOAP Envelope
 * @return version of SOAP
 * @throws MexException
 */
public static int getSOAPVersion(SOAPEnvelope envelope) throws MexException {
	String namespaceName = envelope.getNamespace().getNamespaceURI();
	if (namespaceName.equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI))
		return MexConstants.SOAPVersion.v1_1;
	else if (namespaceName.equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI))
		return MexConstants.SOAPVersion.v1_2;
	else
		throw new MexException("Unknown SOAP version");
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:16,代码来源:MexUtil.java

示例15: getSOAPFactory

import org.apache.axiom.soap.SOAP11Constants; //导入依赖的package包/类
/**
 * Answer SOAPFactory corresponding to specified SOAP namespace URI
 * @param soapNameSpaceURI soap namespace uri
 * @return
 * @throws MexException
 */
public static SOAPFactory getSOAPFactory(String soapNameSpaceURI) throws MexException {
		if (soapNameSpaceURI.equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI))
		return  OMAbstractFactory.getSOAP11Factory();
	else if (soapNameSpaceURI.equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI))
		return OMAbstractFactory.getSOAP12Factory();
	else
		throw new MexException("Unknown SOAP soapNameSpaceURI");
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:15,代码来源:MexUtil.java


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