Java Code Examples for com.sun.tools.internal.ws.util.xml.XmlUtil#matchesTagNS()

The following examples show how to use com.sun.tools.internal.ws.util.xml.XmlUtil#matchesTagNS() . 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: HTTPExtensionHandler.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public boolean handleBindingExtension(
        TWSDLParserContext context,
        TWSDLExtensible parent,
        Element e) {
        if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_BINDING)) {
            context.push();
            context.registerNamespaces(e);

            HTTPBinding binding = new HTTPBinding(context.getLocation(e));

            String verb = Util.getRequiredAttribute(e, Constants.ATTR_VERB);
            binding.setVerb(verb);

            parent.addExtension(binding);
            context.pop();
//            context.fireDoneParsingEntity(HTTPConstants.QNAME_BINDING, binding);
            return true;
        } else {
            Util.fail(
                "parsing.invalidExtensionElement",
                e.getTagName(),
                e.getNamespaceURI());
            return false;
        }
    }
 
Example 2
Source File: JAXWSBindingExtensionHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean handleOperationExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
    if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){
        if(parent instanceof Operation){
            return handlePortTypeOperation(context, (Operation)parent, e);
        }else if(parent instanceof BindingOperation){
            return handleBindingOperation(context, (BindingOperation)parent, e);
        }
    }else {
        Util.fail(
            "parsing.invalidExtensionElement",
            e.getTagName(),
            e.getNamespaceURI());
        return false;
    }
    return false;
}
 
Example 3
Source File: MIMEExtensionHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected boolean handleMIMEPartExtension(
    TWSDLParserContext context,
    TWSDLExtensible parent,
    Element e) {
    if (XmlUtil.matchesTagNS(e, MIMEConstants.QNAME_CONTENT)) {
        MIMEContent content = parseMIMEContent(context, e);
        parent.addExtension(content);
        return true;
    } else if (XmlUtil.matchesTagNS(e, MIMEConstants.QNAME_MIME_XML)) {
        MIMEXml mimeXml = parseMIMEXml(context, e);
        parent.addExtension(mimeXml);
        return true;
    } else {
        Util.fail(
            "parsing.invalidExtensionElement",
            e.getTagName(),
            e.getNamespaceURI());
        return false; // keep compiler happy
    }
}
 
Example 4
Source File: HTTPExtensionHandler.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public boolean handlePortExtension(
        TWSDLParserContext context,
        TWSDLExtensible parent,
        Element e) {
        if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_ADDRESS)) {
            context.push();
            context.registerNamespaces(e);

            HTTPAddress address = new HTTPAddress(context.getLocation(e));

            String location =
                Util.getRequiredAttribute(e, Constants.ATTR_LOCATION);
            address.setLocation(location);

            parent.addExtension(address);
            context.pop();
//            context.fireDoneParsingEntity(HTTPConstants.QNAME_ADDRESS, address);
            return true;
        } else {
            Util.fail(
                "parsing.invalidExtensionElement",
                e.getTagName(),
                e.getNamespaceURI());
            return false;
        }
    }
 
Example 5
Source File: SOAPExtensionHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
    public boolean handlePortExtension(
        TWSDLParserContext context,
        TWSDLExtensible parent,
        Element e) {
        if (XmlUtil.matchesTagNS(e, getAddressQName())) {
            context.push();
            context.registerNamespaces(e);

            SOAPAddress address = new SOAPAddress(context.getLocation(e));

            String location =
                Util.getRequiredAttribute(e, Constants.ATTR_LOCATION);
            address.setLocation(location);

            parent.addExtension(address);
            context.pop();
//            context.fireDoneParsingEntity(getAddressQName(), address);
            return true;
        } else {
            Util.fail(
                "parsing.invalidExtensionElement",
                e.getTagName(),
                e.getNamespaceURI());
            return false; // keep compiler happy
        }
    }
 
Example 6
Source File: JAXWSBindingExtensionHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private String getJavaDoc(Element e){
    for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){
        Element e2 = Util.nextElement(iter);
        if (e2 == null) {
            break;
        }
        if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.JAVADOC)){
            return XmlUtil.getTextForNode(e2);
        }
    }
    return null;
}
 
Example 7
Source File: JAXWSBindingExtensionHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private String getJavaDoc(Element e){
    for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){
        Element e2 = Util.nextElement(iter);
        if (e2 == null) {
            break;
        }
        if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.JAVADOC)){
            return XmlUtil.getTextForNode(e2);
        }
    }
    return null;
}
 
Example 8
Source File: JAXWSBindingExtensionHandler.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
    public boolean handleFaultExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
        if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){
            context.push();
            context.registerNamespaces(e);
            JAXWSBinding jaxwsBinding = new JAXWSBinding(context.getLocation(e));

            for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){
                Element e2 = Util.nextElement(iter);
                if (e2 == null) {
                    break;
                }
                if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.CLASS)){
                    parseClass(context, jaxwsBinding, e2);
                    if((jaxwsBinding.getClassName() != null) && (jaxwsBinding.getClassName().getJavaDoc() != null)){
                        ((Fault)parent).setDocumentation(new Documentation(jaxwsBinding.getClassName().getJavaDoc()));
                    }
                }else{
                    Util.fail(
                        "parsing.invalidExtensionElement",
                        e2.getTagName(),
                        e2.getNamespaceURI());
                    return false;
                }
            }
            parent.addExtension(jaxwsBinding);
            context.pop();
//            context.fireDoneParsingEntity(
//                    JAXWSBindingsConstants.JAXWS_BINDINGS,
//                    jaxwsBinding);
            return true;
        }else {
            Util.fail(
                "parsing.invalidExtensionElement",
                e.getTagName(),
                e.getNamespaceURI());
            return false;
        }
    }
 
Example 9
Source File: WSDLParser.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private Import parseImport(
    TWSDLParserContextImpl context,
    Definitions definitions,
    Element e) {
    context.push();
    context.registerNamespaces(e);
    Import anImport = new Import(forest.locatorTable.getStartLocation(e));
    String namespace =
        Util.getRequiredAttribute(e, Constants.ATTR_NAMESPACE);
    anImport.setNamespace(namespace);
    String location = Util.getRequiredAttribute(e, Constants.ATTR_LOCATION);
    anImport.setLocation(location);

    // according to the schema in the WSDL 1.1 spec, an import can have a documentation element
    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;
            anImport.setDocumentation(getDocumentationFor(e2));
        } else {
            errReceiver.error(forest.locatorTable.getStartLocation(e2), WsdlMessages.PARSING_INVALID_ELEMENT(e2.getTagName(),
                e2.getNamespaceURI()));
        }
    }
    context.pop();
    context.fireDoneParsingEntity(WSDLConstants.QNAME_IMPORT, anImport);
    return anImport;
}
 
Example 10
Source File: Policy15ExtensionHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Only skip the element if it is a <wsp:Policy/>, <wsp:PolicyReference/> or
 * <wsp:UsingPolicy> element.
 */
private boolean handleExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
    return XmlUtil.matchesTagNS(e, NamespaceVersion.v1_5.asQName(XmlToken.Policy))
           || XmlUtil.matchesTagNS(e,NamespaceVersion.v1_5.asQName(XmlToken.PolicyReference))
           || XmlUtil.matchesTagNS(e, NamespaceVersion.v1_5.asQName(XmlToken.UsingPolicy));
}
 
Example 11
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 12
Source File: JAXWSBindingExtensionHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
    public boolean handlePortExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
        if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){
            context.push();
            context.registerNamespaces(e);
            JAXWSBinding jaxwsBinding = new JAXWSBinding(context.getLocation(e));

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

                if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.PROVIDER)){
                    parseProvider(context, jaxwsBinding, e2);
                }else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.METHOD)){
                    parseMethod(context, jaxwsBinding, e2);
                    if((jaxwsBinding.getMethodName() != null) && (jaxwsBinding.getMethodName().getJavaDoc() != null)){
                        ((Port)parent).setDocumentation(new Documentation(jaxwsBinding.getMethodName().getJavaDoc()));
                    }
                }else{
                    Util.fail(
                        "parsing.invalidExtensionElement",
                        e2.getTagName(),
                        e2.getNamespaceURI());
                    return false;
                }
            }
            parent.addExtension(jaxwsBinding);
            context.pop();
//            context.fireDoneParsingEntity(
//                    JAXWSBindingsConstants.JAXWS_BINDINGS,
//                    jaxwsBinding);
            return true;
        }else {
            Util.fail(
                "parsing.invalidExtensionElement",
                e.getTagName(),
                e.getNamespaceURI());
            return false;
        }
    }
 
Example 13
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 14
Source File: JAXWSBindingExtensionHandler.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@Override
    public boolean handlePortExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
        if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){
            context.push();
            context.registerNamespaces(e);
            JAXWSBinding jaxwsBinding = new JAXWSBinding(context.getLocation(e));

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

                if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.PROVIDER)){
                    parseProvider(context, jaxwsBinding, e2);
                }else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.METHOD)){
                    parseMethod(context, jaxwsBinding, e2);
                    if((jaxwsBinding.getMethodName() != null) && (jaxwsBinding.getMethodName().getJavaDoc() != null)){
                        ((Port)parent).setDocumentation(new Documentation(jaxwsBinding.getMethodName().getJavaDoc()));
                    }
                }else{
                    Util.fail(
                        "parsing.invalidExtensionElement",
                        e2.getTagName(),
                        e2.getNamespaceURI());
                    return false;
                }
            }
            parent.addExtension(jaxwsBinding);
            context.pop();
//            context.fireDoneParsingEntity(
//                    JAXWSBindingsConstants.JAXWS_BINDINGS,
//                    jaxwsBinding);
            return true;
        }else {
            Util.fail(
                "parsing.invalidExtensionElement",
                e.getTagName(),
                e.getNamespaceURI());
            return false;
        }
    }
 
Example 15
Source File: WSDLParser.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private Binding parseBinding(
    TWSDLParserContextImpl context,
    Definitions definitions,
    Element e) {
    context.push();
    context.registerNamespaces(e);
    Binding binding = new Binding(definitions, forest.locatorTable.getStartLocation(e), errReceiver);
    String name = Util.getRequiredAttribute(e, Constants.ATTR_NAME);
    binding.setName(name);
    String typeAttr = Util.getRequiredAttribute(e, Constants.ATTR_TYPE);
    binding.setPortType(context.translateQualifiedName(context.getLocation(e), typeAttr));

    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;
            binding.setDocumentation(getDocumentationFor(e2));
        } else if (
            XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_OPERATION)) {
            BindingOperation op = parseBindingOperation(context, e2);
            binding.add(op);
        } else {
            // possible extensibility element -- must live outside the WSDL namespace
            checkNotWsdlElement(e2);
            if (!handleExtension(context, binding, e2)) {
                checkNotWsdlRequired(e2);
            }
        }
    }

    context.pop();
    context.fireDoneParsingEntity(WSDLConstants.QNAME_BINDING, binding);
    return binding;
}
 
Example 16
Source File: SOAPExtensionHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private boolean handleHeaderElement(TWSDLExtensible parent, Element e, TWSDLParserContextImpl context) {
    context.push();
    context.registerNamespaces(e);

    SOAPHeader header = new SOAPHeader(context.getLocation(e));

    String use = XmlUtil.getAttributeOrNull(e, Constants.ATTR_USE);
    if (use != null) {
        if (use.equals(Constants.ATTRVALUE_LITERAL)) {
            header.setUse(SOAPUse.LITERAL);
        } else if (use.equals(Constants.ATTRVALUE_ENCODED)) {
            header.setUse(SOAPUse.ENCODED);
        } else {
            Util.fail("parsing.invalidAttributeValue", Constants.ATTR_USE, use);
        }
    }

    String namespace = XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAMESPACE);
    if (namespace != null) {
        header.setNamespace(namespace);
    }

    String encodingStyle = XmlUtil.getAttributeOrNull(e, Constants.ATTR_ENCODING_STYLE);
    if (encodingStyle != null) {
        header.setEncodingStyle(encodingStyle);
    }

    String part = XmlUtil.getAttributeOrNull(e, Constants.ATTR_PART);
    if (part != null) {
        header.setPart(part);
    }

    String messageAttr = XmlUtil.getAttributeOrNull(e, Constants.ATTR_MESSAGE);
    if (messageAttr != null) {
        header.setMessage(context.translateQualifiedName(context.getLocation(e), messageAttr));
    }

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

        if (XmlUtil.matchesTagNS(e2, getHeaderfaultQName())) {
            handleHeaderFaultElement(e, context, header, use, e2);
        } else {
            Util.fail("parsing.invalidElement", e2.getTagName(), e2.getNamespaceURI());
        }
    }

    parent.addExtension(header);
    context.pop();
    context.fireDoneParsingEntity(getHeaderQName(), header);
    return true;
}
 
Example 17
Source File: SOAPExtensionHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
protected boolean handleInputOutputExtension(
        TWSDLParserContext contextif,
        TWSDLExtensible parent,
        Element e) {
        TWSDLParserContextImpl context = (TWSDLParserContextImpl)contextif;
        if (XmlUtil.matchesTagNS(e, getBodyQName())) {
            context.push();
            context.registerNamespaces(e);

            SOAPBody body = new SOAPBody(context.getLocation(e));

            String use = XmlUtil.getAttributeOrNull(e, Constants.ATTR_USE);
            if (use != null) {
                if (use.equals(Constants.ATTRVALUE_LITERAL)) {
                    body.setUse(SOAPUse.LITERAL);
                } else if (use.equals(Constants.ATTRVALUE_ENCODED)) {
                    body.setUse(SOAPUse.ENCODED);
                } else {
                    Util.fail(
                        "parsing.invalidAttributeValue",
                        Constants.ATTR_USE,
                        use);
                }
            }

            String namespace =
                XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAMESPACE);
            if (namespace != null) {
                body.setNamespace(namespace);
            }

            String encodingStyle =
                XmlUtil.getAttributeOrNull(e, Constants.ATTR_ENCODING_STYLE);
            if (encodingStyle != null) {
                body.setEncodingStyle(encodingStyle);
            }

            String parts = XmlUtil.getAttributeOrNull(e, Constants.ATTR_PARTS);
            if (parts != null) {
                body.setParts(parts);
            }

            parent.addExtension(body);
            context.pop();
//            context.fireDoneParsingEntity(getBodyQName(), body);
            return true;
        } else if (XmlUtil.matchesTagNS(e, getHeaderQName())) {
            return handleHeaderElement(parent, e, context);
        } else {
            Util.fail("parsing.invalidExtensionElement", e.getTagName(), e.getNamespaceURI());
            return false; // keep compiler happy
        }
    }
 
Example 18
Source File: WSDLParser.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private Service parseService(
    TWSDLParserContextImpl context,
    Definitions definitions,
    Element e) {
    context.push();
    context.registerNamespaces(e);
    Service service = new Service(definitions, forest.locatorTable.getStartLocation(e), errReceiver);
    String name = Util.getRequiredAttribute(e, Constants.ATTR_NAME);
    service.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 (service.getDocumentation() == null) {
                service.setDocumentation(getDocumentationFor(e2));
            }
        } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_PORT)) {
            Port port = parsePort(context, definitions, e2);
            service.add(port);
        } else {
            // possible extensibility element -- must live outside the WSDL namespace
            checkNotWsdlElement(e2);
            if (!handleExtension(context, service, e2)) {
                checkNotWsdlRequired(e2);
            }
        }
    }

    context.pop();
    context.fireDoneParsingEntity(WSDLConstants.QNAME_SERVICE, service);
    return service;
}
 
Example 19
Source File: SOAPExtensionHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public boolean handleOperationExtension(
        TWSDLParserContext context,
        TWSDLExtensible parent,
        Element e) {
        if (XmlUtil.matchesTagNS(e, getOperationQName())) {
            context.push();
            context.registerNamespaces(e);

            SOAPOperation operation = new SOAPOperation(context.getLocation(e));

            String soapAction =
                XmlUtil.getAttributeOrNull(e, Constants.ATTR_SOAP_ACTION);
            if (soapAction != null) {
                operation.setSOAPAction(soapAction);
            }

            String style = XmlUtil.getAttributeOrNull(e, Constants.ATTR_STYLE);
            if (style != null) {
                if (style.equals(Constants.ATTRVALUE_RPC)) {
                    operation.setStyle(SOAPStyle.RPC);
                } else if (style.equals(Constants.ATTRVALUE_DOCUMENT)) {
                    operation.setStyle(SOAPStyle.DOCUMENT);
                } else {
                    Util.fail(
                        "parsing.invalidAttributeValue",
                        Constants.ATTR_STYLE,
                        style);
                }
            }
            parent.addExtension(operation);
            context.pop();
//            context.fireDoneParsingEntity(
//                getOperationQName(),
//                operation);
            return true;
        } else {
            Util.fail(
                "parsing.invalidExtensionElement",
                e.getTagName(),
                e.getNamespaceURI());
            return false; // keep compiler happy
        }
    }
 
Example 20
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;
}