Examples of StAXSource


Examples of org.apache.cxf.staxutils.StaxSource

    }

    public Object read(QName name, Node input, Class type) {
        if (SAXSource.class.isAssignableFrom(type)) {
            XMLStreamReader reader = StaxUtils.createXMLStreamReader((Element)input);
            return new StaxSource(reader);
        } else if (StreamSource.class.isAssignableFrom(type)) {
            try {
                CachedOutputStream out = new CachedOutputStream();               
                DOMUtils.writeXml(input, out);
                InputStream is = out.getInputStream();
View Full Code Here

Examples of org.apache.cxf.staxutils.StaxSource

            }
           
            if (unmarshaller.getClass().getName().contains("eclipse")) {
                //eclipse MOXy doesn't work properly with the XMLFilter/Reader thing
                //so we need to bounce through a DOM
                Source reader = new StaxSource(StaxUtils.createXMLStreamReader(is));
                DOMResult dom = new DOMResult();
                t.newTransformer().transform(reader, dom);
                return unmarshaller.unmarshal(dom.getNode());
            }
            XMLFilter filter = null;
            try {
                filter = factory.newXMLFilter(t);
            } catch (TransformerConfigurationException ex) {
                TemplatesImpl ti = (TemplatesImpl)t;
                filter = factory.newXMLFilter(ti.getTemplates());
                trySettingProperties(filter, ti);
            }
            XMLReader reader = new StaxSource(StaxUtils.createXMLStreamReader(is));
            filter.setParent(reader);
            SAXSource source = new SAXSource();
            source.setXMLReader(filter);
            if (systemId != null) {
                source.setSystemId(systemId);
View Full Code Here

Examples of org.apache.cxf.staxutils.StaxSource

    protected Object unmarshalFromReader(Unmarshaller unmarshaller, XMLStreamReader reader, MediaType mt)
        throws JAXBException {
        CachedOutputStream out = new CachedOutputStream();
        try {
            XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(out);
            StaxUtils.copy(new StaxSource(reader), writer);
            writer.writeEndDocument();
            writer.flush();
            writer.close();
            return unmarshalFromInputStream(unmarshaller, out.getInputStream(), mt);
        } catch (Exception ex) {
View Full Code Here

Examples of org.apache.cxf.staxutils.StaxSource

                    //ignore
                }
            }
        } else if (SAXSource.class.isAssignableFrom(theSource)
                  || StaxSource.class.isAssignableFrom(theSource)) {
            return source.cast(new StaxSource(getReader(is)));
        } else if (StreamSource.class.isAssignableFrom(theSource)
                   || Source.class.isAssignableFrom(theSource)) {
            return source.cast(new StreamSource(getRealStream(is)));
        } else if (XMLSource.class.isAssignableFrom(theSource)) {
            return source.cast(new XMLSource(getRealStream(is)));
View Full Code Here

Examples of org.apache.cxf.staxutils.StaxSource

        return new WebServiceException(ex);
    }
   
    @SuppressWarnings("unchecked")
    public T invoke(T obj, boolean isOneWay) {
        StaxSource createdSource = null;
        checkError();       
        try {
            if (obj instanceof SOAPMessage) {
                SOAPMessage msg = (SOAPMessage)obj;
                if (msg.countAttachments() > 0) {
                    client.getRequestContext().put(AttachmentOutInterceptor.WRITE_ATTACHMENTS, Boolean.TRUE);
                }
            } else if (context != null) {
                Boolean unwrapProperty = obj instanceof JAXBElement ? Boolean.FALSE : Boolean.TRUE;
                getRequestContext().put("unwrap.jaxb.element", unwrapProperty);
            }
            QName opName = (QName)getRequestContext().get(MessageContext.WSDL_OPERATION);
            boolean findDispatchOp = Boolean.TRUE.equals(getRequestContext().get("find.dispatch.operation"));
           
            boolean hasOpName;
            if (opName == null) {
                hasOpName = false;
                opName = isOneWay ? INVOKE_ONEWAY_QNAME : INVOKE_QNAME;
            } else {
                hasOpName = true;
                BindingOperationInfo bop = client.getEndpoint().getBinding()
                                            .getBindingInfo().getOperation(opName);
                if (bop == null) {
                    addInvokeOperation(opName, isOneWay);
                }
            }
           
            //CXF-2836 : find the operation for the dispatched object
            // if findDispatchOp is already true, skip the addressing feature lookup.
            // if the addressing feature is enabled, set findDispatchOp to true
            if (!findDispatchOp) {
                // the feature list to be searched is the endpoint and the bus's lists
                List<Feature> endpointFeatures
                    = ((JaxWsClientEndpointImpl)client.getEndpoint()).getFeatures();
                List<Feature> allFeatures;
                if (client.getBus().getFeatures() != null) {
                    allFeatures = new ArrayList<Feature>(endpointFeatures.size()
                        + client.getBus().getFeatures().size());
                    allFeatures.addAll(endpointFeatures);
                    allFeatures.addAll(client.getBus().getFeatures());
                } else {
                    allFeatures = endpointFeatures;
                }
                for (Feature feature : allFeatures) {
                    if (feature instanceof WSAddressingFeature) {
                        findDispatchOp = true;
                    }
                }
            }
            Map<String, QName> payloadOPMap = createPayloadEleOpNameMap(
                    client.getEndpoint().getBinding().getBindingInfo(), hasOpName);
            if (findDispatchOp && !payloadOPMap.isEmpty()) {
                QName payloadElementName = null;
                if (obj instanceof javax.xml.transform.Source) {
                    XMLStreamReader reader = null;
                    try {
                        reader = StaxUtils.createXMLStreamReader((javax.xml.transform.Source)obj);
                        Document document = StaxUtils.read(reader);
                        createdSource = new StaxSource(StaxUtils.createXMLStreamReader(document));
                        payloadElementName = getPayloadElementName(document.getDocumentElement());
                    } catch (Exception e) {                       
                        // ignore, we are trying to get the operation name
                    } finally {
                        StaxUtils.close(reader);
View Full Code Here

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

Examples of org.mule.module.xml.stax.StaxSource

    public void testCloseStaxSourceOnComponentException()
        throws MuleException, InterruptedException, XMLStreamException,
        FactoryConfigurationError
    {

        StaxSource stream = new StaxSource(new TestXMLStreamReader(XMLInputFactory.newInstance()
            .createXMLStreamReader(inputStream)));

        client.dispatch("vm://inEcho?connector=vm", stream, null);

        Thread.sleep(timeoutMs);
        assertTrue(((TestXMLStreamReader) stream.getXMLStreamReader()).isClosed());
    }
View Full Code Here

Examples of org.springframework.xml.transform.StaxSource

            public void warning(SAXParseException exception) throws SAXException {
                throw exception;
            }
        });
        validator.validate(new StaxSource(element.getXMLStreamReader()));
        String pidString = element.getAttributeValue(new QName(SyslogConstants.PID));
        return new SyslogMessage(element.getAttributeValue(new QName(SyslogConstants.FACILITY)),
                                 element.getAttributeValue(new QName(SyslogConstants.SEVERITY)),
                                 element.getAttributeValue(new QName(SyslogConstants.TAG)),
                                 pidString == null ? -1 : Integer.parseInt(pidString),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.