Package javax.xml.rpc.namespace

Examples of javax.xml.rpc.namespace.QName


        // parameter description information exists.
        // Set the xmlType using the parameter description
        // information.  (an xmlType=null causes the
        // serialize method to search for a compatible xmlType)
        Class javaType = value == null ? null: value.getClass();
        QName xmlType = null;
        if (paramDesc != null) {
            javaType = paramDesc.getJavaType() != null ?
                paramDesc.getJavaType(): javaType;
            xmlType = paramDesc.getTypeQName();
        }
View Full Code Here


            for (int i=0; i<propertyDescriptor.length; i++) {
                String propName = propertyDescriptor[i].getName();
                if (propName.equals("class"))
                    continue;

                QName qname = null;

                // If we have type metadata, check to see what we're doing
                // with this field.  If it's an attribute, skip it.  If it's
                // an element, use whatever qname is in there.  If we can't
                // find any of this info, use the default.

                if (typeDesc != null) {
                    FieldDesc field = typeDesc.getFieldByName(propName);
                    if (field != null) {
                        if (!field.isElement())
                            continue;

                        qname = field.getXmlName();
                    }
                }

                if (qname == null) {
                    // Use the default...
                    propName = propName;
                    qname = new QName("", propName);
                }

                // Read the value from the property
                if(propertyDescriptor[i].isReadable()) {
                    Class baseJavaType = propertyDescriptor[i].getType();
View Full Code Here

            if (typeDesc != null) {
                FieldDesc fieldDesc = typeDesc.getFieldByName(field.getName());
                if (fieldDesc != null) {
                    if (!fieldDesc.isElement()) {
                        QName attrName = typeDesc.getAttributeNameForField(
                                                    field.getName());
                        writeAttribute(types, attrName.getLocalPart(),
                                       field.getType(),
                                       complexType);
                        continue;
                    } else {
                        QName xmlName = typeDesc.getElementNameForField(
                                field.getName());
                        if (xmlName != null) {
                            if (xmlName.getNamespaceURI() != "") {
                                // Throw an exception until we can emit
                                // schema for this correctly?
                            }
                            name = xmlName.getLocalPart();
                            writeField(types, name, field.getType(),
                                       field.getIndexed(), all);
                            continue;
                        }
                    }
View Full Code Here

                FieldDesc field = typeDesc.getFieldByName(propName);
                // skip it if its not an attribute
                if (field == null || field.isElement())
                    continue;

                QName qname = field.getXmlName();
                if (qname == null) {
                    qname = new QName("", propName);
                }

                if (propertyDescriptor[i].isReadable() &&
                    !propertyDescriptor[i].isIndexed()) {
                    // add to our attributes
                    Object propValue = propertyDescriptor[i].get(value);
                    // If the property value does not exist, don't serialize
                    // the attribute.  In the future, the decision to serializer
                    // the attribute may be more sophisticated.  For example, don't
                    // serialize if the attribute matches the default value.
                    if (propValue != null) {
                        String propString = propValue.toString();
                        String namespace = qname.getNamespaceURI();
                        String localName = qname.getLocalPart();

                        attrs.addAttribute(namespace,
                                           localName,
                                           context.qName2String(qname),
                                           "CDATA",
View Full Code Here

        call.setTransport(transport);

        Vector v = new Vector();
        v.addElement("Hi there!");
        v.addElement("This'll be a SOAP Array and then a LinkedList!");
        call.setOperationName(new QName(SERVICE_NAME, "echoLinkedList"));
        Object ret = call.invoke(new Object[]{v});
        if (!equals(v, ret)) assertEquals("Echo LinkedList mangled the result.  Result is underneath.\n" + ret, v, ret);
    }
View Full Code Here

        LinkedList l = new LinkedList();
        l.add("Linked list item #1");
        l.add("Second linked list item");
        l.add("This will be a SOAP Array then a Vector!");

        call.setOperationName(new QName(SERVICE_NAME, "echoVector"));
        Object ret = call.invoke(new Object[]{l});
        if (!equals(l, ret)) assertEquals("Echo Vector mangled the result.  Result is underneath.\n" + ret, l, ret);
    }
View Full Code Here

        Vector v = new Vector();
        v.addElement("Hi there!");
        v.addElement("This'll be a SOAP Array");

        call.setOperationName(new QName(SERVICE_NAME, "echoArray"));
        Object ret = call.invoke(new Object[]{v});
        if (!equals(v, ret)) assertEquals("Echo Array mangled the result.  Result is underneath\n" + ret, v, ret);
    }
View Full Code Here

        LinkedList l = new LinkedList();
        l.add("Linked list item #1");
        l.add("Second linked list item");
        l.add("This will be a SOAP Array then a Vector!");

        call.setOperationName(new QName(SERVICE_NAME, "echoArray"));
        call.setReturnClass(Vector.class);
        Object ret = call.invoke(new Object[]{l});
        assertEquals("Return wasn't a Vector!", Vector.class, ret.getClass());
        Vector v = (Vector)ret;
        assertEquals("Sizes were different", l.size(), v.size());
View Full Code Here

               "enter00", "ArrayDeserializer.startElement()"));
        }

        // Get the qname for the array type=, set it to null if
        // the generic type is used.
        QName typeQName = context.getTypeFromAttributes(namespace,
                                                        localName,
                                                        attributes);
        if (typeQName != null &&
            Constants.equals(Constants.SOAP_ARRAY, typeQName)) {
            typeQName = null;
        }

        // Now get the arrayType value
        QName arrayTypeValue = context.getQNameFromString(
                      Constants.getValue(attributes,
                                         Constants.URIS_SOAP_ENC,
                                         Constants.ATTR_ARRAY_TYPE));

        // The first part of the arrayType expression is
        // the default item type qname.
        // The second part is the dimension information
        String dimString = null;
        QName innerQName = null;
        String innerDimString = "";
        if (arrayTypeValue != null) {
            String arrayTypeValueNamespaceURI =
                arrayTypeValue.getNamespaceURI();
            String arrayTypeValueLocalPart =
                arrayTypeValue.getLocalPart();
            int leftBracketIndex =
                arrayTypeValueLocalPart.lastIndexOf('[');
            int rightBracketIndex =
                arrayTypeValueLocalPart.lastIndexOf(']');
            if (leftBracketIndex == -1
                || rightBracketIndex == -1
                || rightBracketIndex < leftBracketIndex)
                {
                    throw new IllegalArgumentException(
                      JavaUtils.getMessage("badArrayType00",
                                           "" + arrayTypeValue));
                }
           
            dimString =
                arrayTypeValueLocalPart.substring(leftBracketIndex + 1,
                                                  rightBracketIndex);
            arrayTypeValueLocalPart =
                arrayTypeValueLocalPart.substring(0, leftBracketIndex);
           
            // If multi-dim array set to soapenc:Array
            if (arrayTypeValueLocalPart.endsWith("]")) {
                defaultItemType =
                    new QName(Constants.URI_CURRENT_SOAP_ENC, "Array");
                innerQName = new QName(
                    arrayTypeValueNamespaceURI,
                    arrayTypeValueLocalPart.substring(0,
                        arrayTypeValueLocalPart.indexOf("[")));
                innerDimString = arrayTypeValueLocalPart.substring(
                    arrayTypeValueLocalPart.indexOf("["));
            } else {
                defaultItemType = new QName(arrayTypeValueNamespaceURI,
                                            arrayTypeValueLocalPart);
            }
        }

        // If no type QName and no defaultItemType qname, use xsd:anyType
        if (defaultItemType == null && typeQName == null) {
            defaultItemType =
                new QName(Constants.URI_CURRENT_SCHEMA_XSD, "anyType");
        }
       
        // Determine the class type for the array.
        arrayClass = null;
        if (typeQName != null) {
            arrayClass = context.getTypeMapping().
                getClassForQName(typeQName);
        } else {
            // type= information is not sufficient.
            // Get an array of the default item type.
            Class arrayItemClass = null;
            QName compQName = defaultItemType;
            String dims = "[]";
            // Nested array, use the innermost qname
            if (innerQName != null) {
                compQName = innerQName;
                dims += innerDimString;               
View Full Code Here

                return null;
            }
        }

        // Use the xsi:type setting on the attribute if it exists.
        QName itemType = context.getTypeFromAttributes(namespace,
                                                       localName,
                                                       attributes);

        // Get the deserializer for the type.  If no deserializer is
        // found, the deserializer is set to DeserializerImpl().
        // It is possible that the element has an href, thus we
        // won't know the type until the definitition is encountered.
        Deserializer dSer = null;
        if (itemType != null) {
            dSer = context.getDeserializerForType(itemType);
        }
        if (dSer == null) {
            dSer = new DeserializerImpl()
            // Determine a default type for the deserializer
            if (itemType == null) {
                QName defaultType = defaultItemType;
                // If defaultType is not known, try using the arrayClass info
                if (defaultType == null &&
                    arrayClass != null &&
                    arrayClass.isArray()) {
                    defaultType = context.getTypeMapping().
View Full Code Here

TOP

Related Classes of javax.xml.rpc.namespace.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.