You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Patrick Houbaux (JIRA)" <ax...@ws.apache.org> on 2005/01/04 09:24:19 UTC

[jira] Commented: (AXIS-1746) [MultiRef] SerializationContext.isPrimitive return false for bean property of primitive type

     [ http://issues.apache.org/jira/browse/AXIS-1746?page=comments#action_57250 ]
     
Patrick Houbaux commented on AXIS-1746:
---------------------------------------

Ok it seems that I found a workaround to this.

Declaring the type mapping for the primitive types in the deployment wsdd file seems to do the trick.

Is this the correct way?

Meaning adding the following to deploy.wsdd of the webservice:

<typeMapping  qname="ns:double"
            xmlns:ns="http://www.w3.org/2001/XMLSchema"
            type="java:java.lang.Double" 
            serializer="org.apache.axis.encoding.ser.SimpleSerializerFactory" 
            deserializer="org.apache.axis.encoding.ser.SimpleDeserializerFactory" 
            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
      
<typeMapping  qname="ns:int"
            xmlns:ns="http://www.w3.org/2001/XMLSchema"
            type="java:java.lang.Integer" 
            serializer="org.apache.axis.encoding.ser.SimpleSerializerFactory" 
            deserializer="org.apache.axis.encoding.ser.SimpleDeserializerFactory" 
            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
                    
<typeMapping  qname="ns:boolean"
            xmlns:ns="http://www.w3.org/2001/XMLSchema"
            type="java:java.lang.Boolean" 
            serializer="org.apache.axis.encoding.ser.SimpleSerializerFactory" 
            deserializer="org.apache.axis.encoding.ser.SimpleDeserializerFactory" 
            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
                    
<typeMapping  qname="ns:long"
            xmlns:ns="http://www.w3.org/2001/XMLSchema"
            type="java:java.lang.Long" 
            serializer="org.apache.axis.encoding.ser.SimpleSerializerFactory" 
            deserializer="org.apache.axis.encoding.ser.SimpleDeserializerFactory" 
            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
                    
<typeMapping  qname="ns:float"
            xmlns:ns="http://www.w3.org/2001/XMLSchema"
            type="java:java.lang.Float" 
            serializer="org.apache.axis.encoding.ser.SimpleSerializerFactory" 
            deserializer="org.apache.axis.encoding.ser.SimpleDeserializerFactory" 
            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
                    
<typeMapping  qname="ns:byte"
            xmlns:ns="http://www.w3.org/2001/XMLSchema"
            type="java:java.lang.Byte" 
            serializer="org.apache.axis.encoding.ser.SimpleSerializerFactory" 
            deserializer="org.apache.axis.encoding.ser.SimpleDeserializerFactory" 
            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
                    
<typeMapping qname="ns:short"
            xmlns:ns="http://www.w3.org/2001/XMLSchema"
            type="java:java.lang.Short"
            serializer="org.apache.axis.encoding.ser.SimpleSerializerFactory" 
            deserializer="org.apache.axis.encoding.ser.SimpleDeserializerFactory" 
            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

> [MultiRef] SerializationContext.isPrimitive return false for bean property of primitive type
> --------------------------------------------------------------------------------------------
>
>          Key: AXIS-1746
>          URL: http://issues.apache.org/jira/browse/AXIS-1746
>      Project: Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2RC2
>  Environment: Tomcat 5.0.16
> JDK 1.4.2_03
> OS Windows 2000
> Architecture x86
>     Reporter: Patrick Houbaux
>     Priority: Blocker
>  Attachments: ArraySerialization_MultiRef.xml
>
> Using a RPC web service using complex data types (exposed java beans with primitive type properties).
> Using Multi-Ref because the data type model is a graph.
> BUG: For the primitive type properties of the beans sent through the wire, Axis sent them as multi ref.
> Explanation:
> After a debugging session with the Axis 1.2RC2 source, noticed that the SerializationContext.isPrimitive method in org.apache.axis.encoding return false for these simple types.
> The method    public void serialize(QName elemQName,
>                           Attributes attributes,
>                           Object value,
>                           QName xmlType,
>                           Boolean sendNull,
>                           Boolean sendType)
> at line 727 is called with a correct xmlType (i.e. (http://www.w3.org/2001/XMLSchema)double for instance) parameter for the simple type but in the body of this method the checking if the value is a primitive (line 802) is not taking into account this correct xmlType.
> In the method isPrimitive the following test(starting at line 609) fails:
>         // Note that java.lang wrapper classes (i.e. java.lang.Integer) are
>         // not primitives unless the corresponding type is an xsd type.
>         // (If the wrapper maps to a soap encoded primitive, it can be nillable
>         // and multi-ref'd).
>         QName qName = getQNameForClass(javaType);
>         if (qName != null && Constants.isSchemaXSD(qName.getNamespaceURI())) {
>             if (SchemaUtils.isSimpleSchemaType(qName)) {
>                 return true;
>             }
>         }
> During the debug runtime the values in the previous piece of code are the following:
> - javaType = java.lang.Double
> - qName = (http://schemas.xmlsoap.org/soap/encoding/)double
> Why qName don't get the value : (http://www.w3.org/2001/XMLSchema)double?
> Following an example of what is sent through the wire.
> p.s.: Orginally sent in the axis-user mailing list, thread:
> "Axis 1.2RC2: multiref serialization of xsd simple types / interoperability with .NET"

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira