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


Java SOAPEnvelope.getNamespace方法代码示例

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


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

示例1: invoke

import org.apache.axiom.soap.SOAPEnvelope; //导入方法依赖的package包/类
public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
    try {
        if (ENABLE.equals(System.getProperty(UDDI_SYSTEM_PROPERTY))) {
            SOAPEnvelope envelope = msgContext.getEnvelope();
            OMNamespace namespace = envelope.getNamespace();
            String nameSpace = namespace.getNamespaceURI();
            if (nameSpace != null) {
                log.info("first " + envelope.getBody().getFirstElementNS().getNamespaceURI());
                log.info(envelope.toString());

                if (envelope.getBody().getFirstElementNS().getNamespaceURI().equals(UDDI_V2)) {
                    OMFactory omFactory = envelope.getOMFactory();
                    OMElement firstElement = envelope.getBody().getFirstElement();
                    setNamespace(firstElement, omFactory.createOMNamespace(UDDI_V3,
                            firstElement.getNamespace().getPrefix()));

                }
                log.info("second " + envelope.getBody().getFirstElementNS().getNamespaceURI());
                log.info(envelope.toString());
            }
        }
    } catch (Exception e) {
        log.error("An error occurred while processing SOAP message.", e);
    }
    return InvocationResponse.CONTINUE;
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:27,代码来源:UddiVersionHandler.java

示例2: validateSOAPVersion

import org.apache.axiom.soap.SOAPEnvelope; //导入方法依赖的package包/类
public static void validateSOAPVersion(String soapNamespaceURIFromTransport, SOAPEnvelope envelope) {
    if (soapNamespaceURIFromTransport != null) {
        OMNamespace envelopeNamespace = envelope.getNamespace();
        String namespaceName = envelopeNamespace.getNamespaceURI();
        if (!(soapNamespaceURIFromTransport.equals(namespaceName))) {
            throw new SOAPProcessingException(
                    "Transport level information does not match with SOAP" + " Message namespace URI",
                    envelopeNamespace.getPrefix() + ":" +
                            SOAPConstants.FAULT_CODE_VERSION_MISMATCH);
        }
    }
}
 
开发者ID:wso2-attic,项目名称:carbon-gateway-framework,代码行数:13,代码来源:XMLUtil.java

示例3: testGetPayloadFromSoap12

import org.apache.axiom.soap.SOAPEnvelope; //导入方法依赖的package包/类
public void testGetPayloadFromSoap12() throws Exception {
    // On inbound, there will already be an OM
    // which represents the message.  The following code simulates the input
    // OM
    StringReader sr = new StringReader(sampleSoap12Envelope);
    XMLStreamReader inflow = inputFactory.createXMLStreamReader(sr);
    StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(inflow, null);
    OMElement omElement = builder.getSOAPEnvelope();
    
    // The JAX-WS layer creates a Message from the OM
    MessageFactory mf = (MessageFactory)
        FactoryRegistry.getFactory(MessageFactory.class);
    Message m = mf.createFrom(omElement, null);
    
    // Make sure the right Protocol was set on the Message
    assertTrue(m.getProtocol().equals(Protocol.soap12));
    
    // Check the SOAPEnvelope to make sure we've got the right
    // protocol namespace there as well.
    SOAPEnvelope soapEnv = (SOAPEnvelope) m.getAsOMElement();
    OMNamespace ns = soapEnv.getNamespace();
    assertTrue(ns.getNamespaceURI().equals(SOAP12_NS_URI));
    
    // Assuming no handlers are installed, the next thing that will happen
    // is the proxy code will ask for the business object (String).
    XMLStringBlockFactory blockFactory = 
        (XMLStringBlockFactory) FactoryRegistry.getFactory(XMLStringBlockFactory.class);
    Block block = m.getBodyBlock(null, blockFactory);
    Object bo = block.getBusinessObject(true);
    assertTrue(bo instanceof String);
    
    // The block should be consumed
    assertTrue(block.isConsumed());
    
    // Check the String for accuracy
    assertTrue(sampleText.equals(bo));
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:38,代码来源:SOAP12Tests.java

示例4: testGetMessageFromSoap12

import org.apache.axiom.soap.SOAPEnvelope; //导入方法依赖的package包/类
public void testGetMessageFromSoap12() throws Exception {
    // On inbound, there will already be an OM
    // which represents the message.  The following code simulates the input
    // OM
    StringReader sr = new StringReader(sampleSoap12Envelope);
    XMLStreamReader inflow = inputFactory.createXMLStreamReader(sr);
    StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(inflow, null);
    OMElement omElement = builder.getSOAPEnvelope();
    
    // The JAX-WS layer creates a Message from the OM
    MessageFactory mf = (MessageFactory)
        FactoryRegistry.getFactory(MessageFactory.class);
    Message m = mf.createFrom(omElement, null);
    
    // Make sure the right Protocol was set on the Message
    assertTrue(m.getProtocol().equals(Protocol.soap12));
    
    // Check the SOAPEnvelope to make sure we've got the right
    // protocol namespace there as well.
    SOAPEnvelope soapEnv = (SOAPEnvelope) m.getAsOMElement();
    OMNamespace ns = soapEnv.getNamespace();
    assertTrue(ns.getNamespaceURI().equals(SOAP12_NS_URI));
    
    // Assuming no handlers are installed, the next thing that will happen
    // is the proxy code will ask for the business object (String).
    XMLStringBlockFactory blockFactory = 
        (XMLStringBlockFactory) FactoryRegistry.getFactory(XMLStringBlockFactory.class);
    Block block = blockFactory.createFrom(m.getAsOMElement(), null, null);
    Object bo = block.getBusinessObject(true);
    assertTrue(bo instanceof String);
    
    // The block should be consumed
    assertTrue(block.isConsumed());
    
    // Check the String for accuracy
    assertTrue(((String)bo).contains("<soapenv:Body><echo>test string</echo></soapenv:Body>"));
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:38,代码来源:SOAP12Tests.java

示例5: validateSOAPVersion

import org.apache.axiom.soap.SOAPEnvelope; //导入方法依赖的package包/类
public static void validateSOAPVersion(String soapNamespaceURIFromTransport,
                                       SOAPEnvelope envelope) {
    if (soapNamespaceURIFromTransport != null) {
        OMNamespace envelopeNamespace = envelope.getNamespace();
        String namespaceName = envelopeNamespace.getNamespaceURI();
        if (!(soapNamespaceURIFromTransport.equals(namespaceName))) {
            throw new SOAPProcessingException(
                    "Transport level information does not match with SOAP" +
                    " Message namespace URI", envelopeNamespace.getPrefix() + ":" +
                                              SOAPConstants.FAULT_CODE_VERSION_MISMATCH);
        }
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:14,代码来源:BuilderUtil.java

示例6: testCreateSoap12FromPayload

import org.apache.axiom.soap.SOAPEnvelope; //导入方法依赖的package包/类
/**
 * Simulate creating a SOAP 1.2 message when the business object
 * provided is just the payload. 
 */
public void testCreateSoap12FromPayload() throws Exception {
    // Create a SOAP 1.2 Message
    MessageFactory mf = (MessageFactory)
        FactoryRegistry.getFactory(MessageFactory.class);
    Message m = mf.create(Protocol.soap12);
    
    // Get the BlockFactory
    XMLStringBlockFactory f = (XMLStringBlockFactory)
        FactoryRegistry.getFactory(XMLStringBlockFactory.class);
    
    // Create a Block using the sample string as the content.  This simulates
    // what occurs on the outbound JAX-WS dispatch<String> client
    Block block = f.createFrom(sampleText, null, null);
    
    // Add the block to the message as normal body content.
    m.setBodyBlock(block);
    
    // Assuming no handlers are installed, the next thing that will happen
    // is a XMLStreamReader will be requested...to go to OM.   At this point the
    // block should be consumed.
    OMElement om = m.getAsOMElement();
    
    // The block should not be consumed yet...because the message has not been read
    assertTrue(!block.isConsumed());
    
    // To check that the output is correct, get the String contents of the 
    // reader
    Reader2Writer r2w = new Reader2Writer(om.getXMLStreamReader());
    String newText = r2w.getAsString();
    TestLogger.logger.debug(newText);
    assertTrue(newText.contains(sampleText));
    assertTrue(newText.contains("soap"));
    assertTrue(newText.contains("Envelope"));
    assertTrue(newText.contains("Body"));
    
    assertTrue(m.getProtocol().equals(Protocol.soap12));
    
    SOAPEnvelope omSoapEnv = (SOAPEnvelope) m.getAsOMElement();
    OMNamespace ns = omSoapEnv.getNamespace();
    assertTrue(ns.getNamespaceURI().equals(SOAP12_NS_URI));
    
    // The block should be consumed at this point
    assertTrue(block.isConsumed());
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:49,代码来源:SOAP12Tests.java

示例7: testCreateSoap12FromMessage

import org.apache.axiom.soap.SOAPEnvelope; //导入方法依赖的package包/类
/**
 * Simulate creating a SOAP 1.2 message when the business object
 * provided is the full message.
 */
public void testCreateSoap12FromMessage() throws Exception {
    // Create a SOAP 1.2 Message
    MessageFactory mf = (MessageFactory)
        FactoryRegistry.getFactory(MessageFactory.class);
    
    // Get the BlockFactory
    XMLStringBlockFactory f = (XMLStringBlockFactory)
        FactoryRegistry.getFactory(XMLStringBlockFactory.class);
    
    // Create a Block using the sample string as the content.  This simulates
    // what occurs on the outbound JAX-WS dispatch<String> client
    Block block = f.createFrom(sampleSoap12Envelope, null, null);
    
    // Create a Message with the full XML contents that we have
    Message m = mf.createFrom(block.getXMLStreamReader(true), null);
    
    // Assuming no handlers are installed, the next thing that will happen
    // is a XMLStreamReader will be requested...to go to OM.   At this point the
    // block should be consumed.
    OMElement om = m.getAsOMElement();
    
    // To check that the output is correct, get the String contents of the 
    // reader
    Reader2Writer r2w = new Reader2Writer(om.getXMLStreamReaderWithoutCaching());
    String newText = r2w.getAsString();
    TestLogger.logger.debug(newText);
    assertTrue(newText.contains(sampleText));
    assertTrue(newText.contains("soap"));
    assertTrue(newText.contains("Envelope"));
    assertTrue(newText.contains("Body"));
    
    assertTrue(m.getProtocol().equals(Protocol.soap12));
    
    SOAPEnvelope omSoapEnv = (SOAPEnvelope) m.getAsOMElement();
    OMNamespace ns = omSoapEnv.getNamespace();
    assertTrue(ns.getNamespaceURI().equals(SOAP12_NS_URI));
    
    // The block should be consumed at this point
    assertTrue(block.isConsumed());
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:45,代码来源:SOAP12Tests.java


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