You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Dongsheng Song <eg...@hotmail.com> on 2002/12/11 04:17:25 UTC
help: Nesting arrays & structs
I use a very complex type for soap, Please Help me modify my deploy.wsdd file:
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="EnterUp" provider="java:RPC">
<parameter name="className" value="EnterUp"/>
<parameter name="allowedMethods" value="*"/>
<typeMapping
xmlns:ns="http://soapinterop.org/xsd"
qname="ns:T"
type="java:T"
serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
/>
</service>
</deployment>
public class EnterUp
{
public String register(T info)
{
}
}
public class T implements java.io.Serializable{
public T2 fd;
public T3[] fd2;
}
public class T2 implements java.io.Serializable{
public String fd;
public String fd2;
}
public class T3 implements java.io.Serializable{
public String fd;
public String fd2;
}
furthermore, is ther a java2wsdd tool ?
Re: help: Nesting arrays & structs
Posted by Mitch Gitman <mg...@usa.net>.
Possible Axis bug?
I have a class Parent with a method:
public Child[] getChildrenAsArray()
With a regular bean (de)serializer, I was always getting:
java.io.IOException: java.lang.ClassCastException:
[Ljava.lang.Object;
at
org.apache.axis.encoding.ser.BeanSerializer.serialize(BeanSerializer.java:261)
Finally, I realized this method was not the culprit. Instead, the problem
was arising from a method in Parent's superclass:
protected Object[] toObjectArray()
Why is Axis' BeanSerializer attempting to use a protected method? I thought
it was only supposed to use public methods; every other access level was
avoided. What are the rules, or is this a bug?
At 23:59 11.12.02 -0500, you wrote:
>I too converted my collections to arrays and found that it worked well.
>I would also be curious to know why the standard (de)serializers
>wouldn't work. I have been using beans and arrays of nested beans
>without any trouble, and without needing the custom stuff.
>
>If you want to satisfy your curiosity, you could always submit your
>sources with their deployment descriptors here. I am sure someone would
>know the answer.
>
>It is possible that you are getting the ClassCastException with your
>toArray method, and it is unrelated to Axis. I would test this by
>replacing the body of the get method with a statement that returned a
>dummy array, with one element.
>
>Take care,
>
>Ben Tomasini
>
>On Wed, 2002-12-11 at 23:07, Mitch Gitman wrote:
> > I have a similar requirement. I need a class that contains an array of
> > another class. Like Mr. Tomasini advised, I hid the member variable for
> the
> > array and instead used a public getter and setter. Here are the relevant
> > methods for the class, which I'll refer to here as Parent:
> > public Child[] getChildrenAsArray() {
> > ____Collection all = getValuesHelper();
> > ____return (Child[])all.toArray(new Child[all.size()]);
> > }
> >
> > /** Dummy method used just for bean compliance */
> > public void setChildrenAsArray(Child[] ideasArray) { }
> >
> > I was not able to make the regular bean (de)serializer work for the parent
> > class. So I resorted to using a custom (de)serializer. This is not to
> > generalize that the bean (de)serializer can't work; I've seen someone
> > else's web service work in this same circumstance. While I might as well
> > stick with what's working for me, I would be curious why the default
> does not.
> >
> > Here's the error I always get with the bean (de)serializer:
> > AxisFault
> > faultCode:
> {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
> > faultSubcode:
> > faultString: java.io.IOException: java.lang.ClassCastException:
> > [Ljava.lang.Object;
> > faultActor: null
> > faultNode: null
> > faultDetail:
> > stackTrace: java.io.IOException: java.lang.ClassCastException:
> > [Ljava.lang.Object;
> > at
> >
> org.apache.axis.encoding.ser.BeanSerializer.serialize(BeanSerializer.java:261)
> > ...
> >
> > To turn on the custom serialization, I had go into deploy.wsdd (which is
> > used to generate server-config.wsdd) and manually change the typeMapping
> > element's (de)serializer attributes. Here's the changed element:
> > <typeMapping xmlns:ns="urn:bar.foo" qname="ns:Parent"
> > type="java:foo.bar.Parent"
> > serializer="foo.bar.axis.ParentSerializerFactory"
> > deserializer="foo.bar.axis.ParentDeserializerFactory"
> > encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
> >
> > I wrote the (de)serializer classes and their respective factories based on
> > examples from the book "AXIS: The Next Generation of Java SOAP," published
> > by Wrox Press. The book's a little out-of-date already, so I had to update
> > the method signatures slightly.
> >
> > Now when I run a test Axis client against an Axis server, the Parent data
> > structure is serialized, sent and deserialized correctly, with zero,
> one or
> > more children in the array. However, I'm not sure if the Axis client is
> > truly using the custom deserializer and not BeanDeserializer.
> >
> > At 22:18 10.12.02 -0500, you wrote:
> > >I would make T ... T3 into java beans (private members with
> > >corresponding public getters and setters). If you can't do that, wrap
> > >them with classes that are. Axis will have a hard time with your
> > >classes becuase they are public instance variables.
> > >
> > >You could write your own serializers, but that would be lots of work.
> > >
> > >Very compelx things can genrally be done with ease if you stick with
> > >these conventions.
> > >
> > >Ben Tomasini
> > >
Re: help: Nesting arrays & structs
Posted by David payam <ot...@yahoo.ca>.
hi:
I also want to know the answer that how I can serialize and deserialize the
arrays of nested beans?
So would you please send some code to me? or post them here?
Thanks
Benjamin Tomasini <bt...@neteverything.com> wrote:I too converted my collections to arrays and found that it worked well.
I would also be curious to know why the standard (de)serializers
wouldn't work. I have been using beans and arrays of nested beans
without any trouble, and without needing the custom stuff.
If you want to satisfy your curiosity, you could always submit your
sources with their deployment descriptors here. I am sure someone would
know the answer.
It is possible that you are getting the ClassCastException with your
toArray method, and it is unrelated to Axis. I would test this by
replacing the body of the get method with a statement that returned a
dummy array, with one element.
Take care,
Ben Tomasini
On Wed, 2002-12-11 at 23:07, Mitch Gitman wrote:
> I have a similar requirement. I need a class that contains an array of
> another class. Like Mr. Tomasini advised, I hid the member variable for the
> array and instead used a public getter and setter. Here are the relevant
> methods for the class, which I'll refer to here as Parent:
> public Child[] getChildrenAsArray() {
> ____Collection all = getValuesHelper();
> ____return (Child[])all.toArray(new Child[all.size()]);
> }
>
> /** Dummy method used just for bean compliance */
> public void setChildrenAsArray(Child[] ideasArray) { }
>
> I was not able to make the regular bean (de)serializer work for the parent
> class. So I resorted to using a custom (de)serializer. This is not to
> generalize that the bean (de)serializer can't work; I've seen someone
> else's web service work in this same circumstance. While I might as well
> stick with what's working for me, I would be curious why the default does not.
>
> Here's the error I always get with the bean (de)serializer:
> AxisFault
> faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
> faultSubcode:
> faultString: java.io.IOException: java.lang.ClassCastException:
> [Ljava.lang.Object;
> faultActor: null
> faultNode: null
> faultDetail:
> stackTrace: java.io.IOException: java.lang.ClassCastException:
> [Ljava.lang.Object;
> at
> org.apache.axis.encoding.ser.BeanSerializer.serialize(BeanSerializer.java:261)
> ...
>
> To turn on the custom serialization, I had go into deploy.wsdd (which is
> used to generate server-config.wsdd) and manually change the typeMapping
> element's (de)serializer attributes. Here's the changed element:
> > type="java:foo.bar.Parent"
> serializer="foo.bar.axis.ParentSerializerFactory"
> deserializer="foo.bar.axis.ParentDeserializerFactory"
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
>
> I wrote the (de)serializer classes and their respective factories based on
> examples from the book "AXIS: The Next Generation of Java SOAP," published
> by Wrox Press. The book's a little out-of-date already, so I had to update
> the method signatures slightly.
>
> Now when I run a test Axis client against an Axis server, the Parent data
> structure is serialized, sent and deserialized correctly, with zero, one or
> more children in the array. However, I'm not sure if the Axis client is
> truly using the custom deserializer and not BeanDeserializer.
>
> At 22:18 10.12.02 -0500, you wrote:
> >I would make T ... T3 into java beans (private members with
> >corresponding public getters and setters). If you can't do that, wrap
> >them with classes that are. Axis will have a hard time with your
> >classes becuase they are public instance variables.
> >
> >You could write your own serializers, but that would be lots of work.
> >
> >Very compelx things can genrally be done with ease if you stick with
> >these conventions.
> >
> >Ben Tomasini
> >
> >
> >
> >On Tue, 2002-12-10 at 22:17, Dongsheng Song wrote:
> > > I use a very complex type for soap, Please Help me modify my
> > deploy.wsdd file:
> > >
> > > > > > xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
> > >
> > >
> > >
> > >
> > >
> > >
> > > > > > xmlns:ns="http://soapinterop.org/xsd"
> > > qname="ns:T"
> > > type="java:T"
> > > serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
> > > deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
> > > encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> > > />
> > >
> > >
> > >
> > >
> > > public class EnterUp
> > > {
> > > public String register(T info)
> > > {
> > > }
> > > }
> > >
> > > public class T implements java.io.Serializable{
> > > public T2 fd;
> > > public T3[] fd2;
> > > }
> > >
> > > public class T2 implements java.io.Serializable{
> > > public String fd;
> > > public String fd2;
> > > }
> > >
> > > public class T3 implements java.io.Serializable{
> > > public String fd;
> > > public String fd2;
> > > }
> > >
> > > furthermore, is ther a java2wsdd tool ?
>
---------------------------------
Post your free ad now! Yahoo! Canada Personals
Re: help: Nesting arrays & structs
Posted by Benjamin Tomasini <bt...@neteverything.com>.
I too converted my collections to arrays and found that it worked well.
I would also be curious to know why the standard (de)serializers
wouldn't work. I have been using beans and arrays of nested beans
without any trouble, and without needing the custom stuff.
If you want to satisfy your curiosity, you could always submit your
sources with their deployment descriptors here. I am sure someone would
know the answer.
It is possible that you are getting the ClassCastException with your
toArray method, and it is unrelated to Axis. I would test this by
replacing the body of the get method with a statement that returned a
dummy array, with one element.
Take care,
Ben Tomasini
On Wed, 2002-12-11 at 23:07, Mitch Gitman wrote:
> I have a similar requirement. I need a class that contains an array of
> another class. Like Mr. Tomasini advised, I hid the member variable for the
> array and instead used a public getter and setter. Here are the relevant
> methods for the class, which I'll refer to here as Parent:
> public Child[] getChildrenAsArray() {
> ____Collection all = getValuesHelper();
> ____return (Child[])all.toArray(new Child[all.size()]);
> }
>
> /** Dummy method used just for bean compliance */
> public void setChildrenAsArray(Child[] ideasArray) { }
>
> I was not able to make the regular bean (de)serializer work for the parent
> class. So I resorted to using a custom (de)serializer. This is not to
> generalize that the bean (de)serializer can't work; I've seen someone
> else's web service work in this same circumstance. While I might as well
> stick with what's working for me, I would be curious why the default does not.
>
> Here's the error I always get with the bean (de)serializer:
> AxisFault
> faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
> faultSubcode:
> faultString: java.io.IOException: java.lang.ClassCastException:
> [Ljava.lang.Object;
> faultActor: null
> faultNode: null
> faultDetail:
> stackTrace: java.io.IOException: java.lang.ClassCastException:
> [Ljava.lang.Object;
> at
> org.apache.axis.encoding.ser.BeanSerializer.serialize(BeanSerializer.java:261)
> ...
>
> To turn on the custom serialization, I had go into deploy.wsdd (which is
> used to generate server-config.wsdd) and manually change the typeMapping
> element's (de)serializer attributes. Here's the changed element:
> <typeMapping xmlns:ns="urn:bar.foo" qname="ns:Parent"
> type="java:foo.bar.Parent"
> serializer="foo.bar.axis.ParentSerializerFactory"
> deserializer="foo.bar.axis.ParentDeserializerFactory"
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
>
> I wrote the (de)serializer classes and their respective factories based on
> examples from the book "AXIS: The Next Generation of Java SOAP," published
> by Wrox Press. The book's a little out-of-date already, so I had to update
> the method signatures slightly.
>
> Now when I run a test Axis client against an Axis server, the Parent data
> structure is serialized, sent and deserialized correctly, with zero, one or
> more children in the array. However, I'm not sure if the Axis client is
> truly using the custom deserializer and not BeanDeserializer.
>
> At 22:18 10.12.02 -0500, you wrote:
> >I would make T ... T3 into java beans (private members with
> >corresponding public getters and setters). If you can't do that, wrap
> >them with classes that are. Axis will have a hard time with your
> >classes becuase they are public instance variables.
> >
> >You could write your own serializers, but that would be lots of work.
> >
> >Very compelx things can genrally be done with ease if you stick with
> >these conventions.
> >
> >Ben Tomasini
> >
> >
> >
> >On Tue, 2002-12-10 at 22:17, Dongsheng Song wrote:
> > > I use a very complex type for soap, Please Help me modify my
> > deploy.wsdd file:
> > >
> > > <deployment xmlns="http://xml.apache.org/axis/wsdd/"
> > > xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
> > >
> > > <service name="EnterUp" provider="java:RPC">
> > >
> > > <parameter name="className" value="EnterUp"/>
> > > <parameter name="allowedMethods" value="*"/>
> > >
> > > <typeMapping
> > > xmlns:ns="http://soapinterop.org/xsd"
> > > qname="ns:T"
> > > type="java:T"
> > > serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
> > > deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
> > > encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> > > />
> > > </service>
> > >
> > > </deployment>
> > >
> > > public class EnterUp
> > > {
> > > public String register(T info)
> > > {
> > > }
> > > }
> > >
> > > public class T implements java.io.Serializable{
> > > public T2 fd;
> > > public T3[] fd2;
> > > }
> > >
> > > public class T2 implements java.io.Serializable{
> > > public String fd;
> > > public String fd2;
> > > }
> > >
> > > public class T3 implements java.io.Serializable{
> > > public String fd;
> > > public String fd2;
> > > }
> > >
> > > furthermore, is ther a java2wsdd tool ?
>
Re: help: Nesting arrays & structs
Posted by Mitch Gitman <mg...@usa.net>.
I have a similar requirement. I need a class that contains an array of
another class. Like Mr. Tomasini advised, I hid the member variable for the
array and instead used a public getter and setter. Here are the relevant
methods for the class, which I'll refer to here as Parent:
public Child[] getChildrenAsArray() {
____Collection all = getValuesHelper();
____return (Child[])all.toArray(new Child[all.size()]);
}
/** Dummy method used just for bean compliance */
public void setChildrenAsArray(Child[] ideasArray) { }
I was not able to make the regular bean (de)serializer work for the parent
class. So I resorted to using a custom (de)serializer. This is not to
generalize that the bean (de)serializer can't work; I've seen someone
else's web service work in this same circumstance. While I might as well
stick with what's working for me, I would be curious why the default does not.
Here's the error I always get with the bean (de)serializer:
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.io.IOException: java.lang.ClassCastException:
[Ljava.lang.Object;
faultActor: null
faultNode: null
faultDetail:
stackTrace: java.io.IOException: java.lang.ClassCastException:
[Ljava.lang.Object;
at
org.apache.axis.encoding.ser.BeanSerializer.serialize(BeanSerializer.java:261)
...
To turn on the custom serialization, I had go into deploy.wsdd (which is
used to generate server-config.wsdd) and manually change the typeMapping
element's (de)serializer attributes. Here's the changed element:
<typeMapping xmlns:ns="urn:bar.foo" qname="ns:Parent"
type="java:foo.bar.Parent"
serializer="foo.bar.axis.ParentSerializerFactory"
deserializer="foo.bar.axis.ParentDeserializerFactory"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
I wrote the (de)serializer classes and their respective factories based on
examples from the book "AXIS: The Next Generation of Java SOAP," published
by Wrox Press. The book's a little out-of-date already, so I had to update
the method signatures slightly.
Now when I run a test Axis client against an Axis server, the Parent data
structure is serialized, sent and deserialized correctly, with zero, one or
more children in the array. However, I'm not sure if the Axis client is
truly using the custom deserializer and not BeanDeserializer.
At 22:18 10.12.02 -0500, you wrote:
>I would make T ... T3 into java beans (private members with
>corresponding public getters and setters). If you can't do that, wrap
>them with classes that are. Axis will have a hard time with your
>classes becuase they are public instance variables.
>
>You could write your own serializers, but that would be lots of work.
>
>Very compelx things can genrally be done with ease if you stick with
>these conventions.
>
>Ben Tomasini
>
>
>
>On Tue, 2002-12-10 at 22:17, Dongsheng Song wrote:
> > I use a very complex type for soap, Please Help me modify my
> deploy.wsdd file:
> >
> > <deployment xmlns="http://xml.apache.org/axis/wsdd/"
> > xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
> >
> > <service name="EnterUp" provider="java:RPC">
> >
> > <parameter name="className" value="EnterUp"/>
> > <parameter name="allowedMethods" value="*"/>
> >
> > <typeMapping
> > xmlns:ns="http://soapinterop.org/xsd"
> > qname="ns:T"
> > type="java:T"
> > serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
> > deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
> > encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> > />
> > </service>
> >
> > </deployment>
> >
> > public class EnterUp
> > {
> > public String register(T info)
> > {
> > }
> > }
> >
> > public class T implements java.io.Serializable{
> > public T2 fd;
> > public T3[] fd2;
> > }
> >
> > public class T2 implements java.io.Serializable{
> > public String fd;
> > public String fd2;
> > }
> >
> > public class T3 implements java.io.Serializable{
> > public String fd;
> > public String fd2;
> > }
> >
> > furthermore, is ther a java2wsdd tool ?
Re: help: Nesting arrays & structs
Posted by Benjamin Tomasini <bt...@neteverything.com>.
I would make T ... T3 into java beans (private members with
corresponding public getters and setters). If you can't do that, wrap
them with classes that are. Axis will have a hard time with your
classes becuase they are public instance variables.
You could write your own serializers, but that would be lots of work.
Very compelx things can genrally be done with ease if you stick with
these conventions.
Ben Tomasini
On Tue, 2002-12-10 at 22:17, Dongsheng Song wrote:
> I use a very complex type for soap, Please Help me modify my deploy.wsdd file:
>
> <deployment xmlns="http://xml.apache.org/axis/wsdd/"
> xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
>
> <service name="EnterUp" provider="java:RPC">
>
> <parameter name="className" value="EnterUp"/>
> <parameter name="allowedMethods" value="*"/>
>
> <typeMapping
> xmlns:ns="http://soapinterop.org/xsd"
> qname="ns:T"
> type="java:T"
> serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
> deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> />
> </service>
>
> </deployment>
>
> public class EnterUp
> {
> public String register(T info)
> {
> }
> }
>
> public class T implements java.io.Serializable{
> public T2 fd;
> public T3[] fd2;
> }
>
> public class T2 implements java.io.Serializable{
> public String fd;
> public String fd2;
> }
>
> public class T3 implements java.io.Serializable{
> public String fd;
> public String fd2;
> }
>
> furthermore, is ther a java2wsdd tool ?
Re: client classloader confusion
Posted by Mitch Gitman <mg...@usa.net>.
Just for the heck of it, I tried running junit.swingui.TestRunner with the
-noloading argument. That worked, although I can't comprehend why,
considering that running the Axis client directly had been working anyway.
My concern with -noloading -- expressed in the thread commons-logging issue
(maybe JUnit-related) -- had been that, if I have JUnit run more than one
test case, the second and later cases will fail because they are generating
cumulative data on the Axis server based on preceding tests rather than
fresh data based only on the current test.
So I added to my web service interface a purge() operation to re-initialize
the server data structures in memory. Then my client calls purge at the
start of each test case. To reiterate, this hack is only necessary if you
are running a series of JUnit test cases, and each test case relies on
having an Axis web service in a just-initialized state.
At 22:01 10.12.02 -0800, you wrote:
>I'm testing a method in my web service: public Parent addParent(String data)
>A Parent object contains an array of Child objects, accessible through the
>Parent's: public Child[] getChildrenAsArray()
>
>When I run an Axis client directly and have it call my Axis server, this
>call works fine. But when I run an Axis client launched through JUnit, I
>get a weird, client-only error that the client can't convert a Child array
>to itself:
>
>Dec 10, 2002 7:16:16 PM org.apache.axis.encoding.ser.BeanPropertyTarget set
>SEVERE: Could not convert [Lfoo.bar.Child; to bean field
>'childrenAsArray', type [Lfoo.bar.Child;
>Dec 10, 2002 7:16:16 PM org.apache.axis.client.Call invoke
>SEVERE: Exception:
>java.lang.IllegalArgumentException: argument type mismatch
>________at
>org.apache.axis.encoding.ser.BeanPropertyTarget.set(BeanPropertyTarget.java:182)
>________at
>org.apache.axis.encoding.DeserializerImpl.valueComplete(DeserializerImpl.java:284)
>________at
>org.apache.axis.encoding.ser.ArrayDeserializer.valueComplete(ArrayDeserializer.java:533)
>________at
>org.apache.axis.encoding.DeserializerImpl.endElement(DeserializerImpl.java:541)
>________at
>org.apache.axis.encoding.DeserializationContextImpl.endElement(DeserializationContextImpl.java:961)
>________at
>org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:206)
>________at
>org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:693)
>________at
>org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:404)
>________at
>org.apache.axis.encoding.ser.BeanDeserializer.startElement(BeanDeserializer.java:167)
>________at
>org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:925)
>...
>
>I checked the SOAP request and response via TCPMon, and everything looked
>kosher.
>
>In my classpath for JUnit, I tried switching the order of:
>* the directory for the WSDL2Java-generated client classes and
>* the directory for the original server-side representations of these classes.
>Same error with both orders.
>
>One aside. I created a custom (de)serializer for the Parent class, because
>the standard bean (de)serializer was having trouble with the Child[]
>field. The above stack trace indicates that, on the client, the custom
>deserializer is not being used; the bean one is instead. However, that may
>also be true in the successful case of the Axis client being run directly.
client classloader confusion
Posted by Mitch Gitman <mg...@usa.net>.
I'm testing a method in my web service: public Parent addParent(String data)
A Parent object contains an array of Child objects, accessible through the
Parent's: public Child[] getChildrenAsArray()
When I run an Axis client directly and have it call my Axis server, this
call works fine. But when I run an Axis client launched through JUnit, I
get a weird, client-only error that the client can't convert a Child array
to itself:
Dec 10, 2002 7:16:16 PM org.apache.axis.encoding.ser.BeanPropertyTarget set
SEVERE: Could not convert [Lfoo.bar.Child; to bean field 'childrenAsArray',
type [Lfoo.bar.Child;
Dec 10, 2002 7:16:16 PM org.apache.axis.client.Call invoke
SEVERE: Exception:
java.lang.IllegalArgumentException: argument type mismatch
________at
org.apache.axis.encoding.ser.BeanPropertyTarget.set(BeanPropertyTarget.java:182)
________at
org.apache.axis.encoding.DeserializerImpl.valueComplete(DeserializerImpl.java:284)
________at
org.apache.axis.encoding.ser.ArrayDeserializer.valueComplete(ArrayDeserializer.java:533)
________at
org.apache.axis.encoding.DeserializerImpl.endElement(DeserializerImpl.java:541)
________at
org.apache.axis.encoding.DeserializationContextImpl.endElement(DeserializationContextImpl.java:961)
________at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:206)
________at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:693)
________at
org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:404)
________at
org.apache.axis.encoding.ser.BeanDeserializer.startElement(BeanDeserializer.java:167)
________at
org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:925)
...
I checked the SOAP request and response via TCPMon, and everything looked
kosher.
In my classpath for JUnit, I tried switching the order of:
* the directory for the WSDL2Java-generated client classes and
* the directory for the original server-side representations of these classes.
Same error with both orders.
One aside. I created a custom (de)serializer for the Parent class, because
the standard bean (de)serializer was having trouble with the Child[] field.
The above stack trace indicates that, on the client, the custom
deserializer is not being used; the bean one is instead. However, that may
also be true in the successful case of the Axis client being run directly.