Package org.apache.servicemix.jbi.jaxp

Examples of org.apache.servicemix.jbi.jaxp.StaxSource


        }
        // Check if we should not use the JBI wrapper
        if (message.get(JbiConstants.USE_JBI_WRAPPER) instanceof Boolean && !((Boolean) message.get(JbiConstants.USE_JBI_WRAPPER))) {
            XMLStreamReader xmlReader = message.getContent(XMLStreamReader.class);
            if (xmlReader != null) {
                message.setContent(Source.class, new StaxSource(xmlReader));
            }
            return;
        }
       
        BindingOperationInfo wsdlOperation = getOperation(message);
View Full Code Here


            message.setBodyName(childName);
            // Check for fault
            if (childName.equals(new QName(soapUri, SoapMarshaler.FAULT))) {
                message.setFault(readFaultUsingStax(reader));
            } else {
                message.setSource(new StaxSource(new FragmentStreamReader(reader)));
            }
    }
    return message;
  }
View Full Code Here

   
    private SoapFault readFaultUsingStax(XMLStreamReader reader) throws SoapFault {
        try {
            FragmentStreamReader rh = new FragmentStreamReader(reader);
            Document doc = (Document) marshaler.getSourceTransformer().toDOMNode(
                    new StaxSource(rh));
            return readFaultUsingDom(doc.getDocumentElement());
        } catch (SoapFault e) {
            throw e;
        } catch (Exception e) {
            throw new SoapFault(e);
View Full Code Here

      throws Exception {
    while (reader.nextTag() != XMLStreamConstants.END_ELEMENT) {
      QName hn = reader.getName();
      FragmentStreamReader rh = new FragmentStreamReader(reader);
      Document doc = (Document) marshaler.getSourceTransformer().toDOMNode(
          new StaxSource(rh));
      DocumentFragment df = doc.createDocumentFragment();
      df.appendChild(doc.getDocumentElement());
      message.addHeader(hn, df);
    }
  }
View Full Code Here

            message.setBodyName(childName);
            // Check for fault
            if (childName.equals(new QName(soapUri, SoapMarshaler.FAULT))) {
                message.setFault(readFaultUsingStax(reader));
            } else {
                message.setSource(new StaxSource(new FragmentStreamReader(reader)));
            }
    }
    return message;
  }
View Full Code Here

   
    private SoapFault readFaultUsingStax(XMLStreamReader reader) throws SoapFault {
        try {
            FragmentStreamReader rh = new FragmentStreamReader(reader);
            Document doc = (Document) marshaler.getSourceTransformer().toDOMNode(
                    new StaxSource(rh));
            return readFaultUsingDom(doc.getDocumentElement());
        } catch (SoapFault e) {
            throw e;
        } catch (Exception e) {
            throw new SoapFault(e);
View Full Code Here

      throws Exception {
    while (reader.nextTag() != XMLStreamConstants.END_ELEMENT) {
      QName hn = reader.getName();
      FragmentStreamReader rh = new FragmentStreamReader(reader);
      Document doc = (Document) marshaler.getSourceTransformer().toDOMNode(
          new StaxSource(rh));
      DocumentFragment df = doc.createDocumentFragment();
      df.appendChild(doc.getDocumentElement());
      message.addHeader(hn, df);
    }
  }
View Full Code Here

    private static final Log log = LogFactory.getLog(StaxSourceTest.class);

    public void testStaxSourceOnStream() throws Exception {
        InputStream is = getClass().getResourceAsStream("test.xml");
        XMLStreamReader xsr = XMLInputFactory.newInstance().createXMLStreamReader(is);
        StaxSource ss = new StaxSource(xsr);
        StringWriter buffer = new StringWriter();
        Transformer transformer = TransformerFactory.newInstance().newTransformer();
        transformer.transform(ss, new StreamResult(buffer));
        log.info(buffer.toString());
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
View Full Code Here

    }

    public void testStaxSourceOnDOM() throws Exception {
        InputStream is = getClass().getResourceAsStream("test.xml");
        XMLStreamReader xsr = XMLInputFactory.newInstance().createXMLStreamReader(is);
        StaxSource ss = new StaxSource(xsr);
        Transformer transformer = TransformerFactory.newInstance().newTransformer();
        DOMResult result = new DOMResult();
        transformer.transform(ss, result);
        assertNotNull(result.getNode());
    }
View Full Code Here

    }

    public void testStaxToDOM() throws Exception {
        InputStream is = getClass().getResourceAsStream("test.xml");
        XMLStreamReader xsr = XMLInputFactory.newInstance().createXMLStreamReader(is);
        StaxSource ss = new StaxSource(xsr);
        DOMSource src = new SourceTransformer().toDOMSource(ss);
        assertNotNull(src);
        assertNotNull(src.getNode());
        NodeList nl = ((Document) src.getNode()).getDocumentElement().getElementsByTagName("long");
        assertEquals(1, nl.getLength());
View Full Code Here

TOP

Related Classes of org.apache.servicemix.jbi.jaxp.StaxSource

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.