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 "Bill Keese (JIRA)" <ax...@ws.apache.org> on 2005/01/24 01:23:19 UTC

[jira] Created: (AXIS-1778) Array deserialization "broken" for document/literal mode

Array deserialization "broken" for document/literal mode
--------------------------------------------------------

         Key: AXIS-1778
         URL: http://issues.apache.org/jira/browse/AXIS-1778
     Project: Axis
        Type: Bug
  Components: Serialization/Deserialization  
    Versions: current (nightly)    
    Reporter: Bill Keese


My .NET client
correctly serializes

class MyClass{
   String[] myArray;
}

as

<MyClass>
  <myArray>
     <item>one</item>
     <item>two</item>
  </myArray>
</MyClass>

However, AXIS cannot deserialize this.  Note that if I use RPC encoding then the type information is stored in the serialized data and Axis can decode it fine.

The workaround is to register a serializer/deserializer in the
WSDD file like this:

<typeMapping
languageSpecificType="java:java.lang.String[]"
qname="soapEncoding:Array"
deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory"
serializer="org.apache.axis.encoding.ser.ArraySerializerFactory"
encodingStyle=""
/>

where

xmlns:soapEncoding="http://schemas.xmlsoap.org/soap/encoding/".

(Of course, you should substitute String[] with the actual type of your
array.)

Is this a bug? I'd like all Array objects to automatically call
ArraySerializer/ArrayDeserializer.

Note also that there is a default serializer/deserializer registered for
ArrayList (although not for List or Collection). However, in
document/literal mode (where no type information is encoded into the
message), Axis has no way of knowing the type (String, Integer, etc.) so
the deserialization fails when processing the first element. Thus your Java
class should contain a simple array like this:

String[] foo;

instead of a list like this:

List foo;

Note that the name of the array (myArray) is NOT listed in the typeMapping above.

-- 
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


[jira] Resolved: (AXIS-1778) Array deserialization "broken" for document/literal mode

Posted by "Davanum Srinivas (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS-1778?page=all ]
     
Davanum Srinivas resolved AXIS-1778:
------------------------------------

    Resolution: Cannot Reproduce

please start with a WSDL and generate the server-side impl for Axis. this should work. Please upload your wsdl if it does not.

thanks,
dims

> Array deserialization "broken" for document/literal mode
> --------------------------------------------------------
>
>          Key: AXIS-1778
>          URL: http://issues.apache.org/jira/browse/AXIS-1778
>      Project: Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: current (nightly)
>     Reporter: Bill Keese

>
> My .NET client
> correctly serializes
> class MyClass{
>    String[] myArray;
> }
> as
> <MyClass>
>   <myArray>
>      <item>one</item>
>      <item>two</item>
>   </myArray>
> </MyClass>
> However, AXIS cannot deserialize this.  Note that if I use RPC encoding then the type information is stored in the serialized data and Axis can decode it fine.
> The workaround is to register a serializer/deserializer in the
> WSDD file like this:
> <typeMapping
> languageSpecificType="java:java.lang.String[]"
> qname="soapEncoding:Array"
> deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory"
> serializer="org.apache.axis.encoding.ser.ArraySerializerFactory"
> encodingStyle=""
> />
> where
> xmlns:soapEncoding="http://schemas.xmlsoap.org/soap/encoding/".
> (Of course, you should substitute String[] with the actual type of your
> array.)
> Is this a bug? I'd like all Array objects to automatically call
> ArraySerializer/ArrayDeserializer.
> Note also that there is a default serializer/deserializer registered for
> ArrayList (although not for List or Collection). However, in
> document/literal mode (where no type information is encoded into the
> message), Axis has no way of knowing the type (String, Integer, etc.) so
> the deserialization fails when processing the first element. Thus your Java
> class should contain a simple array like this:
> String[] foo;
> instead of a list like this:
> List foo;
> Note that the name of the array (myArray) is NOT listed in the typeMapping above.

-- 
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
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira