Package javax.xml.rpc.namespace

Examples of javax.xml.rpc.namespace.QName


                                    DeserializationContext context)
        throws SAXException
    {
        BeanPropertyDescriptor propDesc = null;
       
        QName elemQName = new QName(namespace, localName);
        // The collectionIndex needs to be reset for Beans with multiple arrays
        if ((prevQName == null) || (!prevQName.equals(elemQName))) {
            prevQName = elemQName;
            collectionIndex = -1;
       
        prevQName = elemQName;

        if (typeDesc != null) {      
           
            // First lookup the field using the target namespace context
            // and local name.  If this fails and the incoming element
            // name is not prefixed, lookup the name assuming an unqualified
            // name.
            String fieldName = typeDesc.getFieldNameForElement(elemQName,
                                                               false);
            if (fieldName == null && (prefix == null || prefix.equals(""))) {
                fieldName =
                    typeDesc.getFieldNameForElement(
                      new QName("", elemQName.getLocalPart()), false);
            }

            propDesc = (BeanPropertyDescriptor)propertyMap.get(fieldName);
        }

        if (propDesc == null) {
            // look for a field by this name.
            propDesc = (BeanPropertyDescriptor) propertyMap.get(localName);
        }

        // Currently the meta data does not consider inheritance.
        // Glen is working on a fix.  In the meantime, the following
        // code attempts to get the meta data from the base class. 
        // (this fix does not work in all cases, but is necessary to
        // get comprehensive tests Animal - Cat inheritance to work).
        if (propDesc == null) {
            Class superClass = javaType;
            while (superClass != null && propDesc == null) {
                superClass = superClass.getSuperclass();
                if (superClass != null) {
                    TypeDesc td = TypeDesc.getTypeDescForClass(superClass);
                    if (td != null) {
                        String fieldName =
                            td.getFieldNameForElement(elemQName,
                                                      false);
                        if (fieldName == null &&
                            (prefix == null || prefix.equals(""))) {
                            fieldName =
                                td.getFieldNameForElement(
                                new QName("", elemQName.getLocalPart()), false);
                        }
                       
                        propDesc =
                            (BeanPropertyDescriptor)propertyMap.get(fieldName);
                    }
                }
            }
        }

        if (propDesc == null) {
            // No such field
            throw new SAXException(
                    JavaUtils.getMessage("badElem00", javaType.getName(),
                                         localName));
        }

        // Determine the QName for this child element.
        // Look at the type attribute specified.  If this fails,
        // use the javaType of the property to get the type qname.
        QName qn = context.getTypeFromAttributes(namespace, localName, attributes);
       
        // get the deserializer
        Deserializer dSer = context.getDeserializerForType(qn);
       
        // If no deserializer, use the base DeserializerImpl.
View Full Code Here


            return;
       
        // loop through the attributes and set bean properties that
        // correspond to attributes
        for (int i=0; i < attributes.getLength(); i++) {
            QName attrQName = new QName(attributes.getURI(i),
                                        attributes.getLocalName(i));
            String fieldName = typeDesc.getFieldNameForAttribute(attrQName);
            if (fieldName == null)
                continue;

            String attrName = attributes.getLocalName(i);

            // look for the attribute property
            BeanPropertyDescriptor bpd =
                    (BeanPropertyDescriptor) propertyMap.get(fieldName);
            if (bpd != null) {
                if (!bpd.isWriteable() || bpd.isIndexed() ) continue ;
               
                // determine the QName for this child element
                TypeMapping tm = context.getTypeMapping();
                Class type = bpd.getType();
                QName qn = tm.getTypeQName(type);
                if (qn == null)
                    throw new SAXException(
                            JavaUtils.getMessage("unregistered00", type.toString()));
               
                // get the deserializer
View Full Code Here

            if (elementMappings != null) {
                Iterator i = elementMappings.entrySet().iterator();
                while (i.hasNext()) {
                    Map.Entry entry = (Map.Entry) i.next();
                    String fieldName = (String)entry.getKey();
                    QName xmlName = (QName) entry.getValue();
                    pw.print("        ");
                    if (!wroteFieldType) {
                        pw.print("org.apache.axis.description.FieldDesc ");
                        wroteFieldType = true;
                    }
                    pw.println("field = new org.apache.axis.description.ElementDesc();");
                    pw.println("        field.setFieldName(\"" + fieldName + "\");");
                    pw.print"        field.setXmlName(new javax.xml.rpc.namespace.QName(\"");
                    pw.println(xmlName.getNamespaceURI() + "\", \"" +
                               xmlName.getLocalPart() + "\"));");
                    pw.println("        typeDesc.addFieldDesc(field);");
                }
            }

            pw.println("    };");
View Full Code Here

        TypeMappingRegistry tmr = server.getTypeMappingRegistry();
        TypeMapping tm = (TypeMapping) tmr.createTypeMapping();
        tm.setSupportedNamespaces(new String[]{Constants.URI_CURRENT_SOAP_ENC});
        tmr.register(Constants.URI_CURRENT_SOAP_ENC, tm);
        tm.register(test.encoding.RETURN.class,
                new QName("urn:test.encoding", "RETURN"),
                new org.apache.axis.encoding.ser.BeanSerializerFactory(
                        test.encoding.RETURN.class,
                        new QName("urn:test.encoding", "RETURN")),
                new org.apache.axis.encoding.ser.BeanDeserializerFactory(
                        test.encoding.RETURN.class,
                        new QName("urn:test.encoding", "RETURN")));
    }
View Full Code Here

        //log.debug("namespace = " + nsURI);
       
        if (nsURI == null)
            return null;
       
        return new QName(nsURI, qNameStr.substring(i + 1));
    }
View Full Code Here

     * @param attrs are the attributes on the element
     */
    public QName getTypeFromAttributes(String namespace, String localName,
                                       Attributes attrs)
    {
        QName typeQName = null;
       
        // Check for type
        String type = Constants.getValue(attrs, Constants.URIS_SCHEMA_XSI,
                                         "type");
        if (type != null) {
            // Return the type attribute value converted to a QName
            return getQNameFromString(type);
        }

        if (typeQName == null) {

            // If the element is a SOAP-ENC element, the name of the element is the type.
            // If the default type mapping accepts SOAP 1.2, then use then set
            // the typeQName to the SOAP-ENC type.
            // Else if the default type mapping accepts SOAP 1.1, then
            // convert the SOAP-ENC type to the appropriate XSD Schema Type.
            QName myQName = new QName(namespace, localName);
            if (Constants.URI_CURRENT_SOAP_ENC.equals(Constants.URI_SOAP12_ENC) &&
                Constants.isSOAP_ENC(namespace)) {
                typeQName = myQName;
            } else if (myQName.equals(Constants.SOAP_ARRAY)) {
                typeQName = Constants.SOAP_ARRAY;
            } else if (myQName.equals(Constants.SOAP_STRING)) {
                typeQName = Constants.SOAP_STRING;
            } else if (myQName.equals(Constants.SOAP_BOOLEAN)) {
                typeQName = Constants.SOAP_BOOLEAN;
            } else if (myQName.equals(Constants.SOAP_DOUBLE)) {
                typeQName = Constants.SOAP_DOUBLE;
            } else if (myQName.equals(Constants.SOAP_FLOAT)) {
                typeQName = Constants.SOAP_FLOAT;
            } else if (myQName.equals(Constants.SOAP_INT)) {
                typeQName = Constants.SOAP_INT;
            } else if (myQName.equals(Constants.SOAP_LONG)) {
                typeQName = Constants.SOAP_LONG;
            } else if (myQName.equals(Constants.SOAP_SHORT)) {
                typeQName = Constants.SOAP_SHORT;
            } else if (myQName.equals(Constants.SOAP_BYTE)) {
                typeQName = Constants.SOAP_BYTE;
            }
        }

        // Return with the type if the name matches one of the above primitives
View Full Code Here

    public void writeToContext(SerializationContext context)
        throws IOException
    {
        context.registerPrefixForURI("", WSDDConstants.WSDD_NS);
        context.registerPrefixForURI("java", WSDDConstants.WSDD_JAVA);
        context.startElement(new QName(WSDDConstants.WSDD_NS, "deployment"),
                             null);

        if (globalConfig != null) {
            globalConfig.writeToContext(context);
        }
View Full Code Here

        if (idx > -1) {
            String prefix = str.substring(0, idx);
            String ns = getNamespace(prefix, e);
            if (ns == null)
                return null;
            return new QName(ns, str.substring(idx + 1));
        } else {
            return new QName("", str);
        }
    }
View Full Code Here

        ServiceDesc desc = service.getServiceDescription();
        // We need parameter descriptors to make sure we can match by name
        // (the only way omitted==null can work).
        ParameterDesc [] params = new ParameterDesc [] {
            new ParameterDesc(new QName("", "param1"), ParameterDesc.IN, null),
            new ParameterDesc(new QName("", "param2"), ParameterDesc.IN, null),
            new ParameterDesc(new QName("", "param3"), ParameterDesc.IN, null),
        };
        OperationDesc oper = new OperationDesc("method", params, null);
        desc.addOperationDesc(oper);
        config.deployService("testOmittedValue", service);
View Full Code Here

                int j;
                for (j = 0; j < paramTypes.length; j++) {
                    Class type = paramTypes[j];
                    ParameterDesc param = oper.getParameter(j);
                    // If no type is specified, just use the Java type
                    QName typeQName = param.getTypeQName();
                    if (typeQName == null) {
                        if (Holder.class.isAssignableFrom(type)) {
                            typeQName = tm.getTypeQName(
                                            JavaUtils.getHolderValueType(type));
                        } else {
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.