Package org.apache.cxf.service.model

Examples of org.apache.cxf.service.model.TypeInfo


    public void testSchema() {
        XmlSchemaCollection schemas = serviceInfo.getProperty(WSDLServiceBuilder.WSDL_SCHEMA_LIST,
                XmlSchemaCollection.class);
        assertNotNull(schemas);
        TypeInfo typeInfo = serviceInfo.getTypeInfo();
        assertNotNull(typeInfo);
        assertEquals(typeInfo.getSchemas().size(), 1);
        SchemaInfo schemaInfo = typeInfo.getSchemas().iterator().next();
        assertNotNull(schemaInfo);
        assertEquals(schemaInfo.getNamespaceURI(), "http://apache.org/hello_world_soap_http/types");
        assertEquals(schemas.read(schemaInfo.getElement()).getTargetNamespace(),
                "http://apache.org/hello_world_soap_http/types");
        // add below code to test the creation of javax.xml.validation.Schema
View Full Code Here


            XMLUtils.writeTo(doc, fout);
            fout.flush();
            fout.close();
        }
        setUpWSDL(IMPORT_WSDL_PATH);
        TypeInfo types = serviceInfo.getTypeInfo();
        assertNotNull(types);
        assertNotNull(types.getSchemas());
        Element ele = types.getSchemas().iterator().next().getElement();
        assertNotNull(ele);
        Schema schema = EndpointReferenceUtils.getSchema(serviceInfo);       
        assertNotNull(schema);       
    }
View Full Code Here

    public ServiceInfo buildService(Definition def, Service serv) {
        ServiceInfo service = new ServiceInfo();
        service.setProperty(WSDL_DEFINITION, def);
        service.setProperty(WSDL_SERVICE, serv);

        TypeInfo typeInfo = new TypeInfo(service);
        XmlSchemaCollection schemas = getSchemas(def, typeInfo);
        service.setProperty(WSDL_SCHEMA_LIST, schemas);
        service.setTypeInfo(typeInfo);
        service.setTargetNamespace(def.getTargetNamespace());
        service.setName(serv.getQName());
View Full Code Here

            if (op.hasOutput()) {
                createWrappedMessage(op.getOutput(), op.getUnwrappedOperation().getOutput(), schema);
            }
        }
       
        TypeInfo typeInfo = serviceInfo.getTypeInfo();
        if (typeInfo == null) {
            typeInfo = new TypeInfo(serviceInfo);
            serviceInfo.setTypeInfo(typeInfo);
        }
       
        Document[] docs;
        try {
            docs = XmlSchemaSerializer.serializeSchema(schema, false);
        } catch (XmlSchemaSerializerException e1) {
            throw new ServiceConstructionException(e1);
        }
        Element e = docs[0].getDocumentElement();
        SchemaInfo schemaInfo = new SchemaInfo(typeInfo, getServiceNamespace());
        schemaInfo.setElement(e);
        typeInfo.addSchema(schemaInfo);
    }
View Full Code Here

        }

        col = new XmlSchemaCollection();

        try {
            TypeInfo typeInfo = serviceInfo.getTypeInfo();
            if (typeInfo == null) {
                typeInfo = new TypeInfo(serviceInfo);
                serviceInfo.setTypeInfo(typeInfo);
            }

            for (DOMResult r : generateJaxbSchemas()) {
                Document d = (Document)r.getNode();
                String ns = d.getDocumentElement().getAttribute("targetNamespace");
                if (ns == null) {
                    ns = "";
                }

                NodeList nodes = d.getDocumentElement().getChildNodes();
                for (int i = 0; i < nodes.getLength(); i++) {
                    Node n = nodes.item(i);
                    if (n instanceof Element) {
                        Element e = (Element) n;
                        if (e.getLocalName().equals("import")) {
                            d.getDocumentElement().removeChild(e);
                        }
                    }
                }
               
                // Don't include WS-Addressing bits
                if ("http://www.w3.org/2005/08/addressing/wsdl".equals(ns)) {
                    continue;
                }

                SchemaInfo schema = new SchemaInfo(typeInfo, ns);
                schema.setElement(d.getDocumentElement());
                typeInfo.addSchema(schema);
                col.read(d.getDocumentElement());
            }
        } catch (IOException e) {
            throw new ServiceConstructionException(new Message("SCHEMA_GEN_EXC", BUNDLE), e);
        }
View Full Code Here

TOP

Related Classes of org.apache.cxf.service.model.TypeInfo

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.