[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webservices

Re: Using .NET Client To Pass ArrayList To Java WebService

Dino Chiesa [MSFT]

7/9/2003 3:15:00 AM


"Ashish" <asdd@hotmail.com> wrote in message
news:O$Hbp9mQDHA.704@tk2msftngp13.phx.gbl...
> Hi There,
> I am having a c# client that I want to use with a java webservice. Methods
> in the java service take an arraylist. Proxy classes that .net generated
> only contain definition of arraylist as an object. I am wondering how to I
> pass my data to the service. Has anyone of you faced a similar problem ?

yes.
solution: Don't use types that are platform specific (like java Arraylist or
Vector, or like .NET DataSet or ArrayList, etc).

On the Java side, do not expose the methods that accept an Arraylist. Or,
expose them, but don't call them from .NET. Instead, expose from java, and
call from .NET, a similar method that accepts not an arraylist but an array.

Rather than
public java.lang.String HandleMyArraylist(java.util.Arraylist alist) {
....
}

you should use
public java.lang.String HandleMyArray(MyType[] array) {
java.util.Arraylist alist= new java.util.Arraylist(array); // I
think this creates a new arraylist with the contents of the array
return HandleMyArraylist(alist);
}

Then from .NET , consume the HandleMyArray method.

cheers,

-Dino