Package javax.wsdl.extensions.schema

Examples of javax.wsdl.extensions.schema.SchemaImport


        wsdlSchema.setElement(el);
       
        XmlSchemaObjectCollection imports = schema.getIncludes();
        for (java.util.Iterator<XmlSchemaObject> it = CastUtils.cast(imports.getIterator()); it.hasNext();) {
            XmlSchemaImport xmlSchemaImport = (XmlSchemaImport) it.next();
            SchemaImport schemaimport =  wsdlSchema.createImport();
            schemaimport.setNamespaceURI(xmlSchemaImport.getNamespace());
            if (xmlSchemaImport.getSchemaLocation() != null
                && !ignoreImports) {
                schemaimport.setSchemaLocationURI(xmlSchemaImport.getSchemaLocation());
            }
            wsdlSchema.addImport(schemaimport)
        }
        types.addExtensibilityElement(wsdlSchema);
    }
View Full Code Here


                        .getIncludes().getItem(x);
                    if (ext.getSchema() == null) {
                        continue;
                    }
                    if (ext instanceof XmlSchemaImport) {
                        SchemaImport imp = schemaImpl.createImport();
                        imp.setNamespaceURI(((XmlSchemaImport)ext).getNamespace());
                        imp.setSchemaLocationURI(((XmlSchemaImport)ext).getSchemaLocation());
                       
                        SchemaImpl schemaImpl2 = new SchemaImpl();
                        schemaImpl2.setRequired(true);
                        schemaImpl2.setElementType(WSDLConstants.QNAME_SCHEMA);
                        schemaImpl2.setDocumentBaseURI(ext.getSchema().getSourceURI());
                        try {
                            schemaImpl2.setElement(ext.getSchema().getSchemaDocument().getDocumentElement());
                        } catch (XmlSchemaSerializerException e) {
                            //ignore
                        }
                        imp.setReferencedSchema(schemaImpl2);

                        schemaImpl.addImport(imp);
                    } else if (ext instanceof XmlSchemaInclude) {
                        SchemaReference imp = schemaImpl.createInclude();
                        imp.setSchemaLocationURI(((XmlSchemaInclude)ext).getSchemaLocation());

                        SchemaImpl schemaImpl2 = new SchemaImpl();
                        schemaImpl2.setRequired(true);
                        schemaImpl2.setElementType(WSDLConstants.QNAME_SCHEMA);
                        schemaImpl2.setDocumentBaseURI(ext.getSchema().getSourceURI());
                        try {
                            schemaImpl2.setElement(ext.getSchema().getSchemaDocument().getDocumentElement());
                        } catch (XmlSchemaSerializerException e) {
                            //ignore
                        }
                        imp.setReferencedSchema(schemaImpl2);
                       
                        schemaImpl.addInclude(imp);
                    } else if (ext instanceof XmlSchemaRedefine) {
                        SchemaReference imp = schemaImpl.createRedefine();
                        imp.setSchemaLocationURI(((XmlSchemaRedefine)ext).getSchemaLocation());
                       
                        SchemaImpl schemaImpl2 = new SchemaImpl();
                        schemaImpl2.setRequired(true);
                        schemaImpl2.setElementType(WSDLConstants.QNAME_SCHEMA);
                        schemaImpl2.setDocumentBaseURI(ext.getSchema().getSourceURI());
                        try {
                            schemaImpl2.setElement(ext.getSchema().getSchemaDocument().getDocumentElement());
                        } catch (XmlSchemaSerializerException e) {
                            //ignore
                        }
                        imp.setReferencedSchema(schemaImpl2);
                       
                        schemaImpl.addRedefine(imp);
                    }
                }
                types.addExtensibilityElement(schemaImpl);
            } else {
                //imports
                String name = baseFileName + "_schema" + (++xsdCount) + ".xsd";
                Element imp = XMLUtils.createElementNS(doc,
                                                       new QName(WSDLConstants.NS_SCHEMA_XSD,
                                                                  "import"));
                imp.setAttribute("schemaLocation", name);
                imp.setAttribute("namespace", schemaInfo.getNamespaceURI());
                nd.appendChild(imp);
                              
                imports.put(name, schemaInfo);
            }
View Full Code Here

        while (importListIterator.hasNext()) {
            List importList = (List)importListIterator.next();
            Iterator importIterator = importList.iterator();

            while (importIterator.hasNext()) {
                SchemaImport schemaImport = (SchemaImport)importIterator.next();
                pw.println();
                indent(pw, indentCount + 2);
                pw.print("<" + tagName);
                DOMUtils.printAttribute(Constants.ATTR_NAMESPACE,
                                        schemaImport.getNamespaceURI(), pw);
                DOMUtils.printAttribute("schemaLocation",
                                        schemaImport.getSchemaLocationURI(), pw);
                pw.println("/>");
            }
        }
        indent(pw, indentCount);
        pw.print("</xsd:" + schemaName.getLocalPart() + ">");
View Full Code Here

        Schema schema = (Schema)schemas.iterator().next();

        assertEquals(1, schema.getImports().values().size());

        SchemaImport serviceTypesSchemaImport = getImport(schema.getImports(),
                "http://apache.org/hello_world_soap_http/servicetypes");

        Schema serviceTypesSchema = serviceTypesSchemaImport.getReferencedSchema();

        assertEquals(1, serviceTypesSchema.getImports().values().size());
        SchemaImport typesSchemaImport = getImport(serviceTypesSchema.getImports(),
                "http://apache.org/hello_world_soap_http/types");

        Schema typesSchema = typesSchemaImport.getReferencedSchema();
       
        Document doc = typesSchema.getElement().getOwnerDocument();
       
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(outputStream, "utf-8");
        StaxUtils.writeNode(doc, writer, true);
        writer.close();

        // this is a test to make sure any embedded namespaces are properly included
        String savedSchema = new String(outputStream.toByteArray(), "UTF-8");
        assertTrue(savedSchema.contains("http://www.w3.org/2005/05/xmlmime"));
       
        SchemaImport types2SchemaImport = getImport(typesSchema.getImports(),
                "http://apache.org/hello_world_soap_http/types2");
       
        Schema types2Schema = types2SchemaImport.getReferencedSchema();
        assertNotNull(types2Schema);
    }
View Full Code Here

        Map map = schema.getImports();
        Collection collection = map.values();
        for (Iterator i = collection.iterator(); i.hasNext();) {
            Vector value = (Vector)i.next();
            for (Object vectorObj : value) {
                SchemaImport si = (SchemaImport)vectorObj;
                importList.add(si);
                if (log.isDebugEnabled()) {
                    if (si != null)
                        log.debug(
                                "Reading import for SchemaLocation =" + si.getSchemaLocationURI());
                }
            }
        }

        //Get namespace and flag the schema as read
View Full Code Here

TOP

Related Classes of javax.wsdl.extensions.schema.SchemaImport

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.