Examples of InlinedSchemaImpl


Examples of org.apache.woden.internal.schema.InlinedSchemaImpl

    protected Schema parseSchemaInline(XMLElement schemaElement,
                                     DescriptionElement desc)
                                     throws WSDLException{

        InlinedSchemaImpl schema = new InlinedSchemaImpl();
        schema.setXMLElement(schemaElement);
       
        schema.setId(schemaElement.getAttributeValue(Constants.ATTR_ID));
        String tns = schemaElement.getAttributeValue(Constants.ATTR_TARGET_NAMESPACE);
        if(tns != null) {
            schema.setNamespace(getURI(tns));
        }

        String baseURI = desc.getDocumentBaseURI() != null ?
                         desc.getDocumentBaseURI().toString() : null;

        XmlSchema schemaDef = null;

        try {
            OMElement omSchemaElem = (OMElement)schemaElement.getSource();
            InputSource schemaSource = OMUtils.getInputSource(omSchemaElem);
            XmlSchemaCollection xsc = new XmlSchemaCollection();

            //Set the baseURI and the namespaces from the DescriptionElement in the XMLSchemaCollection
            xsc.setBaseUri(baseURI);
           
            NamespaceMap namespaces = new NamespaceMap();
            Iterator it = Arrays.asList(desc.getDeclaredNamespaces()).iterator();
            while(it.hasNext()) {
                NamespaceDeclaration d = (NamespaceDeclaration)it.next();
                namespaces.add(d.getPrefix(), d.getNamespaceURI().toString());
            }
            xsc.setNamespaceContext(namespaces);
           
            // Plug in the selected woden URI Resolver
            xsc.setSchemaResolver(new OMSchemaResolverAdapter(getURIResolver(), schemaElement));
           
            schemaDef = xsc.read(schemaSource, null);
        }
        catch (XmlSchemaException e){

            getErrorReporter().reportError(
                    new ErrorLocatorImpl()//TODO line&col nos.
                    "WSDL521",
                    new Object[] {baseURI},
                    ErrorReporter.SEVERITY_WARNING,
                    e);
        }
        catch (RuntimeException e)
        {
            getErrorReporter().reportError(
                    new ErrorLocatorImpl()//TODO line&col nos.
                    "WSDL521",
                    new Object[] {baseURI},
                    ErrorReporter.SEVERITY_ERROR,
                    e);           
        }
       
        if(schemaDef != null) {
            schema.setSchemaDefinition(schemaDef);
        }
        else {
            schema.setReferenceable(false);
        }

        return schema;
    }
View Full Code Here

Examples of org.apache.woden.internal.schema.InlinedSchemaImpl

        // Default case
        assertNull("When 'element' attribute is omitted, no ElementDeclaration should be present", msgRef.getElementDeclaration());
       
        // Test that the expected ElementDeclaration is returned
        TypesElement typesElement = fDescriptionElement.addTypesElement()//throws WSDLException
        InlinedSchema schema = new InlinedSchemaImpl();
        String schemaString = "<schema xmlns=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://www.sample.org\">"
                  + "<complexType name=\"myType\">"    
                  + "<sequence>"    
                  + "<element  name=\"element\" type=\"string\"/>"     
                  + "</sequence>"    
                  + "</complexType>"
                  + "<element name=\"myElement\" type=\"string\"/>"
                  + "</schema>";
        DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
        dbf.setNamespaceAware(true);
        DocumentBuilder builder = dbf.newDocumentBuilder();
        Reader reader = new StringReader(schemaString);
        InputSource is = new InputSource(reader);       
        Document schemaDoc1 = builder.parse(is);
        XmlSchemaCollection xsc = new XmlSchemaCollection();
        XmlSchema xs1 = xsc.read(schemaDoc1.getDocumentElement());
        schema.setSchemaDefinition(xs1);
        URI schemaNS = URI.create("http://www.sample.org");
        schema.setNamespace(schemaNS);
        typesElement.addSchema(schema);
       
        QName elemQN = new QName("http://www.sample.org","myElement");
       
        fMessageReferenceElement.setElement(new QNameTokenUnion(elemQN));
View Full Code Here

Examples of org.apache.woden.internal.schema.InlinedSchemaImpl

        // Default case
        assertNull("When 'element' attribute is omitted, no ElementDeclaration should be present", fault.getElementDeclaration());
       
        // Test that the expected ElementDeclaration is returned
        TypesElement typesElement = fDescriptionElement.addTypesElement()//throws WSDLException
        InlinedSchema schema = new InlinedSchemaImpl();
        String schemaString = "<schema xmlns=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://www.sample.org\">"
                  + "<complexType name=\"myType\">"    
                  + "<sequence>"    
                  + "<element  name=\"element\" type=\"string\"/>"     
                  + "</sequence>"    
                  + "</complexType>"
                  + "<element name=\"myElement\" type=\"string\"/>"
                  + "</schema>";
        DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
        dbf.setNamespaceAware(true);
        DocumentBuilder builder = dbf.newDocumentBuilder();
        Reader reader = new StringReader(schemaString);
        InputSource is = new InputSource(reader);      
        Document schemaDoc1 = builder.parse(is);
        XmlSchemaCollection xsc = new XmlSchemaCollection();
        XmlSchema xs1 = xsc.read(schemaDoc1.getDocumentElement());
        schema.setSchemaDefinition(xs1);
        URI schemaNS = URI.create("http://www.sample.org");
        schema.setNamespace(schemaNS);
        typesElement.addSchema(schema);
       
        QName elemQN = new QName("http://www.sample.org","myElement");
       
        fFaultElement.setElement(new QNameTokenUnion(elemQN));
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.