com.sun.tools.internal.ws.wsdl.document.PortType Java Examples

The following examples show how to use com.sun.tools.internal.ws.wsdl.document.PortType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WSDLParser.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private Definitions parseDefinitionsNoImport(
    TWSDLParserContextImpl context,
    Document doc) {
    Element e = doc.getDocumentElement();
    //at this poinjt we expect a wsdl or schema document to be fully qualified
    if(e.getNamespaceURI() == null || (!e.getNamespaceURI().equals(WSDLConstants.NS_WSDL) || !e.getLocalName().equals("definitions"))){
        return null;
    }
    context.push();
    context.registerNamespaces(e);

    Definitions definitions = new Definitions(context.getDocument(), forest.locatorTable.getStartLocation(e));
    String name = XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAME);
    definitions.setName(name);

    String targetNamespaceURI =
        XmlUtil.getAttributeOrNull(e, Constants.ATTR_TARGET_NAMESPACE);

    definitions.setTargetNamespaceURI(targetNamespaceURI);

    boolean gotDocumentation = false;
    boolean gotTypes = false;

    for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
        Element e2 = Util.nextElement(iter);
        if (e2 == null)
            break;

        if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
            if (gotDocumentation) {
                errReceiver.error(forest.locatorTable.getStartLocation(e2), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName()));
                return null;
            }
            gotDocumentation = true;
            if(definitions.getDocumentation() == null)
                definitions.setDocumentation(getDocumentationFor(e2));
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_TYPES)) {
            if (gotTypes && !options.isExtensionMode()) {
                errReceiver.error(forest.locatorTable.getStartLocation(e2), WsdlMessages.PARSING_ONLY_ONE_TYPES_ALLOWED(Constants.TAG_DEFINITIONS));
                return null;
            }
            gotTypes = true;
            //add all the wsdl:type elements to latter make a list of all the schema elements
            // that will be needed to create jaxb model
            if(!options.isExtensionMode())
                validateSchemaImports(e2);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_MESSAGE)) {
            Message message = parseMessage(context, definitions, e2);
            definitions.add(message);
        } else if (
            XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_PORT_TYPE)) {
            PortType portType = parsePortType(context, definitions, e2);
            definitions.add(portType);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_BINDING)) {
            Binding binding = parseBinding(context, definitions, e2);
            definitions.add(binding);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_SERVICE)) {
            Service service = parseService(context, definitions, e2);
            definitions.add(service);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_IMPORT)) {
            definitions.add(parseImport(context, definitions, e2));
        } else if (XmlUtil.matchesTagNS(e2, SchemaConstants.QNAME_IMPORT)) {
            errReceiver.warning(forest.locatorTable.getStartLocation(e2), WsdlMessages.WARNING_WSI_R_2003());
        } else {
            // possible extensibility element -- must live outside the WSDL namespace
            checkNotWsdlElement(e2);
            if (!handleExtension(context, definitions, e2)) {
                checkNotWsdlRequired(e2);
            }
        }
    }

    context.pop();
    context.fireDoneParsingEntity(
        WSDLConstants.QNAME_DEFINITIONS,
        definitions);
    return definitions;
}
 
Example #2
Source File: WSDLParser.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private PortType parsePortType(
    TWSDLParserContextImpl context,
    Definitions definitions,
    Element e) {
    context.push();
    context.registerNamespaces(e);
    PortType portType = new PortType(definitions, forest.locatorTable.getStartLocation(e), errReceiver);
    String name = Util.getRequiredAttribute(e, Constants.ATTR_NAME);
    portType.setName(name);

    boolean gotDocumentation = false;

    for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
        Element e2 = Util.nextElement(iter);
        if (e2 == null)
            break;

        if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
            if (gotDocumentation) {
                errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName()));
            }
            gotDocumentation = true;
            if(portType.getDocumentation() == null)
                portType.setDocumentation(getDocumentationFor(e2));
        } else if (
            XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_OPERATION)) {
            Operation op = parsePortTypeOperation(context, e2);
            op.setParent(portType);
            portType.add(op);
        } else {
            // possible extensibility element -- must live outside the WSDL namespace
            checkNotWsdlElement(e2);
            if (!handleExtension(context, portType, e2)) {
                checkNotWsdlRequired(e2);
            }
        }/*else {
            Util.fail(
                "parsing.invalidElement",
                e2.getTagName(),
                e2.getNamespaceURI());
        }*/
    }

    context.pop();
    context.fireDoneParsingEntity(WSDLConstants.QNAME_PORT_TYPE, portType);
    return portType;
}
 
Example #3
Source File: WSDLParser.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private Definitions parseDefinitionsNoImport(
    TWSDLParserContextImpl context,
    Document doc) {
    Element e = doc.getDocumentElement();
    //at this poinjt we expect a wsdl or schema document to be fully qualified
    if(e.getNamespaceURI() == null || (!e.getNamespaceURI().equals(WSDLConstants.NS_WSDL) || !e.getLocalName().equals("definitions"))){
        return null;
    }
    context.push();
    context.registerNamespaces(e);

    Definitions definitions = new Definitions(context.getDocument(), forest.locatorTable.getStartLocation(e));
    String name = XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAME);
    definitions.setName(name);

    String targetNamespaceURI =
        XmlUtil.getAttributeOrNull(e, Constants.ATTR_TARGET_NAMESPACE);

    definitions.setTargetNamespaceURI(targetNamespaceURI);

    boolean gotDocumentation = false;
    boolean gotTypes = false;

    for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
        Element e2 = Util.nextElement(iter);
        if (e2 == null)
            break;

        if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
            if (gotDocumentation) {
                errReceiver.error(forest.locatorTable.getStartLocation(e2), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName()));
                return null;
            }
            gotDocumentation = true;
            if(definitions.getDocumentation() == null)
                definitions.setDocumentation(getDocumentationFor(e2));
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_TYPES)) {
            if (gotTypes && !options.isExtensionMode()) {
                errReceiver.error(forest.locatorTable.getStartLocation(e2), WsdlMessages.PARSING_ONLY_ONE_TYPES_ALLOWED(Constants.TAG_DEFINITIONS));
                return null;
            }
            gotTypes = true;
            //add all the wsdl:type elements to latter make a list of all the schema elements
            // that will be needed to create jaxb model
            if(!options.isExtensionMode())
                validateSchemaImports(e2);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_MESSAGE)) {
            Message message = parseMessage(context, definitions, e2);
            definitions.add(message);
        } else if (
            XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_PORT_TYPE)) {
            PortType portType = parsePortType(context, definitions, e2);
            definitions.add(portType);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_BINDING)) {
            Binding binding = parseBinding(context, definitions, e2);
            definitions.add(binding);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_SERVICE)) {
            Service service = parseService(context, definitions, e2);
            definitions.add(service);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_IMPORT)) {
            definitions.add(parseImport(context, definitions, e2));
        } else if (XmlUtil.matchesTagNS(e2, SchemaConstants.QNAME_IMPORT)) {
            errReceiver.warning(forest.locatorTable.getStartLocation(e2), WsdlMessages.WARNING_WSI_R_2003());
        } else {
            // possible extensibility element -- must live outside the WSDL namespace
            checkNotWsdlElement(e2);
            if (!handleExtension(context, definitions, e2)) {
                checkNotWsdlRequired(e2);
            }
        }
    }

    context.pop();
    context.fireDoneParsingEntity(
        WSDLConstants.QNAME_DEFINITIONS,
        definitions);
    return definitions;
}
 
Example #4
Source File: WSDLParser.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private PortType parsePortType(
    TWSDLParserContextImpl context,
    Definitions definitions,
    Element e) {
    context.push();
    context.registerNamespaces(e);
    PortType portType = new PortType(definitions, forest.locatorTable.getStartLocation(e), errReceiver);
    String name = Util.getRequiredAttribute(e, Constants.ATTR_NAME);
    portType.setName(name);

    boolean gotDocumentation = false;

    for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
        Element e2 = Util.nextElement(iter);
        if (e2 == null)
            break;

        if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
            if (gotDocumentation) {
                errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName()));
            }
            gotDocumentation = true;
            if(portType.getDocumentation() == null)
                portType.setDocumentation(getDocumentationFor(e2));
        } else if (
            XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_OPERATION)) {
            Operation op = parsePortTypeOperation(context, e2);
            op.setParent(portType);
            portType.add(op);
        } else {
            // possible extensibility element -- must live outside the WSDL namespace
            checkNotWsdlElement(e2);
            if (!handleExtension(context, portType, e2)) {
                checkNotWsdlRequired(e2);
            }
        }/*else {
            Util.fail(
                "parsing.invalidElement",
                e2.getTagName(),
                e2.getNamespaceURI());
        }*/
    }

    context.pop();
    context.fireDoneParsingEntity(WSDLConstants.QNAME_PORT_TYPE, portType);
    return portType;
}
 
Example #5
Source File: WSDLParser.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private Definitions parseDefinitionsNoImport(
    TWSDLParserContextImpl context,
    Document doc) {
    Element e = doc.getDocumentElement();
    //at this poinjt we expect a wsdl or schema document to be fully qualified
    if(e.getNamespaceURI() == null || (!e.getNamespaceURI().equals(WSDLConstants.NS_WSDL) || !e.getLocalName().equals("definitions"))){
        return null;
    }
    context.push();
    context.registerNamespaces(e);

    Definitions definitions = new Definitions(context.getDocument(), forest.locatorTable.getStartLocation(e));
    String name = XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAME);
    definitions.setName(name);

    String targetNamespaceURI =
        XmlUtil.getAttributeOrNull(e, Constants.ATTR_TARGET_NAMESPACE);

    definitions.setTargetNamespaceURI(targetNamespaceURI);

    boolean gotDocumentation = false;
    boolean gotTypes = false;

    for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
        Element e2 = Util.nextElement(iter);
        if (e2 == null)
            break;

        if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
            if (gotDocumentation) {
                errReceiver.error(forest.locatorTable.getStartLocation(e2), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName()));
                return null;
            }
            gotDocumentation = true;
            if(definitions.getDocumentation() == null)
                definitions.setDocumentation(getDocumentationFor(e2));
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_TYPES)) {
            if (gotTypes && !options.isExtensionMode()) {
                errReceiver.error(forest.locatorTable.getStartLocation(e2), WsdlMessages.PARSING_ONLY_ONE_TYPES_ALLOWED(Constants.TAG_DEFINITIONS));
                return null;
            }
            gotTypes = true;
            //add all the wsdl:type elements to latter make a list of all the schema elements
            // that will be needed to create jaxb model
            if(!options.isExtensionMode())
                validateSchemaImports(e2);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_MESSAGE)) {
            Message message = parseMessage(context, definitions, e2);
            definitions.add(message);
        } else if (
            XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_PORT_TYPE)) {
            PortType portType = parsePortType(context, definitions, e2);
            definitions.add(portType);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_BINDING)) {
            Binding binding = parseBinding(context, definitions, e2);
            definitions.add(binding);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_SERVICE)) {
            Service service = parseService(context, definitions, e2);
            definitions.add(service);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_IMPORT)) {
            definitions.add(parseImport(context, definitions, e2));
        } else if (XmlUtil.matchesTagNS(e2, SchemaConstants.QNAME_IMPORT)) {
            errReceiver.warning(forest.locatorTable.getStartLocation(e2), WsdlMessages.WARNING_WSI_R_2003());
        } else {
            // possible extensibility element -- must live outside the WSDL namespace
            checkNotWsdlElement(e2);
            if (!handleExtension(context, definitions, e2)) {
                checkNotWsdlRequired(e2);
            }
        }
    }

    context.pop();
    context.fireDoneParsingEntity(
        WSDLConstants.QNAME_DEFINITIONS,
        definitions);
    return definitions;
}
 
Example #6
Source File: WSDLParser.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private PortType parsePortType(
    TWSDLParserContextImpl context,
    Definitions definitions,
    Element e) {
    context.push();
    context.registerNamespaces(e);
    PortType portType = new PortType(definitions, forest.locatorTable.getStartLocation(e), errReceiver);
    String name = Util.getRequiredAttribute(e, Constants.ATTR_NAME);
    portType.setName(name);

    boolean gotDocumentation = false;

    for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
        Element e2 = Util.nextElement(iter);
        if (e2 == null)
            break;

        if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
            if (gotDocumentation) {
                errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName()));
            }
            gotDocumentation = true;
            if(portType.getDocumentation() == null)
                portType.setDocumentation(getDocumentationFor(e2));
        } else if (
            XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_OPERATION)) {
            Operation op = parsePortTypeOperation(context, e2);
            op.setParent(portType);
            portType.add(op);
        } else {
            // possible extensibility element -- must live outside the WSDL namespace
            checkNotWsdlElement(e2);
            if (!handleExtension(context, portType, e2)) {
                checkNotWsdlRequired(e2);
            }
        }/*else {
            Util.fail(
                "parsing.invalidElement",
                e2.getTagName(),
                e2.getNamespaceURI());
        }*/
    }

    context.pop();
    context.fireDoneParsingEntity(WSDLConstants.QNAME_PORT_TYPE, portType);
    return portType;
}
 
Example #7
Source File: WSDLParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private Definitions parseDefinitionsNoImport(
    TWSDLParserContextImpl context,
    Document doc) {
    Element e = doc.getDocumentElement();
    //at this poinjt we expect a wsdl or schema document to be fully qualified
    if(e.getNamespaceURI() == null || (!e.getNamespaceURI().equals(WSDLConstants.NS_WSDL) || !e.getLocalName().equals("definitions"))){
        return null;
    }
    context.push();
    context.registerNamespaces(e);

    Definitions definitions = new Definitions(context.getDocument(), forest.locatorTable.getStartLocation(e));
    String name = XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAME);
    definitions.setName(name);

    String targetNamespaceURI =
        XmlUtil.getAttributeOrNull(e, Constants.ATTR_TARGET_NAMESPACE);

    definitions.setTargetNamespaceURI(targetNamespaceURI);

    boolean gotDocumentation = false;
    boolean gotTypes = false;

    for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
        Element e2 = Util.nextElement(iter);
        if (e2 == null)
            break;

        if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
            if (gotDocumentation) {
                errReceiver.error(forest.locatorTable.getStartLocation(e2), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName()));
                return null;
            }
            gotDocumentation = true;
            if(definitions.getDocumentation() == null)
                definitions.setDocumentation(getDocumentationFor(e2));
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_TYPES)) {
            if (gotTypes && !options.isExtensionMode()) {
                errReceiver.error(forest.locatorTable.getStartLocation(e2), WsdlMessages.PARSING_ONLY_ONE_TYPES_ALLOWED(Constants.TAG_DEFINITIONS));
                return null;
            }
            gotTypes = true;
            //add all the wsdl:type elements to latter make a list of all the schema elements
            // that will be needed to create jaxb model
            if(!options.isExtensionMode())
                validateSchemaImports(e2);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_MESSAGE)) {
            Message message = parseMessage(context, definitions, e2);
            definitions.add(message);
        } else if (
            XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_PORT_TYPE)) {
            PortType portType = parsePortType(context, definitions, e2);
            definitions.add(portType);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_BINDING)) {
            Binding binding = parseBinding(context, definitions, e2);
            definitions.add(binding);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_SERVICE)) {
            Service service = parseService(context, definitions, e2);
            definitions.add(service);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_IMPORT)) {
            definitions.add(parseImport(context, definitions, e2));
        } else if (XmlUtil.matchesTagNS(e2, SchemaConstants.QNAME_IMPORT)) {
            errReceiver.warning(forest.locatorTable.getStartLocation(e2), WsdlMessages.WARNING_WSI_R_2003());
        } else {
            // possible extensibility element -- must live outside the WSDL namespace
            checkNotWsdlElement(e2);
            if (!handleExtension(context, definitions, e2)) {
                checkNotWsdlRequired(e2);
            }
        }
    }

    context.pop();
    context.fireDoneParsingEntity(
        WSDLConstants.QNAME_DEFINITIONS,
        definitions);
    return definitions;
}
 
Example #8
Source File: WSDLParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private PortType parsePortType(
    TWSDLParserContextImpl context,
    Definitions definitions,
    Element e) {
    context.push();
    context.registerNamespaces(e);
    PortType portType = new PortType(definitions, forest.locatorTable.getStartLocation(e), errReceiver);
    String name = Util.getRequiredAttribute(e, Constants.ATTR_NAME);
    portType.setName(name);

    boolean gotDocumentation = false;

    for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
        Element e2 = Util.nextElement(iter);
        if (e2 == null)
            break;

        if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
            if (gotDocumentation) {
                errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName()));
            }
            gotDocumentation = true;
            if(portType.getDocumentation() == null)
                portType.setDocumentation(getDocumentationFor(e2));
        } else if (
            XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_OPERATION)) {
            Operation op = parsePortTypeOperation(context, e2);
            op.setParent(portType);
            portType.add(op);
        } else {
            // possible extensibility element -- must live outside the WSDL namespace
            checkNotWsdlElement(e2);
            if (!handleExtension(context, portType, e2)) {
                checkNotWsdlRequired(e2);
            }
        }/*else {
            Util.fail(
                "parsing.invalidElement",
                e2.getTagName(),
                e2.getNamespaceURI());
        }*/
    }

    context.pop();
    context.fireDoneParsingEntity(WSDLConstants.QNAME_PORT_TYPE, portType);
    return portType;
}
 
Example #9
Source File: WSDLParser.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private Definitions parseDefinitionsNoImport(
    TWSDLParserContextImpl context,
    Document doc) {
    Element e = doc.getDocumentElement();
    //at this poinjt we expect a wsdl or schema document to be fully qualified
    if(e.getNamespaceURI() == null || (!e.getNamespaceURI().equals(WSDLConstants.NS_WSDL) || !e.getLocalName().equals("definitions"))){
        return null;
    }
    context.push();
    context.registerNamespaces(e);

    Definitions definitions = new Definitions(context.getDocument(), forest.locatorTable.getStartLocation(e));
    String name = XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAME);
    definitions.setName(name);

    String targetNamespaceURI =
        XmlUtil.getAttributeOrNull(e, Constants.ATTR_TARGET_NAMESPACE);

    definitions.setTargetNamespaceURI(targetNamespaceURI);

    boolean gotDocumentation = false;
    boolean gotTypes = false;

    for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
        Element e2 = Util.nextElement(iter);
        if (e2 == null)
            break;

        if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
            if (gotDocumentation) {
                errReceiver.error(forest.locatorTable.getStartLocation(e2), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName()));
                return null;
            }
            gotDocumentation = true;
            if(definitions.getDocumentation() == null)
                definitions.setDocumentation(getDocumentationFor(e2));
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_TYPES)) {
            if (gotTypes && !options.isExtensionMode()) {
                errReceiver.error(forest.locatorTable.getStartLocation(e2), WsdlMessages.PARSING_ONLY_ONE_TYPES_ALLOWED(Constants.TAG_DEFINITIONS));
                return null;
            }
            gotTypes = true;
            //add all the wsdl:type elements to latter make a list of all the schema elements
            // that will be needed to create jaxb model
            if(!options.isExtensionMode())
                validateSchemaImports(e2);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_MESSAGE)) {
            Message message = parseMessage(context, definitions, e2);
            definitions.add(message);
        } else if (
            XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_PORT_TYPE)) {
            PortType portType = parsePortType(context, definitions, e2);
            definitions.add(portType);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_BINDING)) {
            Binding binding = parseBinding(context, definitions, e2);
            definitions.add(binding);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_SERVICE)) {
            Service service = parseService(context, definitions, e2);
            definitions.add(service);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_IMPORT)) {
            definitions.add(parseImport(context, definitions, e2));
        } else if (XmlUtil.matchesTagNS(e2, SchemaConstants.QNAME_IMPORT)) {
            errReceiver.warning(forest.locatorTable.getStartLocation(e2), WsdlMessages.WARNING_WSI_R_2003());
        } else {
            // possible extensibility element -- must live outside the WSDL namespace
            checkNotWsdlElement(e2);
            if (!handleExtension(context, definitions, e2)) {
                checkNotWsdlRequired(e2);
            }
        }
    }

    context.pop();
    context.fireDoneParsingEntity(
        WSDLConstants.QNAME_DEFINITIONS,
        definitions);
    return definitions;
}
 
Example #10
Source File: WSDLParser.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private PortType parsePortType(
    TWSDLParserContextImpl context,
    Definitions definitions,
    Element e) {
    context.push();
    context.registerNamespaces(e);
    PortType portType = new PortType(definitions, forest.locatorTable.getStartLocation(e), errReceiver);
    String name = Util.getRequiredAttribute(e, Constants.ATTR_NAME);
    portType.setName(name);

    boolean gotDocumentation = false;

    for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
        Element e2 = Util.nextElement(iter);
        if (e2 == null)
            break;

        if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
            if (gotDocumentation) {
                errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName()));
            }
            gotDocumentation = true;
            if(portType.getDocumentation() == null)
                portType.setDocumentation(getDocumentationFor(e2));
        } else if (
            XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_OPERATION)) {
            Operation op = parsePortTypeOperation(context, e2);
            op.setParent(portType);
            portType.add(op);
        } else {
            // possible extensibility element -- must live outside the WSDL namespace
            checkNotWsdlElement(e2);
            if (!handleExtension(context, portType, e2)) {
                checkNotWsdlRequired(e2);
            }
        }/*else {
            Util.fail(
                "parsing.invalidElement",
                e2.getTagName(),
                e2.getNamespaceURI());
        }*/
    }

    context.pop();
    context.fireDoneParsingEntity(WSDLConstants.QNAME_PORT_TYPE, portType);
    return portType;
}
 
Example #11
Source File: WSDLParser.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private Definitions parseDefinitionsNoImport(
    TWSDLParserContextImpl context,
    Document doc) {
    Element e = doc.getDocumentElement();
    //at this poinjt we expect a wsdl or schema document to be fully qualified
    if(e.getNamespaceURI() == null || (!e.getNamespaceURI().equals(WSDLConstants.NS_WSDL) || !e.getLocalName().equals("definitions"))){
        return null;
    }
    context.push();
    context.registerNamespaces(e);

    Definitions definitions = new Definitions(context.getDocument(), forest.locatorTable.getStartLocation(e));
    String name = XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAME);
    definitions.setName(name);

    String targetNamespaceURI =
        XmlUtil.getAttributeOrNull(e, Constants.ATTR_TARGET_NAMESPACE);

    definitions.setTargetNamespaceURI(targetNamespaceURI);

    boolean gotDocumentation = false;
    boolean gotTypes = false;

    for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
        Element e2 = Util.nextElement(iter);
        if (e2 == null)
            break;

        if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
            if (gotDocumentation) {
                errReceiver.error(forest.locatorTable.getStartLocation(e2), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName()));
                return null;
            }
            gotDocumentation = true;
            if(definitions.getDocumentation() == null)
                definitions.setDocumentation(getDocumentationFor(e2));
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_TYPES)) {
            if (gotTypes && !options.isExtensionMode()) {
                errReceiver.error(forest.locatorTable.getStartLocation(e2), WsdlMessages.PARSING_ONLY_ONE_TYPES_ALLOWED(Constants.TAG_DEFINITIONS));
                return null;
            }
            gotTypes = true;
            //add all the wsdl:type elements to latter make a list of all the schema elements
            // that will be needed to create jaxb model
            if(!options.isExtensionMode())
                validateSchemaImports(e2);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_MESSAGE)) {
            Message message = parseMessage(context, definitions, e2);
            definitions.add(message);
        } else if (
            XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_PORT_TYPE)) {
            PortType portType = parsePortType(context, definitions, e2);
            definitions.add(portType);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_BINDING)) {
            Binding binding = parseBinding(context, definitions, e2);
            definitions.add(binding);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_SERVICE)) {
            Service service = parseService(context, definitions, e2);
            definitions.add(service);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_IMPORT)) {
            definitions.add(parseImport(context, definitions, e2));
        } else if (XmlUtil.matchesTagNS(e2, SchemaConstants.QNAME_IMPORT)) {
            errReceiver.warning(forest.locatorTable.getStartLocation(e2), WsdlMessages.WARNING_WSI_R_2003());
        } else {
            // possible extensibility element -- must live outside the WSDL namespace
            checkNotWsdlElement(e2);
            if (!handleExtension(context, definitions, e2)) {
                checkNotWsdlRequired(e2);
            }
        }
    }

    context.pop();
    context.fireDoneParsingEntity(
        WSDLConstants.QNAME_DEFINITIONS,
        definitions);
    return definitions;
}
 
Example #12
Source File: WSDLParser.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private PortType parsePortType(
    TWSDLParserContextImpl context,
    Definitions definitions,
    Element e) {
    context.push();
    context.registerNamespaces(e);
    PortType portType = new PortType(definitions, forest.locatorTable.getStartLocation(e), errReceiver);
    String name = Util.getRequiredAttribute(e, Constants.ATTR_NAME);
    portType.setName(name);

    boolean gotDocumentation = false;

    for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
        Element e2 = Util.nextElement(iter);
        if (e2 == null)
            break;

        if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
            if (gotDocumentation) {
                errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName()));
            }
            gotDocumentation = true;
            if(portType.getDocumentation() == null)
                portType.setDocumentation(getDocumentationFor(e2));
        } else if (
            XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_OPERATION)) {
            Operation op = parsePortTypeOperation(context, e2);
            op.setParent(portType);
            portType.add(op);
        } else {
            // possible extensibility element -- must live outside the WSDL namespace
            checkNotWsdlElement(e2);
            if (!handleExtension(context, portType, e2)) {
                checkNotWsdlRequired(e2);
            }
        }/*else {
            Util.fail(
                "parsing.invalidElement",
                e2.getTagName(),
                e2.getNamespaceURI());
        }*/
    }

    context.pop();
    context.fireDoneParsingEntity(WSDLConstants.QNAME_PORT_TYPE, portType);
    return portType;
}
 
Example #13
Source File: WSDLParser.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private Definitions parseDefinitionsNoImport(
    TWSDLParserContextImpl context,
    Document doc) {
    Element e = doc.getDocumentElement();
    //at this poinjt we expect a wsdl or schema document to be fully qualified
    if(e.getNamespaceURI() == null || (!e.getNamespaceURI().equals(WSDLConstants.NS_WSDL) || !e.getLocalName().equals("definitions"))){
        return null;
    }
    context.push();
    context.registerNamespaces(e);

    Definitions definitions = new Definitions(context.getDocument(), forest.locatorTable.getStartLocation(e));
    String name = XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAME);
    definitions.setName(name);

    String targetNamespaceURI =
        XmlUtil.getAttributeOrNull(e, Constants.ATTR_TARGET_NAMESPACE);

    definitions.setTargetNamespaceURI(targetNamespaceURI);

    boolean gotDocumentation = false;
    boolean gotTypes = false;

    for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
        Element e2 = Util.nextElement(iter);
        if (e2 == null)
            break;

        if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
            if (gotDocumentation) {
                errReceiver.error(forest.locatorTable.getStartLocation(e2), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName()));
                return null;
            }
            gotDocumentation = true;
            if(definitions.getDocumentation() == null)
                definitions.setDocumentation(getDocumentationFor(e2));
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_TYPES)) {
            if (gotTypes && !options.isExtensionMode()) {
                errReceiver.error(forest.locatorTable.getStartLocation(e2), WsdlMessages.PARSING_ONLY_ONE_TYPES_ALLOWED(Constants.TAG_DEFINITIONS));
                return null;
            }
            gotTypes = true;
            //add all the wsdl:type elements to latter make a list of all the schema elements
            // that will be needed to create jaxb model
            if(!options.isExtensionMode())
                validateSchemaImports(e2);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_MESSAGE)) {
            Message message = parseMessage(context, definitions, e2);
            definitions.add(message);
        } else if (
            XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_PORT_TYPE)) {
            PortType portType = parsePortType(context, definitions, e2);
            definitions.add(portType);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_BINDING)) {
            Binding binding = parseBinding(context, definitions, e2);
            definitions.add(binding);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_SERVICE)) {
            Service service = parseService(context, definitions, e2);
            definitions.add(service);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_IMPORT)) {
            definitions.add(parseImport(context, definitions, e2));
        } else if (XmlUtil.matchesTagNS(e2, SchemaConstants.QNAME_IMPORT)) {
            errReceiver.warning(forest.locatorTable.getStartLocation(e2), WsdlMessages.WARNING_WSI_R_2003());
        } else {
            // possible extensibility element -- must live outside the WSDL namespace
            checkNotWsdlElement(e2);
            if (!handleExtension(context, definitions, e2)) {
                checkNotWsdlRequired(e2);
            }
        }
    }

    context.pop();
    context.fireDoneParsingEntity(
        WSDLConstants.QNAME_DEFINITIONS,
        definitions);
    return definitions;
}
 
Example #14
Source File: WSDLParser.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private PortType parsePortType(
    TWSDLParserContextImpl context,
    Definitions definitions,
    Element e) {
    context.push();
    context.registerNamespaces(e);
    PortType portType = new PortType(definitions, forest.locatorTable.getStartLocation(e), errReceiver);
    String name = Util.getRequiredAttribute(e, Constants.ATTR_NAME);
    portType.setName(name);

    boolean gotDocumentation = false;

    for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
        Element e2 = Util.nextElement(iter);
        if (e2 == null)
            break;

        if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
            if (gotDocumentation) {
                errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName()));
            }
            gotDocumentation = true;
            if(portType.getDocumentation() == null)
                portType.setDocumentation(getDocumentationFor(e2));
        } else if (
            XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_OPERATION)) {
            Operation op = parsePortTypeOperation(context, e2);
            op.setParent(portType);
            portType.add(op);
        } else {
            // possible extensibility element -- must live outside the WSDL namespace
            checkNotWsdlElement(e2);
            if (!handleExtension(context, portType, e2)) {
                checkNotWsdlRequired(e2);
            }
        }/*else {
            Util.fail(
                "parsing.invalidElement",
                e2.getTagName(),
                e2.getNamespaceURI());
        }*/
    }

    context.pop();
    context.fireDoneParsingEntity(WSDLConstants.QNAME_PORT_TYPE, portType);
    return portType;
}
 
Example #15
Source File: WSDLParser.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private Definitions parseDefinitionsNoImport(
    TWSDLParserContextImpl context,
    Document doc) {
    Element e = doc.getDocumentElement();
    //at this poinjt we expect a wsdl or schema document to be fully qualified
    if(e.getNamespaceURI() == null || (!e.getNamespaceURI().equals(WSDLConstants.NS_WSDL) || !e.getLocalName().equals("definitions"))){
        return null;
    }
    context.push();
    context.registerNamespaces(e);

    Definitions definitions = new Definitions(context.getDocument(), forest.locatorTable.getStartLocation(e));
    String name = XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAME);
    definitions.setName(name);

    String targetNamespaceURI =
        XmlUtil.getAttributeOrNull(e, Constants.ATTR_TARGET_NAMESPACE);

    definitions.setTargetNamespaceURI(targetNamespaceURI);

    boolean gotDocumentation = false;
    boolean gotTypes = false;

    for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
        Element e2 = Util.nextElement(iter);
        if (e2 == null)
            break;

        if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
            if (gotDocumentation) {
                errReceiver.error(forest.locatorTable.getStartLocation(e2), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName()));
                return null;
            }
            gotDocumentation = true;
            if(definitions.getDocumentation() == null)
                definitions.setDocumentation(getDocumentationFor(e2));
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_TYPES)) {
            if (gotTypes && !options.isExtensionMode()) {
                errReceiver.error(forest.locatorTable.getStartLocation(e2), WsdlMessages.PARSING_ONLY_ONE_TYPES_ALLOWED(Constants.TAG_DEFINITIONS));
                return null;
            }
            gotTypes = true;
            //add all the wsdl:type elements to latter make a list of all the schema elements
            // that will be needed to create jaxb model
            if(!options.isExtensionMode())
                validateSchemaImports(e2);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_MESSAGE)) {
            Message message = parseMessage(context, definitions, e2);
            definitions.add(message);
        } else if (
            XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_PORT_TYPE)) {
            PortType portType = parsePortType(context, definitions, e2);
            definitions.add(portType);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_BINDING)) {
            Binding binding = parseBinding(context, definitions, e2);
            definitions.add(binding);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_SERVICE)) {
            Service service = parseService(context, definitions, e2);
            definitions.add(service);
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_IMPORT)) {
            definitions.add(parseImport(context, definitions, e2));
        } else if (XmlUtil.matchesTagNS(e2, SchemaConstants.QNAME_IMPORT)) {
            errReceiver.warning(forest.locatorTable.getStartLocation(e2), WsdlMessages.WARNING_WSI_R_2003());
        } else {
            // possible extensibility element -- must live outside the WSDL namespace
            checkNotWsdlElement(e2);
            if (!handleExtension(context, definitions, e2)) {
                checkNotWsdlRequired(e2);
            }
        }
    }

    context.pop();
    context.fireDoneParsingEntity(
        WSDLConstants.QNAME_DEFINITIONS,
        definitions);
    return definitions;
}
 
Example #16
Source File: WSDLParser.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private PortType parsePortType(
    TWSDLParserContextImpl context,
    Definitions definitions,
    Element e) {
    context.push();
    context.registerNamespaces(e);
    PortType portType = new PortType(definitions, forest.locatorTable.getStartLocation(e), errReceiver);
    String name = Util.getRequiredAttribute(e, Constants.ATTR_NAME);
    portType.setName(name);

    boolean gotDocumentation = false;

    for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
        Element e2 = Util.nextElement(iter);
        if (e2 == null)
            break;

        if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
            if (gotDocumentation) {
                errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName()));
            }
            gotDocumentation = true;
            if(portType.getDocumentation() == null)
                portType.setDocumentation(getDocumentationFor(e2));
        } else if (
            XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_OPERATION)) {
            Operation op = parsePortTypeOperation(context, e2);
            op.setParent(portType);
            portType.add(op);
        } else {
            // possible extensibility element -- must live outside the WSDL namespace
            checkNotWsdlElement(e2);
            if (!handleExtension(context, portType, e2)) {
                checkNotWsdlRequired(e2);
            }
        }/*else {
            Util.fail(
                "parsing.invalidElement",
                e2.getTagName(),
                e2.getNamespaceURI());
        }*/
    }

    context.pop();
    context.fireDoneParsingEntity(WSDLConstants.QNAME_PORT_TYPE, portType);
    return portType;
}