Package org.apache.cxf.databinding

Examples of org.apache.cxf.databinding.DataBinding


    }
   
    @Test
    public void testJAXBWrite() throws Exception {
        Service s = new JAXRSServiceImpl(Collections.singletonList(c), true);
        DataBinding binding = new JAXBDataBinding();
        binding.initialize(s);
        DataBindingProvider<Book> p = new DataBindingProvider<Book>(binding);
        Book b = new Book("CXF", 127L);
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        p.writeTo(b, Book.class, Book.class,
            new Annotation[0], MediaType.TEXT_XML_TYPE, new MetadataMap<String, Object>(), bos);
View Full Code Here


   
    @Test
    public void testJAXBRead() throws Exception {
        String data = "<Book><id>127</id><name>CXF</name><state></state></Book>";
        Service s = new JAXRSServiceImpl(Collections.singletonList(c), true);
        DataBinding binding = new JAXBDataBinding();
        binding.initialize(s);
        DataBindingProvider<Book> p = new DataBindingProvider<Book>(binding);
        ByteArrayInputStream is = new ByteArrayInputStream(data.getBytes());
        Book book = p.readFrom(Book.class, Book.class,
                               new Annotation[0], MediaType.APPLICATION_XML_TYPE,
                               new MetadataMap<String, String>(), is);
View Full Code Here

   
    
    protected DataBinding createDefaultDataBinding() {
       
        DataBinding retVal = null;
       
        if (getServiceClass() != null) {
            org.apache.cxf.annotations.DataBinding db
                = getServiceClass().getAnnotation(org.apache.cxf.annotations.DataBinding.class);
            if (db != null) {
View Full Code Here

        //Initialize Features.
        configureObject(portName.toString() + ".jaxws-client.proxyFactory", clientFac);

        AbstractServiceFactoryBean sf = null;
        try {
            DataBinding db;
            if (context != null) {
                db = new JAXBDataBinding(context);
            } else {
                db = new SourceDataBinding();
            }
View Full Code Here

                } catch (Exception ex) {
                    LOG.warning("DataBinding " + ann.value() + " can not be loaded");
                }
            }
        }
        DataBinding db = getDataBinding();
        if (db == null) {
            return;
        }
        if (db instanceof PropertiesAwareDataBinding) {
            Map<Class<?>, Type> allClasses = ResourceUtils.getAllRequestResponseTypes(cris, false);
            Map<String, Object> props = new HashMap<String, Object>();
            props.put(PropertiesAwareDataBinding.TYPES_PROPERTY, allClasses);
            ((PropertiesAwareDataBinding)db).initialize(props);
        } else {
            if (s instanceof JAXRSServiceImpl) {
                ((JAXRSServiceImpl)s).setCreateServiceModel(true);
            }
            db.initialize(s);
        }
        factory.setUserProviders(Collections.singletonList(new DataBindingProvider<Object>(db)));
    }
View Full Code Here

    }
   
    @Test
    public void testSDOStructureJSON() throws Exception {
        JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
        DataBinding db = new SDODataBinding();
        bean.setDataBinding(db);
        DataBindingJSONProvider<Structure> provider = new DataBindingJSONProvider<Structure>();
        provider.setNamespaceMap(Collections.singletonMap("http://apache.org/structure/types", "p0"));
        provider.setDataBinding(db);
        bean.setProvider(provider);
View Full Code Here

       
        buildInterfaceInfo(si, protocol);

        WrappedService service = new WrappedService(applicationEndpoint.getService(), serviceQName, si);

        DataBinding dataBinding = null;
        Class<?> create = protocol.getCodec().getCreateSequenceType();
        try {
            JAXBContext ctx =
                JAXBContext.newInstance(PackageUtils.getPackageName(create), create.getClassLoader());
            dataBinding = new JAXBDataBinding(ctx);
View Full Code Here

        //Initialize Features.
        configureObject(portName.toString() + ".jaxws-client.proxyFactory", clientFac);

        AbstractServiceFactoryBean sf = null;
        try {
            DataBinding db;
            if (context != null) {
                db = new JAXBDataBinding(context);
            } else {
                db = new SourceDataBinding();
            }
View Full Code Here

       
        SoapBodyInfo sbi = bmi.getExtensor(SoapBodyInfo.class);
       
        if (sbi == null || sbi.getAttachments() == null || sbi.getAttachments().size() == 0) {
            Service s = ex.getService();
            DataBinding db = s.getDataBinding();
            if (db instanceof JAXBDataBinding
                && hasSwaRef((JAXBDataBinding) db)) {
                setupAttachmentOutput(message);
            }
            return;
View Full Code Here

                    XMLStreamWriter writer = xtw;
                    if (header instanceof SoapHeader) {
                        SoapHeader soapHeader = (SoapHeader)header;
                        writer = new SOAPHeaderWriter(xtw, soapHeader, soapVersion, soapPrefix);
                    }
                    DataBinding b = header.getDataBinding();
                    if (b == null) {
                        HeaderProcessor hp = bus.getExtension(HeaderManager.class)
                                .getHeaderProcessor(header.getName().getNamespaceURI());
                        if (hp != null) {
                            b = hp.getDataBinding();
                        }
                    }
                    if (b != null) {
                        MessagePartInfo part = new MessagePartInfo(header.getName(), null);
                        part.setConcreteName(header.getName());
                        b.createWriter(XMLStreamWriter.class)
                            .write(header.getObject(), part, writer);
                    } else {
                        Element node = (Element)header.getObject();
                        StaxUtils.copy(node, writer);
                    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.databinding.DataBinding

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.