axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Keese <bi...@tech.beacon-it.co.jp>
Subject Re: Arrays: .NET client --> AXIS server
Date Fri, 21 Jan 2005 00:33:47 GMT
After looking into the code, I found out that deserialization for arrays
works automatically in rpc/encoded mode, but not in document/literal
mode. 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 conversion 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 is NOT listed in the typeMapping above.

Bill




Bill Keese wrote:

>I'm using Axis (server) to run a wrapped/literal service. My .NET client
>correctly encodes my
>
>   String[] myArray;
>
>array as
>
>  <myArray>
>     <item>one</item>
>     <item>two</item>
>  </myArray>
>
>However, the AXIS server chokes on this. It gets a nullPointerException
>is BeanDeserializer.onStartChild() for the myArray tag.
>
>I've read Eric Chijioke's post entitled "Axis and .NET interoperability
>- Arrays", but that seems to concern passing arrays from the AXIS server
>to a .NET client, rather than vice-versa. So, my two questions are:
>
>1) When implementing a document/literal service, should you use
>BeanSerializer/BeanDeserializer to encode/decode your objects, or should
>you use something else, like http://xmlbeans.apache.org/?
>
>2) are there any other steps to do to support this?
>
>Bill
>
>
>  
>

Mime
View raw message