axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Keese (JIRA)" <axis-...@ws.apache.org>
Subject [jira] Created: (AXIS-1778) Array deserialization "broken" for document/literal mode
Date Mon, 24 Jan 2005 00:23:19 GMT
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


Mime
View raw message