• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java StAXSOAPModelBuilder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getBuilder

import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; //导入依赖的package包/类
/**
 * Creates an OMBuilder for a plain XML message.
 *
 * @param inStream   InputStream for a XML message
 * @param charSetEnc Character set encoding to be used
 * @return Handler to a OMBuilder implementation instance
 * @throws javax.xml.stream.XMLStreamException
 */
public static StAXBuilder getBuilder(InputStream inStream, String charSetEnc) throws XMLStreamException {
    XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(inStream, charSetEnc);
    try {
        return new StAXSOAPModelBuilder(xmlReader);
    } catch (OMException e) {
        log.info("OMException in getSOAPBuilder", e);
        try {
            log.info("Remaining input stream :[" +
                    new String(IOUtils.getStreamAsByteArray(inStream), charSetEnc) + "]");
        } catch (IOException e1) {
            // Nothing here?
        }
        throw e;
    }
}
 
开发者ID:wso2-attic,项目名称:carbon-gateway-framework,代码行数:24,代码来源:XMLUtil.java


示例2: getSOAPBuilder

import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; //导入依赖的package包/类
/**
 * Creates an OMBuilder for a SOAP message. Default character set encording is used.
 *
 * @param inStream InputStream for a SOAP message
 * @return Handler to a OMBuilder implementation instance
 * @throws javax.xml.stream.XMLStreamException
 */
public static StAXBuilder getSOAPBuilder(InputStream inStream) throws XMLStreamException {
    XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(inStream);
    try {
        return new StAXSOAPModelBuilder(xmlReader);
    } catch (OMException e) {
        log.info("OMException in getSOAPBuilder", e);
        try {
            log.info("Remaining input stream :[" +
                    new String(IOUtils.getStreamAsByteArray(inStream) , "UTF-8") + "]");
        } catch (IOException e1) {
            // Nothing here?
        }
        throw e;
    }
}
 
开发者ID:wso2-attic,项目名称:carbon-gateway-framework,代码行数:23,代码来源:XMLUtil.java


示例3: testConvertToDOOM

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


示例4: createXMLFault

import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; //导入依赖的package包/类
public static XMLFault createXMLFault(Block b, Protocol p) {
    // Because of the requirement that we have a full SOAP envelope structure as
    // the input to the StAXSOAPModelBuilder, we have to have a dummy envelope
    // that wraps our fault.  This will allow the Axiom SOAPFault object to
    // be created.        
    Message m = null;
    try {
        MessageFactory mf = (MessageFactory) FactoryRegistry.getFactory(MessageFactory.class);
        m = mf.create(p);
        m.setBodyBlock(b);
    } catch (XMLStreamException e) {
        throw ExceptionFactory.makeWebServiceException(e);
    }
    
    SOAPEnvelope dummyEnv = (SOAPEnvelope) m.getAsOMElement();        
    
    StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(dummyEnv.getXMLStreamReaderWithoutCaching());
    SOAPEnvelope newEnv = (SOAPEnvelope) builder.getDocumentElement();
    
    SOAPBody body = newEnv.getBody();
    SOAPFault fault = body.getFault();
    
    Block[] details = getDetailBlocks(fault);
    
    return XMLFaultUtils.createXMLFault(fault, details);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:27,代码来源:XMLFaultUtils.java


示例5: toOM

import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; //导入依赖的package包/类
private org.apache.axiom.soap.SOAPEnvelope toOM(String xml)
        throws WebServiceException {
	if (log.isDebugEnabled()) {
	    log.debug("Converting SAAJ SOAPEnvelope String to an OM SOAPEnvelope");
	    log.debug("The conversion occurs due to " + JavaUtils.stackToString());
	} 
	
    XMLStreamReader reader;
    try {
        reader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(xml.getBytes()));
    } catch (XMLStreamException e) {
        throw ExceptionFactory.makeWebServiceException(e);
    }
    // Get a SOAP OM Builder.  Passing null causes the version to be automatically triggered
    StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(reader, null);
    // Create and return the OM Envelope
    return builder.getSOAPEnvelope();
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:19,代码来源:SAAJConverterImpl.java


示例6: getBuilder

import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; //导入依赖的package包/类
/**
 * Creates an OMBuilder for a plain XML message.
 *
 * @param inStream   InputStream for a XML message
 * @param charSetEnc Character set encoding to be used
 * @return Handler to a OMBuilder implementation instance
 * @throws XMLStreamException
 */
public static StAXBuilder getBuilder(InputStream inStream, String charSetEnc)
        throws XMLStreamException {
    XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(inStream, charSetEnc);
    try {
        return new StAXSOAPModelBuilder(xmlReader);
    } catch (OMException e) {
        log.info("OMException in getSOAPBuilder", e);
        try {
            log.info("Remaining input stream :[" +
                     new String(IOUtils.getStreamAsByteArray(inStream), charSetEnc) + "]");
        } catch (IOException e1) {
            // Nothing here?
        }
        throw e;
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:25,代码来源:BuilderUtil.java


示例7: getSOAPBuilder

import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; //导入依赖的package包/类
/**
 * Creates an OMBuilder for a SOAP message. Default character set encording is used.
 *
 * @param inStream InputStream for a SOAP message
 * @return Handler to a OMBuilder implementation instance
 * @throws XMLStreamException
 */
public static StAXBuilder getSOAPBuilder(InputStream inStream) throws XMLStreamException {
    XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(inStream);
    try {
        return new StAXSOAPModelBuilder(xmlReader);
    } catch (OMException e) {
        log.info("OMException in getSOAPBuilder", e);
        try {
            log.info("Remaining input stream :[" +
                     new String(IOUtils.getStreamAsByteArray(inStream)) + "]");
        } catch (IOException e1) {
            // Nothing here?
        }
        throw e;
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:23,代码来源:BuilderUtil.java


示例8: testOMElementDispatchMessageMode

import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; //导入依赖的package包/类
/**
 * Test sending a SOAP 1.2 request in MESSAGE mode
 */
public void testOMElementDispatchMessageMode() throws Exception {
    // Create the JAX-WS client needed to send the request
    Service service = Service.create(serviceName);
    service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, endpointUrl);
    Dispatch<OMElement> dispatch = service.createDispatch(
            portName, OMElement.class, Mode.MESSAGE);
    
    // Create the OMElement object with the payload contents.  Since
    // we're in PAYLOAD mode, we don't have to worry about the envelope.
    StringReader sr = new StringReader(SOAP11_ENVELOPE_HEAD+request+SOAP11_ENVELOPE_TAIL);
    XMLStreamReader inputReader = inputFactory.createXMLStreamReader(sr);
    StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(inputReader, null); 
    SOAPEnvelope om = (SOAPEnvelope) builder.getDocumentElement();

    
    OMElement response = dispatch.invoke(om);
    
    
    String responseText = response.toStringWithConsume();
    assertTrue(responseText.contains("soap"));
    assertTrue(responseText.contains("Body"));
    assertTrue(responseText.contains("Envelope"));
    assertTrue(responseText.contains("Hello Dispatch OM"));
    
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:29,代码来源:OMProviderTests.java


示例9: testOMElementDispatchMessageModeSOAPFaultException

import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; //导入依赖的package包/类
/**
 * Test sending a SOAP 1.2 request in MESSAGE mode
 */
public void testOMElementDispatchMessageModeSOAPFaultException() throws Exception {
    // Create the JAX-WS client needed to send the request
    Service service = Service.create(serviceName);
    service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, endpointUrl);
    Dispatch<OMElement> dispatch = service.createDispatch(
            portName, OMElement.class, Mode.MESSAGE);
    
    StringReader sr = new StringReader(SOAP11_ENVELOPE_HEAD+SOAPFaultRequest+SOAP11_ENVELOPE_TAIL);
    XMLStreamReader inputReader = inputFactory.createXMLStreamReader(sr);
    StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(inputReader, null); 
    SOAPEnvelope om = (SOAPEnvelope) builder.getDocumentElement();
    OMElement response = null;
    try{
    	response = dispatch.invoke(om);
    	String responseText = response.toStringWithConsume();
    }catch(Exception e){
    	assertTrue(e instanceof SOAPFaultException);
    }
    assertTrue(response ==null);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:24,代码来源:OMProviderTests.java


示例10: testOMElementDispatchMessageModeSOAPFault

import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; //导入依赖的package包/类
public void testOMElementDispatchMessageModeSOAPFault() throws Exception {
    // Create the JAX-WS client needed to send the request
    Service service = Service.create(serviceName);
    service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, endpointUrl);
    Dispatch<OMElement> dispatch = service.createDispatch(
            portName, OMElement.class, Mode.MESSAGE);
    BindingProvider bp = (BindingProvider)dispatch;
    bp.getRequestContext().put(Constants.THROW_EXCEPTION_IF_SOAP_FAULT, Boolean.FALSE);
   
    StringReader sr = new StringReader(SOAP11_ENVELOPE_HEAD+SOAPFaultRequest+SOAP11_ENVELOPE_TAIL);
    XMLStreamReader inputReader = inputFactory.createXMLStreamReader(sr);
    StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(inputReader, null); 
    SOAPEnvelope om = (SOAPEnvelope) builder.getDocumentElement();
    OMElement response = null;
    try{
    	response = dispatch.invoke(om);
    	String responseText = response.toStringWithConsume();
    }catch(Exception e){
    	fail();
    }
    assertTrue(response !=null);
    assertTrue(response instanceof OMElement);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:24,代码来源:OMProviderTests.java


示例11: invoke

import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; //导入依赖的package包/类
public OMElement invoke(OMElement om) throws SOAPFaultException{
    try{
        StringReader sr = null;
       if(om!=null){
         String requestText = om.toStringWithConsume();
         if(requestText.contains("SOAPFault")){
        	 throwSOAPFaultException();
         }
         if((requestText.contains("Hello Provider OM"))){
             sr = new StringReader(SOAP11_ENVELOPE_HEAD+response+SOAP11_ENVELOPE_TAIL);
         }
         if((!requestText.contains("Hello Provider OM"))){
             sr = new StringReader(SOAP11_ENVELOPE_HEAD+"ack:received OM"+SOAP11_ENVELOPE_TAIL);
         }
       }else{
           sr = new StringReader(SOAP11_ENVELOPE_HEAD+"null request"+SOAP11_ENVELOPE_TAIL);
       }
        XMLStreamReader inputReader = inputFactory.createXMLStreamReader(sr);
        StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(inputReader, null); 
        SOAPEnvelope responseOM = (SOAPEnvelope) builder.getDocumentElement();

        return responseOM;
    }catch(Exception e){
        throw new WebServiceException(e);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:27,代码来源:OMProvider.java


示例12: getDocumentFromSOAPEnvelope

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


示例13: toDOOMSOAPEnvelope

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


示例14: assertSoapyEquals

import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; //导入依赖的package包/类
private void assertSoapyEquals(String expected, String actual) throws Exception{
	XMLStreamReader expectedParser = XMLInputFactory.newInstance()
		.createXMLStreamReader(
			new TestServletInputStream(expected));
	StAXSOAPModelBuilder expectedBuilder = new StAXSOAPModelBuilder(expectedParser);
	XMLStreamReader actualParser = XMLInputFactory.newInstance()
	.createXMLStreamReader(
		new TestServletInputStream(expected));
	StAXSOAPModelBuilder actualBuilder = new StAXSOAPModelBuilder(actualParser);
	assertHeaders(expectedBuilder.getSOAPEnvelope().getHeader(), actualBuilder.getSOAPEnvelope().getHeader());
	assertBody(expectedBuilder.getSOAPEnvelope().getBody(), actualBuilder.getSOAPEnvelope().getBody());
       try {
           xmlTestCase.assertXMLEqual(expected, actual);
       }
       catch (AssertionFailedError afe) {
           StringBuilder sb = new StringBuilder();
           sb.append("Expected:\n" + expected + "\n");
           sb.append("Actual:\n"+actual+"\n");
           sb.append(afe.getMessage());
           throw new AssertionFailedError(sb.toString());
       }
}
 
开发者ID:betfair,项目名称:cougar,代码行数:23,代码来源:SoapTransportCommandProcessorTest.java


示例15: buildSoapEnvelope

import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; //导入依赖的package包/类
private static SOAPEnvelope buildSoapEnvelope() {

        String xmlString = "<soapenv:Envelope xmlns:soapenv=\"http://www.w3.org/2003/05/soap-envelope\">\n" +
                "    <soapenv:Body>\n" +
                "        <ns1:Project xmlns:ns1=\"http://axis2.apache.org/sample\">\n" +
                "            <ns1:Developer>\n" +
                "                <ns1:name>AAA</ns1:name>\n" +
                "                <ns1:location>Colombo</ns1:location>\n" +
                "            </ns1:Developer>\n" +
                "        </ns1:Project>\n" +
                "    </soapenv:Body>\n" +
                "</soapenv:Envelope>";

        SOAPEnvelope soapEnvelope = null;
        try {
            XMLStreamReader xmlStreamReader =
                    StAXUtils.createXMLStreamReader(new ByteArrayInputStream(xmlString.getBytes()));
            StAXSOAPModelBuilder stAXSOAPModelBuilder = new StAXSOAPModelBuilder(xmlStreamReader);
            soapEnvelope = stAXSOAPModelBuilder.getSOAPEnvelope();
        } catch (XMLStreamException e) {
            e.printStackTrace();
        }
        return soapEnvelope;
    }
 
开发者ID:syodage,项目名称:Axis2-Samples,代码行数:25,代码来源:SoapElementBuilder.java


示例16: parseOrder

import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; //导入依赖的package包/类
/**
 * @param payload XML message content came inside the JMS message
 * @throws XMLStreamException on error
 */
private void parseOrder(String payload) throws XMLStreamException {
    InputStream is = new ByteArrayInputStream(payload.getBytes());
    javax.xml.stream.XMLStreamReader parser = XMLInputFactory
            .newInstance().createXMLStreamReader(is);
    StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(parser,
            null);
    SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement();
    // retrieve SOAP body
    SOAPBody soapBody = envelope.getBody();
    OMElement messageNode = soapBody.getFirstChildWithName(new QName(
            FIX_MSG));
    Iterator<?> messageElements = (Iterator<?>) messageNode
            .getChildElements();
    while (messageElements.hasNext()) {
        OMElement node = (OMElement) messageElements.next();
        if (node.getQName().getLocalPart().equals(FIX_MSG_BODY)) {
            Iterator<?> bodyElements = (Iterator<?>) node.getChildElements();
            while (bodyElements.hasNext()) {
                OMElement bodyNode = (OMElement) bodyElements.next();
                String tag = bodyNode
                        .getAttributeValue(new QName(FIX_MSG_ID));
                String value = bodyNode.getText();
                if (tag.equals(FIX_MSG_SYMBOL)) {
                    inSymbol = value;
                } else if (tag.equals(FIX_MSG_CLORDID)) {
                    inClOrderID = value;
                } else if (tag.equals(FIX_MSG_ORDQTY)) {
                    inQty = value;
                }
            }
        }
    }
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:38,代码来源:AMQPConsumer.java


示例17: getBSTHeader

import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; //导入依赖的package包/类
private String getBSTHeader(Request request) throws IOException, XMLStreamException {
    org.apache.coyote.Request coyoteReq = request.getCoyoteRequest();
    InputBuffer buf = coyoteReq.getInputBuffer();
    ByteChunk bc = new ByteChunk();

    buf.doRead(bc, coyoteReq);
    try (InputStream is = new ByteArrayInputStream(getUTF8Bytes(bc.toString()))) {
        XMLStreamReader reader = StAXUtils.createXMLStreamReader(is);
        StAXBuilder builder = new StAXSOAPModelBuilder(reader);
        SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement();
        envelope.build();

        SOAPHeader header = envelope.getHeader();
        Iterator headerEls = header.getChildrenWithLocalName("Security");
        if (!headerEls.hasNext()) {
            return null;
        }
        OMElement securityHeader = (OMElement) headerEls.next();
        Iterator securityHeaderEls = securityHeader.getChildrenWithLocalName("BinarySecurityToken");
        if (!securityHeaderEls.hasNext()) {
            return null;
        }
        OMElement bstHeader = (OMElement) securityHeaderEls.next();
        bstHeader.build();
        return bstHeader.getText();
    }
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:28,代码来源:BSTAuthenticator.java


示例18: getEnvelope

import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; //导入依赖的package包/类
/**
 * Create a SOAP envelope using SOAP 1.1 or 1.2 depending on the namespace
 * @param in InputStream for the payload
 * @param namespace the SOAP namespace
 * @return the SOAP envelope for the correct version
 * @throws javax.xml.stream.XMLStreamException on error
 */
public static SOAPEnvelope getEnvelope(InputStream in, String namespace) throws XMLStreamException {

    try {
        in.reset();
    } catch (IOException ignore) {}
    XMLStreamReader xmlreader =
        StAXUtils.createXMLStreamReader(in, MessageContext.DEFAULT_CHAR_SET_ENCODING);
    StAXBuilder builder = new StAXSOAPModelBuilder(xmlreader, namespace);
    return (SOAPEnvelope) builder.getDocumentElement();
}
 
开发者ID:wso2,项目名称:wso2-axis2-transports,代码行数:18,代码来源:BaseUtils.java


示例19: decode

import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; //导入依赖的package包/类
public XMLMessage decode(ContentType contentType, String message) throws Exception {
    XMLMessage.Type type = XMLMessage.getTypeFromContentType(contentType);
    if (type == null) {
        throw new Exception("Unrecognized content type " + contentType);
    }
    XMLStreamReader reader = StAXUtils.createXMLStreamReader(new StringReader(message));
    OMElement payload;
    if (type == XMLMessage.Type.POX) {
        payload = new StAXOMBuilder(reader).getDocumentElement();
    } else {
        payload = new StAXSOAPModelBuilder(reader).getSOAPEnvelope().getBody().getFirstElement();
    }
    return new XMLMessage(payload, type);
}
 
开发者ID:wso2,项目名称:wso2-axis2-transports,代码行数:15,代码来源:MessageDecoder.java


示例20: processDocument

import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; //导入依赖的package包/类
/**
 * Returns a OMElement handler to the document element of the Fast Infoset message.
 * 
 * @param inputStream InputStream to the message
 * @param contentType Content type of the message
 * @param messageContext MessageContext to be used
 * 
 * @return OMElement handler to the document element
 * 
 * @see org.apache.axis2.builder.Builder#processDocument(InputStream, String, MessageContext)
 */
public OMElement processDocument(InputStream inputStream, String contentType, 
		MessageContext messageContext) throws AxisFault {
	if (logger.isDebugEnabled()) {
		logger.debug("Processing a Document with the content type: " + contentType);
	}
	//Create a instance of the StAX Parser which can handle the fast infoset stream 
	XMLStreamReader streamReader = new StAXDocumentParser(inputStream);
	StAXBuilder builder = new StAXSOAPModelBuilder(streamReader);

	return builder.getDocumentElement();
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:23,代码来源:FastInfosetBuilder.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JasperRunManager类代码示例发布时间:2022-05-22
下一篇:
Java Handle类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap