Package javax.wsdl

Examples of javax.wsdl.QName


        // First try to get the name directly
        localName = getAttribute(node, "name");
       
        // If this fails and the node has a ref, use the ref name.
        if (localName == null) {
            QName ref = getNodeTypeRefQName(node, "ref");
            if (ref != null) {
                localName = ref.getLocalPart();
                namespace = ref.getNamespaceURI();
            }
        }
       
        // This routine may be called for complexType elements.  In some cases,
        // the complexType may be anonymous, which is why the getScopedAttribute
        // method is used.
        if (localName == null) {
            localName = getScopedAttribute(node, "name");
        }
        if (localName == null)
            return null;

        // Build and return the QName
        if (namespace == null) {
            namespace = getScopedAttribute(node, "targetNamespace");
        }
        return (new QName(namespace, localName));
    }
View Full Code Here


     * has the type attribute value "b:bar".  This routine gets the QName of the type/ref attribute value.
     */
    public static QName getNodeTypeRefQName(Node node) {
        if (node == null) return null;

        QName qName= getNodeTypeRefQName(node, "type");
        if (qName == null) {
            qName = getNodeTypeRefQName(node, "ref");
        }
        // A WSDL Part uses the element attribute instead of the ref attribute
        if (qName == null) {
View Full Code Here

           namespace = getScopedAttribute(node, "xmlns")// Get namespace for unqualified reference
        }
        else {
           namespace = getScopedAttribute(node, "xmlns:" + prefixedName.substring(0, prefixedName.lastIndexOf(":")));
        }
        return (new QName(namespace, localName));
    }
View Full Code Here

        if (node == null) {
            return null;
        }

        // If the node kind is an element, dive into it.
        QName nodeKind = Utils.getNodeQName(node);
        if (nodeKind != null &&
            nodeKind.getLocalPart().equals("element") &&
            Utils.isSchemaNS(nodeKind.getNamespaceURI())) {
            NodeList children = node.getChildNodes();
            Node complexNode = null;
            for (int j = 0; j < children.getLength() && complexNode == null; j++) {
                QName complexKind = Utils.getNodeQName(children.item(j));
                if (complexKind != null &&
                    complexKind.getLocalPart().equals("complexType") &&
                    Utils.isSchemaNS(complexKind.getNamespaceURI())) {
                    complexNode = children.item(j);
                    node = complexNode;
                }
            }
        }

        // Expecting a schema complexType
        nodeKind = Utils.getNodeQName(node);
        if (nodeKind != null &&
            nodeKind.getLocalPart().equals("complexType") &&
            Utils.isSchemaNS(nodeKind.getNamespaceURI())) {

            // Under the complexType there should be a sequence or all group node.
            // (There may be other #text nodes, which we will ignore).
            NodeList children = node.getChildNodes();
            Node groupNode = null;
            for (int j = 0; j < children.getLength() && groupNode == null; j++) {
                QName groupKind = Utils.getNodeQName(children.item(j));
                if (groupKind != null &&
                    (groupKind.getLocalPart().equals("sequence") ||
                     groupKind.getLocalPart().equals("all")) &&
                    Utils.isSchemaNS(groupKind.getNamespaceURI()))
                    groupNode = children.item(j);
            }

            if (groupNode == null) {
                return new Vector();
            }
            if (groupNode != null) {

                // Process each of the element nodes under the group node
                Vector v = new Vector();
                NodeList elements = children.item(1).getChildNodes();
                for (int i=0; i < elements.getLength(); i++) {
                    QName elementKind = Utils.getNodeQName(elements.item(i));
                    if (elementKind != null &&
                        elementKind.getLocalPart().equals("element") &&
                        Utils.isSchemaNS(elementKind.getNamespaceURI())) {

                        // Get the name and type qnames.
                        // The name of the element is the local part of the name's qname.
                        // The type qname is used to locate the Type, which is then
                        // used to retrieve the proper java name of the type.
                        Node elementNode = elements.item(i);
                        QName nodeName = Utils.getNodeNameQName(elementNode);
                        QName nodeType = Utils.getNodeTypeRefQName(elementNode);
                        if (nodeType == null) { // The element may use an anonymous type
                            nodeType = nodeName;
                        }

                        Type Type = (Type) symbolTable.getTypeEntry(nodeType);
View Full Code Here

        if (node == null) {
            return null;
        }

        // If the node kind is an element, dive into it.
        QName nodeKind = Utils.getNodeQName(node);
        if (nodeKind != null &&
            nodeKind.getLocalPart().equals("element") &&
            Utils.isSchemaNS(nodeKind.getNamespaceURI())) {
            NodeList children = node.getChildNodes();
            Node simpleNode = null;
            for (int j = 0; j < children.getLength() && simpleNode == null; j++) {
                QName simpleKind = Utils.getNodeQName(children.item(j));
                if (simpleKind != null &&
                    simpleKind.getLocalPart().equals("simpleType") &&
                    Utils.isSchemaNS(simpleKind.getNamespaceURI())) {
                    simpleNode = children.item(j);
                    node = simpleNode;
                }
            }
        }
        // Get the node kind, expecting a schema simpleType
        nodeKind = Utils.getNodeQName(node);
        if (nodeKind != null &&
            nodeKind.getLocalPart().equals("simpleType") &&
            Utils.isSchemaNS(nodeKind.getNamespaceURI())) {

            // Under the simpleType there should be a restriction.
            // (There may be other #text nodes, which we will ignore).
            NodeList children = node.getChildNodes();
            Node restrictionNode = null;
            for (int j = 0; j < children.getLength() && restrictionNode == null; j++) {
                QName restrictionKind = Utils.getNodeQName(children.item(j));
                if (restrictionKind != null &&
                    restrictionKind.getLocalPart().equals("restriction") &&
                    Utils.isSchemaNS(restrictionKind.getNamespaceURI()))
                    restrictionNode = children.item(j);
            }

            // The restriction node indicates the type being restricted
            // (the base attribute contains this type).
            // The base type must be a built-in type...and we only think
            // this makes sense for string.
            Type baseEType = null;
            if (restrictionNode != null) {
                QName baseType = Utils.getNodeTypeRefQName(restrictionNode, "base");
                baseEType = symbolTable.getTypeEntry(baseType);
                if (baseEType != null &&
                    !baseEType.getJavaName().equals("java.lang.String")) {
                    baseEType = null;
                }
            }

            // Process the enumeration elements underneath the restriction node
            if (baseEType != null && restrictionNode != null) {

                Vector v = new Vector();
                v.add(baseEType);
                NodeList enums = restrictionNode.getChildNodes();
                for (int i=0; i < enums.getLength(); i++) {
                    QName enumKind = Utils.getNodeQName(enums.item(i));
                    if (enumKind != null &&
                        enumKind.getLocalPart().equals("enumeration") &&
                        Utils.isSchemaNS(enumKind.getNamespaceURI())) {

                        // Put the enum value in the vector.
                        Node enumNode = enums.item(i);
                        String value = Utils.getAttribute(enumNode, "value");
                        if (value != null) {
View Full Code Here

    /**
     * If the specified node represents an array encoding of one of the following
     * forms, then return the qname repesenting the element type of the array.
     */
    public static QName getArrayElementQName(Node node) {
        QName qName = getArrayElementQName_JAXRPC(node);
        if (qName != null)
            return qName;
        // qName = getArrayElementQName_nonJAXRPC(node);
        return qName;
    }
View Full Code Here

        if (node == null) {
            return null;
        }

        // If the node kind is an element, dive into it.
        QName nodeKind = Utils.getNodeQName(node);
        if (nodeKind != null &&
            nodeKind.getLocalPart().equals("element") &&
            Utils.isSchemaNS(nodeKind.getNamespaceURI())) {
            NodeList children = node.getChildNodes();
            Node complexNode = null;
            for (int j = 0; j < children.getLength() && complexNode == null; j++) {
                QName complexKind = Utils.getNodeQName(children.item(j));
                if (complexKind != null &&
                    complexKind.getLocalPart().equals("complexType") &&
                    Utils.isSchemaNS(complexKind.getNamespaceURI())) {
                    complexNode = children.item(j);
                    node = complexNode;
                }
            }
        }
        // Get the node kind, expecting a schema complexType
        nodeKind = Utils.getNodeQName(node);
        if (nodeKind != null &&
            nodeKind.getLocalPart().equals("complexType") &&
            Utils.isSchemaNS(nodeKind.getNamespaceURI())) {

            // Under the complexType there should be a complexContent.
            // (There may be other #text nodes, which we will ignore).
            NodeList children = node.getChildNodes();
            Node complexContentNode = null;
            for (int j = 0; j < children.getLength() && complexContentNode == null; j++) {
                QName complexContentKind = Utils.getNodeQName(children.item(j));
                if (complexContentKind != null &&
                    complexContentKind.getLocalPart().equals("complexContent") &&
                    Utils.isSchemaNS(complexContentKind.getNamespaceURI()))
                    complexContentNode = children.item(j);
            }

            // Under the complexContent there should be a restriction.
            // (There may be other #text nodes, which we will ignore).
            Node restrictionNode = null;
            if (complexContentNode != null) {
                children = complexContentNode.getChildNodes();
                for (int j = 0; j < children.getLength() && restrictionNode == null; j++) {
                    QName restrictionKind = Utils.getNodeQName(children.item(j));
                    if (restrictionKind != null &&
                        restrictionKind.getLocalPart().equals("restriction") &&
                        Utils.isSchemaNS(restrictionKind.getNamespaceURI()))
                        restrictionNode = children.item(j);
                }
            }

            // The restriction node must have a base of soapenc:Array. 
            QName baseType = null;
            if (restrictionNode != null) {
                baseType = Utils.getNodeTypeRefQName(restrictionNode, "base");
                if (baseType != null &&
                    baseType.getLocalPart().equals("Array") &&
                    Utils.isSoapEncodingNS(baseType.getNamespaceURI()))
                    ; // Okay
                else
                    baseType = null// Did not find base=soapenc:Array
            }

           
            // Under the restriction there should be an attribute OR a sequence/all group node.
            // (There may be other #text nodes, which we will ignore).
            Node groupNode = null;
            Node attributeNode = null;
            if (baseType != null) {
                children = restrictionNode.getChildNodes();
                for (int j = 0;
                     j < children.getLength() && groupNode == null && attributeNode == null;
                     j++) {
                    QName kind = Utils.getNodeQName(children.item(j));
                    if (kind != null &&
                        (kind.getLocalPart().equals("sequence") ||
                         kind.getLocalPart().equals("all")) &&
                        Utils.isSchemaNS(kind.getNamespaceURI())) {
                        groupNode = children.item(j);
                    }
                    if (kind != null &&
                        kind.getLocalPart().equals("attribute") &&
                        Utils.isSchemaNS(kind.getNamespaceURI())) {
                        attributeNode = children.item(j);
                    }
                }
            }

            // If there is an attribute node, it must have a ref of soapenc:array and
            // a wsdl:arrayType attribute.
            if (attributeNode != null) {
                QName refQName = Utils.getNodeTypeRefQName(attributeNode, "ref");
                if (refQName != null &&
                    refQName.getLocalPart().equals("arrayType") &&
                    Utils.isSoapEncodingNS(refQName.getNamespaceURI()))
                    ; // Okay
                else
                    refQName = null// Did not find ref="soapenc:arrayType"

                String wsdlArrayTypeValue = null;
                if (refQName != null) {
                    Vector attrs = Utils.getAttributesWithLocalName(attributeNode, "arrayType");
                    for (int i=0; i < attrs.size() && wsdlArrayTypeValue == null; i++) {
                        Node attrNode = (Node) attrs.elementAt(i);
                        String attrName = attrNode.getNodeName();
                        QName attrQName = Utils.getQNameFromPrefixedName(attributeNode, attrName);
                        if (Utils.isWsdlNS(attrQName.getNamespaceURI())) {
                            wsdlArrayTypeValue = attrNode.getNodeValue();
                        }
                    }
                }
               
                // The value should have [] on the end, strip these off.
                // The convert the prefixed name into a qname, and return
                if (wsdlArrayTypeValue != null) {
                    int i = wsdlArrayTypeValue.indexOf("[");
                    if (i > 0) {
                        String prefixedName = wsdlArrayTypeValue.substring(0,i);
                        return Utils.getQNameFromPrefixedName(restrictionNode, prefixedName);
                    }
                }
            } else if (groupNode != null) {

                // Get the first element node under the group node.      
                NodeList elements = groupNode.getChildNodes();
                Node elementNode = null;
                for (int i=0; i < elements.getLength() && elementNode == null; i++) {
                    QName elementKind = Utils.getNodeQName(elements.item(i));
                    if (elementKind != null &&
                        elementKind.getLocalPart().equals("element") &&
                        Utils.isSchemaNS(elementKind.getNamespaceURI())) {
                        elementNode = elements.item(i);
                    }
                }
                
                // The element node should have maxOccurs="unbounded" and
View Full Code Here

     * Create a schema element for the given type
     * @param type the class type
     * @return the QName of the generated Element
     */
    private QName writeTypeAsElement(Class type) throws Exception {
        QName qName = writeTypeNamespace(type);
        String elementType = writeType(type);
        writeSchemaElement(qName, createElement(qName, elementType, isNullable(type)));
        return qName;
    }
View Full Code Here

        // Quick return if schema type
        if (isPrimitiveWsdlType(type))
            return "xsd:" + reg.getTypeQName(type).getLocalPart();

        // Write the namespace
        QName qName = writeTypeNamespace(type);

        // If an array the component type should be processed first
        String componentTypeName = null;
        Class componentType = null;
        if (type.isArray()) {
            componentType = type.getComponentType();
            componentTypeName = writeType(componentType);
        }

        String soapTypeName = qName.getLocalPart();
        String prefix = namespaces.getCreatePrefix(qName.getNamespaceURI());
        String prefixedName = prefix+":"+soapTypeName;

        // If processed before, or this is a known namespace, return
        if (!addToTypesList(qName, soapTypeName))
          return prefixedName;
View Full Code Here

     * convert from JAX-RPC QName to WSDL QName
     * @param qName JAX-RPC QName
     * @return WSDL QName
     */
    private QName getWsdlQName (javax.xml.rpc.namespace.QName qName) {
        return new QName(qName.getNamespaceURI(), qName.getLocalPart());
    }
View Full Code Here

TOP

Related Classes of javax.wsdl.QName

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.