Package org.apache.axis2.om.impl.llom.builder

Examples of org.apache.axis2.om.impl.llom.builder.StAXBuilder


    public SOAPEnvelope createSOAPEnvelope(InputStream in) throws AxisFault {
        try {
            XMLStreamReader xmlreader =
                XMLInputFactory.newInstance().createXMLStreamReader(in);
            StAXBuilder builder = new StAXSOAPModelBuilder(xmlreader);
            return (SOAPEnvelope) builder.getDocumentElement();
        } catch (Exception e) {
            throw new AxisFault(e.getMessage(), e);
        }
    }
View Full Code Here


                }else if(mimeMessage.getContentType().indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) > -1){
                    soapNamespaceURI = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;

                }

                StAXBuilder builder = new StAXSOAPModelBuilder(reader, soapNamespaceURI);

                SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement();
                msgContext.setEnvelope(envelope);
                if (envelope.getBody().hasFault()) {
                    engine.receiveFault(msgContext);
                } else {
                    engine.receive(msgContext);
View Full Code Here

            XMLStreamReader reader =
                XMLInputFactory.newInstance().createXMLStreamReader(
                    new BufferedReader(new InputStreamReader(in)));

            StAXBuilder builder = new StAXSOAPModelBuilder(reader, null);
            SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement();
            msgCtx.setEnvelope(envelope);
            AxisEngine engine = new AxisEngine(confContext);

            if (envelope.getBody().hasFault()) {
                engine.receiveFault(msgCtx);
View Full Code Here

                                HTTPConstants.MTOM_RECIVED_CONTENT_TYPE);
            } else {
                throw new AxisFault(Messages.getMessage("cannotBeNullOperationContext"));
            }

            StAXBuilder builder = null;
            SOAPEnvelope envelope = null;

            String charSetEnc = (String)msgContext.getProperty(MessageContext.CHARACTER_SET_ENCODING);
            if(charSetEnc == null) {
              charSetEnc = MessageContext.DEFAULT_CHAR_SET_ENCODING;
            }
           
      if (contentType != null) {
                msgContext.setDoingMTOM(true);
                builder =
                        HTTPTransportUtils.selectBuilderForMIME(msgContext,
                                inStream,
                                (String) contentType);
                envelope = (SOAPEnvelope) builder.getDocumentElement();
            } else if (msgContext.isDoingREST()) {
                XMLStreamReader xmlreader =
                        XMLInputFactory.newInstance().createXMLStreamReader(
                                inStream,charSetEnc);
                SOAPFactory soapFactory = new SOAP11Factory();
                builder = new StAXOMBuilder(xmlreader);
                builder.setOmbuilderFactory(soapFactory);
                envelope = soapFactory.getDefaultEnvelope();
                envelope.getBody().addChild(builder.getDocumentElement());
            } else {
                XMLStreamReader xmlreader =
                        XMLInputFactory.newInstance().createXMLStreamReader(
                            inStream,charSetEnc);
                builder = new StAXSOAPModelBuilder(xmlreader, soapNamespaceURI);
                envelope = (SOAPEnvelope) builder.getDocumentElement();
            }
            return envelope;
        } catch (Exception e) {
            throw new AxisFault(e);
        }
View Full Code Here

    public SOAPEnvelope createSOAPEnvelope(InputStream in) throws AxisFault {
        try {
            XMLStreamReader xmlreader =
                    XMLInputFactory.newInstance().createXMLStreamReader(in);
            StAXBuilder builder = new StAXSOAPModelBuilder(xmlreader, null);
            return (SOAPEnvelope) builder.getDocumentElement();
        } catch (Exception e) {
            throw new AxisFault(e.getMessage(), e);
        }
    }
View Full Code Here

                soapNamespaceURI = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;
            } else if (mimeMessage.getContentType().indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) > -1) {
                soapNamespaceURI = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;

            }
            StAXBuilder builder = new StAXSOAPModelBuilder(reader, soapNamespaceURI);

            SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement();
            msgContext.setEnvelope(envelope);
            if (envelope.getBody().hasFault()) {
                engine.receiveFault(msgContext);
            } else {
                engine.receive(msgContext);
View Full Code Here

            msgContext.setTo(new EndpointReference(requestURI));
            msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
            msgContext.setServerSide(true);

            SOAPEnvelope envelope = null;
            StAXBuilder builder = null;
            if (contentType != null) {
                if (contentType
                    .indexOf(HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED)
                    > -1) {
                    //It is MTOM
                    builder = selectBuilderForMIME(msgContext, in, contentType);
                    envelope = (SOAPEnvelope) builder.getDocumentElement();
                } else {
                    Reader reader = new InputStreamReader(in);

                    XMLStreamReader xmlreader;
                    //Figure out the char set encoding and create the reader

                    //If charset is not specified
                    if (contentType.indexOf(HTTPConstants.CHAR_SET_ENCODING)
                        == -1) {
                        xmlreader =
                            XMLInputFactory
                                .newInstance()
                                .createXMLStreamReader(
                                in,
                                MessageContext.DEFAULT_CHAR_SET_ENCODING);
                        //Set the encoding scheme in the message context
                        msgContext.setProperty(
                            MessageContext.CHARACTER_SET_ENCODING,
                            MessageContext.DEFAULT_CHAR_SET_ENCODING);
                    } else {
                        //get the type of char encoding
                        String charSetEnc = getCharSetEncoding(contentType);
                        xmlreader =
                            XMLInputFactory
                                .newInstance()
                                .createXMLStreamReader(
                                in,
                                charSetEnc);

                        //Setting the value in msgCtx
                        msgContext.setProperty(
                            MessageContext.CHARACTER_SET_ENCODING,
                            charSetEnc);

                    }
                    if (contentType
                        .indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE)
                        > -1) {
                        soap11 = false;
                        //it is SOAP 1.2
                        builder =
                            new StAXSOAPModelBuilder(
                                xmlreader,
                                SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
                        envelope = (SOAPEnvelope) builder.getDocumentElement();
                    } else if (
                        contentType.indexOf(
                            SOAP11Constants.SOAP_11_CONTENT_TYPE)
                            > -1) {
                        soap11 = true;
                        //it is SOAP 1.1
                        Object enable =
                            msgContext.getProperty(
                                Constants.Configuration.ENABLE_REST);
                        if ((soapActionHeader == null
                            || soapActionHeader.length() == 0)
                            && Constants.VALUE_TRUE.equals(enable)) {
                            //If the content Type is text/xml (BTW which is the SOAP 1.1 Content type ) and
                            //the SOAP Action is absent it is rest !!
                            msgContext.setDoingREST(true);

                            SOAPFactory soapFactory = new SOAP11Factory();
                            builder = new StAXOMBuilder(xmlreader);
                            builder.setOmbuilderFactory(soapFactory);
                            envelope = soapFactory.getDefaultEnvelope();
                            envelope.getBody().addChild(
                                builder.getDocumentElement());
                        } else {
                            builder =
                                new StAXSOAPModelBuilder(
                                    xmlreader,
                                    SOAP11Constants
                                        .SOAP_ENVELOPE_NAMESPACE_URI);
                            envelope =
                                (SOAPEnvelope) builder.getDocumentElement();
                        }
                    }

                }
View Full Code Here

        InputStream inStream,
        String contentTypeString)
        throws OMException,
      XMLStreamException, FactoryConfigurationError,
      UnsupportedEncodingException {
        StAXBuilder builder = null;

        boolean fileCacheForAttachments =
            (Constants
                .VALUE_TRUE
                .equals(
View Full Code Here

            String message = mimeMessage.getContent().toString();
            System.out.println("message["+message+"]");
            ByteArrayInputStream bais =
                new ByteArrayInputStream(message.getBytes());
            XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(bais);
            StAXBuilder builder = new StAXSOAPModelBuilder(reader);
            msgContext.setEnvelope((SOAPEnvelope) builder.getDocumentElement());
            // invoke the Axis engine
            engine.receive(msgContext);
        } catch (Exception e) {
            AxisFault af;
            if (e instanceof AxisFault) {
View Full Code Here

        params = getListenerParameters();


        param = transportIn.getParameter(NhttpConstants.ENDPOINTS_CONFIGURATION);
        if (param != null && param.getValue() != null) {
            endpoints = new URLEndpointsConfigurationFactory().create(param.getValue().toString());
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.axis2.om.impl.llom.builder.StAXBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.