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 an...@telenor.com on 2002/08/21 10:23:56 UTC

Arrays in Axis and .NET

I made an echo servic in .NET to test String[].

When I made a client in Axis (with WSDL2Java), a class called ArrayOfString was generated. I am not able to send and receive String[] directly to and from this .NET service, but must use toe ArrayOfString class, like this:

//Make and fill ann array
String[] arr = new String[3];
for (i = 0;i<3;i++)
	arr[i] = ("Cell"+i);

//Convert to ArrayOfString
ArrayOfString aos = new ArrayOfString();
aos.setString(arr);

//Call the service
ArrayOfString aos2 = new ArrayOfString();
aos2 = port.echoStringArray(aos);

//Convert back to array
String[] arr2 = new String[3];
arr2 = aos2.getString();

Is this how it is supposed to work? 

With other clients I can use String[] directly. Also when I call an echoStringArray service on Axis from .NET or other clients.

Thanks in advance for your answers!

/Anne Marie



Below is what I first tried to do:

/*

//This operation would not compile:

String[] arr = new String[3];
String[] arr2 = new String[3];
for (i = 0;i<3;i++)
	arr[i] = ("Cell"+i);
arr2 = port.echoStringArray(arr);

//Error message was: 
//Tester.java:25: echoStringArray(echostrings.ArrayOfString) in 
//echostrings.EchostringsSoap cannot be applied to (java.lang.String[])
//arr2 = port.echoStringArray(arr);
//           ^

*/