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, null);
            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

                msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);

                //create the SOAP Envelope
                Reader in = new InputStreamReader(socket.getInputStream());
                XMLStreamReader xmlreader = XMLInputFactory.newInstance().createXMLStreamReader(in);
                StAXBuilder builder = new StAXSOAPModelBuilder(xmlreader, null);
                SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement();
                msgContext.setEnvelope(envelope);
                if (envelope.getBody().hasFault()) {
                    engine.receiveFault(msgContext);
                } else {
                    engine.receive(msgContext);
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

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

            StAXBuilder builder = new StAXSOAPModelBuilder(reader);
            msgCtx.setEnvelope((SOAPEnvelope) builder.getDocumentElement());
            AxisEngine engine = new AxisEngine(confContext);
            engine.receive(msgCtx);
        } catch (XMLStreamException e) {
            throw new AxisFault(e);
        } catch (FactoryConfigurationError e) {
View Full Code Here

                contentType = opContext.getProperty(HTTPConstants.MTOM_RECIVED_CONTENT_TYPE);
            }else{
                throw new AxisFault("Operation Context can not be Null");
            }

            StAXBuilder builder = null;
            SOAPEnvelope envelope = null;

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

            msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);

            AxisEngine engine = new AxisEngine(configurationContext);
            try {
                XMLStreamReader xmlreader = XMLInputFactory.newInstance().createXMLStreamReader(in);
                StAXBuilder builder = new StAXSOAPModelBuilder(xmlreader);
                msgContext.setEnvelope((SOAPEnvelope) builder.getDocumentElement());
            } catch (Exception e) {
                throw new AxisFault(e.getMessage(), e);
            }
            engine.receive(msgContext);
View Full Code Here

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

      SOAPEnvelope envelope = null;
      StAXBuilder builder = null;


      if (contentType.indexOf(HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED) >= 0){
        builder = selectBuilderForMIME(msgContext, in, contentType);
        envelope = (SOAPEnvelope) builder.getDocumentElement();
      } else if (contentType != null
          && contentType.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) > -1) {
                 //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 !!   
                Object enable =  msgContext.getProperty(Constants.Configuration.ENABLE_REST);
        if ((soapAction == null || soapAction.length() == 0)
            && Constants.VALUE_TRUE.equals(enable)) {
          msgContext.setDoingREST(true);
          SOAPFactory soapFactory = new SOAP11Factory();
                    Reader reader = new InputStreamReader(in);
                    XMLStreamReader xmlreader = XMLInputFactory.newInstance()
                            .createXMLStreamReader(reader);
          builder = new StAXOMBuilder(xmlreader);
          builder.setOmbuilderFactory(soapFactory);
          envelope = soapFactory.getDefaultEnvelope();
          envelope.getBody().addChild(builder.getDocumentElement());
        }
      }

      if (envelope == null) {
                Reader reader = new InputStreamReader(in);
                XMLStreamReader xmlreader = XMLInputFactory.newInstance()
                        .createXMLStreamReader(reader);
        builder = new StAXSOAPModelBuilder(xmlreader);
        envelope = (SOAPEnvelope) builder.getDocumentElement();
      }

      msgContext.setEnvelope(envelope);
      AxisEngine engine = new AxisEngine(configurationContext);
      engine.receive(msgContext);
View Full Code Here

  }

  public static StAXBuilder selectBuilderForMIME(MessageContext msgContext,
      InputStream inStream, String contentTypeString) throws OMException,
      XMLStreamException, FactoryConfigurationError {
    StAXBuilder builder = null;

    boolean fileCacheForAttachments = (Constants.VALUE_TRUE.equals(msgContext.getProperty(Constants.Configuration.CACHE_ATTACHMENTS)));
    String attachmentRepoDir=null;
    if (fileCacheForAttachments)
    {
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) {
            e.printStackTrace();
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.