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 ga...@jpmorgan.com on 2004/05/25 20:06:17 UTC

Interesting way of Using Collections in Axis Client


For using collections in Axis Client. This is what we did.

>From the WSDL created the Java files using the wsdl2Java etc.

In the Java generated Beans we changed the method signature to accept a
list instead of an array.

say we had the Bean Like

GENERATED CLASS

private NestedBean[]  arrayOfNestedBeans

public NestedBean[] getArrayOfNestedBeans(){
.......................
}
public void setArrayOfNestedBeans(NestedBean[] ){
.......................
}



we changed this to accept Collection.

private NestedBean[]  arrayOfNestedBeans;
private List proxyForArrayOfNestedNeans; //


public List  getArrayOfNestedBeans(){
      return proxyForArrayOfNestedNeans;
}
public void setArrayOfNestedBeans(List list ){
      .......................etc
}

and this seems to work very well WITHOUTany RUn Time Errors.

Earlier we thought we may have to maintian 2 internal variables for every
get or set as the Axis while de-serializing may be directly modifying the
variable but it looks like even if we comment out the variable
'arrayOfNestedBeans'  still it has no problem !!!!! and so led us to think
that it uses getters and setters to set the values from the SOAP Message
recieved and uses reflection to set check for the parameters and converts
it appropriately.

I donot if we are doing it the right way or this is a temporary hack and
will not work in the next rel of Axis ?

Thanks and Regards,

===
Gary Grewal




This communication is for informational purposes only.  It is not intended as
an offer or solicitation for the purchase or sale of any financial instrument
or as an official confirmation of any transaction. All market prices, data 
and other information are not warranted as to completeness or accuracy and 
are subject to change without notice. Any comments or statements made herein
do not necessarily reflect those of J.P. Morgan Chase & Co., its
subsidiaries and affiliates.