Package org.apache.cxf.databinding.source

Examples of org.apache.cxf.databinding.source.NodeDataReader


    @Override
    public <T> DataReader<T> createReader(Class<T> cls) {
        if (cls == XMLStreamReader.class) {
            return (DataReader<T>) new XMLStreamDataReader();
        } else if (cls == Node.class) {
            return (DataReader<T>) new NodeDataReader();
        } else {
            throw new UnsupportedOperationException("The type " + cls.getName() + " is not supported.");
        }
    }
View Full Code Here


    public HybridSourceDataBinding() {
        super();
        this.xsrReader = new XMLStreamDataReader();
        this.xswWriter = new XMLStreamDataWriter();

        this.nodeReader = new NodeDataReader();
        this.nodeWriter = new NodeDataWriter();
    }
View Full Code Here

    @Override
    public <T> DataReader<T> createReader(Class<T> cls) {
        if (cls == XMLStreamReader.class) {
            return (DataReader<T>) new XMLStreamDataReader();
        } else if (cls == Node.class) {
            return (DataReader<T>) new NodeDataReader();
        } else {
            throw new UnsupportedOperationException("The type " + cls.getName() + " is not supported.");
        }
    }
View Full Code Here

            //Convert SOAPMessage to Source
            if (message instanceof SoapMessage) {
                SOAPMessage soapMessage = message.getContent(SOAPMessage.class);
                message.removeContent(SOAPMessage.class);
                setupBindingOperationInfo(message.getExchange(), soapMessage);
                DataReader<Node> dataReader = new NodeDataReader();
                Node n = null;
                if (mode == Service.Mode.MESSAGE) {
                    try {
                        n = soapMessage.getSOAPPart();
                        //This seems to be a problem in SAAJ. Envelope might not be initialized properly
                        //without calling getEnvelope()
                        soapMessage.getSOAPPart().getEnvelope();
                        if (soapMessage.countAttachments() > 0) {
                            if (message.getAttachments() == null) {
                                message.setAttachments(new ArrayList<Attachment>(soapMessage
                                        .countAttachments()));
                            }
                            Iterator<AttachmentPart> it = CastUtils.cast(soapMessage.getAttachments());
                            while (it.hasNext()) {
                                AttachmentPart part = it.next();
                                AttachmentImpl att = new AttachmentImpl(part.getContentId());
                                att.setDataHandler(part.getDataHandler());
                                Iterator<MimeHeader> it2 = CastUtils.cast(part.getAllMimeHeaders());
                                while (it2.hasNext()) {
                                    MimeHeader header = it2.next();
                                    att.setHeader(header.getName(), header.getValue());
                                }
                                message.getAttachments().add(att);
                            }
                        }
                    } catch (SOAPException e) {
                        throw new Fault(e);
                    }
                } else if (mode == Service.Mode.PAYLOAD) {
                    try {
                        n = DOMUtils.getChild(soapMessage.getSOAPBody(), Node.ELEMENT_NODE);
                    } catch (SOAPException e) {
                        throw new Fault(e);
                    }
                }
               
                Class tempType = type;
                if (!Source.class.isAssignableFrom(type)) {
                    tempType = Source.class;
                }
                obj = dataReader.read(null, n, tempType);

                message.setContent(Source.class, obj);
            }
        }
View Full Code Here

    @Override
    public <T> DataReader<T> createReader(Class<T> cls) {
        if (cls == XMLStreamReader.class) {
            return (DataReader<T>) new XMLStreamDataReader();
        } else if (cls == Node.class) {
            return (DataReader<T>) new NodeDataReader();
        } else {
            throw new UnsupportedOperationException("The type " + cls.getName() + " is not supported.");
        }
    }
View Full Code Here

            //Convert SOAPMessage to Source
            if (message instanceof SoapMessage) {
                SOAPMessage soapMessage = message.getContent(SOAPMessage.class);
                message.removeContent(SOAPMessage.class);
                setupBindingOperationInfo(message.getExchange(), soapMessage);
                DataReader<Node> dataReader = new NodeDataReader();
                Node n = null;
                if (mode == Service.Mode.MESSAGE) {
                    try {
                        n = soapMessage.getSOAPPart();
                        //This seems to be a problem in SAAJ. Envelope might not be initialized properly
                        //without calling getEnvelope()
                        soapMessage.getSOAPPart().getEnvelope();
                        if (soapMessage.countAttachments() > 0) {
                            if (message.getAttachments() == null) {
                                message.setAttachments(new ArrayList<Attachment>(soapMessage
                                        .countAttachments()));
                            }
                            Iterator<AttachmentPart> it = CastUtils.cast(soapMessage.getAttachments());
                            while (it.hasNext()) {
                                AttachmentPart part = it.next();
                                AttachmentImpl att = new AttachmentImpl(part.getContentId());
                                att.setDataHandler(part.getDataHandler());
                                Iterator<MimeHeader> it2 = CastUtils.cast(part.getAllMimeHeaders());
                                while (it2.hasNext()) {
                                    MimeHeader header = it2.next();
                                    att.setHeader(header.getName(), header.getValue());
                                }
                                message.getAttachments().add(att);
                            }
                        }
                    } catch (SOAPException e) {
                        throw new Fault(e);
                    }
                } else if (mode == Service.Mode.PAYLOAD) {
                    try {
                        n = DOMUtils.getChild(soapMessage.getSOAPBody(), Node.ELEMENT_NODE);
                    } catch (SOAPException e) {
                        throw new Fault(e);
                    }
                }
               
                Class tempType = type;
                if (!Source.class.isAssignableFrom(type)) {
                    tempType = Source.class;
                }
                obj = dataReader.read(null, n, tempType);

                message.setContent(Source.class, obj);
            }
        }
View Full Code Here

            //Convert SOAPMessage to Source
            if (message instanceof SoapMessage) {
                SOAPMessage soapMessage = message.getContent(SOAPMessage.class);
                message.removeContent(SOAPMessage.class);

                DataReader<Node> dataReader = new NodeDataReader();
                Node n = null;
                if (mode == Service.Mode.MESSAGE) {
                    try {
                        n = soapMessage.getSOAPPart();
                        //This seems to be a problem in SAAJ. Envelope might not be initialized properly
                        //without calling getEnvelope()
                        soapMessage.getSOAPPart().getEnvelope();
                    } catch (SOAPException e) {
                        throw new Fault(e);
                    }
                } else if (mode == Service.Mode.PAYLOAD) {
                    try {
                        n = DOMUtils.getChild(soapMessage.getSOAPBody(), Node.ELEMENT_NODE);
                    } catch (SOAPException e) {
                        throw new Fault(e);
                    }
                }
               
                Class tempType = type;
                if (!Source.class.isAssignableFrom(type)) {
                    tempType = Source.class;
                }
                obj = dataReader.read(null, n, tempType);

                message.setContent(Source.class, obj);
            }
        }
View Full Code Here

    @Override
    public <T> DataReader<T> createReader(Class<T> cls) {
        if (cls == XMLStreamReader.class) {
            return (DataReader<T>) new XMLStreamDataReader();
        } else if (cls == Node.class) {
            return (DataReader<T>) new NodeDataReader();
        } else {
            throw new UnsupportedOperationException("The type " + cls.getName() + " is not supported.");
        }
    }
View Full Code Here

            //Convert SOAPMessage to Source
            if (message instanceof SoapMessage) {
                SOAPMessage soapMessage = message.getContent(SOAPMessage.class);
                message.removeContent(SOAPMessage.class);
                setupBindingOperationInfo(message.getExchange(), soapMessage);
                DataReader<Node> dataReader = new NodeDataReader();
                Node n = null;
                if (mode == Service.Mode.MESSAGE) {
                    try {
                        n = soapMessage.getSOAPPart();
                        //This seems to be a problem in SAAJ. Envelope might not be initialized properly
                        //without calling getEnvelope()
                        soapMessage.getSOAPPart().getEnvelope();
                        if (soapMessage.countAttachments() > 0) {
                            if (message.getAttachments() == null) {
                                message.setAttachments(new ArrayList<Attachment>(soapMessage
                                        .countAttachments()));
                            }
                            Iterator<AttachmentPart> it = CastUtils.cast(soapMessage.getAttachments());
                            while (it.hasNext()) {
                                AttachmentPart part = it.next();
                                AttachmentImpl att = new AttachmentImpl(part.getContentId());
                                att.setDataHandler(part.getDataHandler());
                                Iterator<MimeHeader> it2 = CastUtils.cast(part.getAllMimeHeaders());
                                while (it2.hasNext()) {
                                    MimeHeader header = it2.next();
                                    att.setHeader(header.getName(), header.getValue());
                                }
                                message.getAttachments().add(att);
                            }
                        }
                    } catch (SOAPException e) {
                        throw new Fault(e);
                    }
                } else if (mode == Service.Mode.PAYLOAD) {
                    try {
                        n = DOMUtils.getChild(soapMessage.getSOAPBody(), Node.ELEMENT_NODE);
                    } catch (SOAPException e) {
                        throw new Fault(e);
                    }
                }
               
                Class tempType = type;
                if (!Source.class.isAssignableFrom(type)) {
                    tempType = Source.class;
                }
                obj = dataReader.read(null, n, tempType);

                message.setContent(Source.class, obj);
            }
        }
View Full Code Here

    @Override
    public <T> DataReader<T> createReader(Class<T> cls) {
        if (cls == XMLStreamReader.class) {
            return (DataReader<T>) new XMLStreamDataReader();
        } else if (cls == Node.class) {
            return (DataReader<T>) new NodeDataReader();
        } else {
            throw new UnsupportedOperationException("The type " + cls.getName() + " is not supported.");
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.databinding.source.NodeDataReader

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.