Hi,
I set up an Axis POJO service and perl cient using SOAP::Lite.
I am able to receive all simple types of return values (String, int, etc.) and also arrays (String[] in the POJO service).
The trouble begins when I try to pass a perl array from the client to the server.
I am not able to receieve it as String[] , only as parameters to a method, which means I need to know the size of the array I am sending which may vary.
Some code ...
Server (AXIS2 POJO):
-
package samples.myquickstart.service.pojo;
-
-
import java.util.HashMap;
-
import java.util.Date;
-
import java.lang.reflect.Array;
-
-
public class GetStuffService {
-
...
-
public double getDouble() {
-
return 100.00;
-
}
-
public int getInt() {
-
return 100;
-
}
-
public String getStringTest() {
-
return "test";
-
}
-
-
public String getHello(String name) {
-
return "Hello,"+name;
-
}
-
-
public String[] getArray () {
-
return string_array;
-
}
-
-
// Does not work
-
public String[] setArray (String[] str_array) {
-
string_array = str_array;
-
return string_array;
-
}
-
-
// Does not work, tried also without "toString"
-
public String setArray1 (Array str_array) {
-
//string_array1 = str_array;
-
//return string_array1;
-
return str_array.toString();
-
}
-
-
// This works , but then I am limited to array of size 3
-
public String[] setArray2 (String str0, String str1, String str2) {
-
string_array[0] = str0;
-
string_array[1] = str1;
-
string_array[2] = str2;
-
return string_array;
-
}
-
-
-
}
-
Client (Perl with SOAP::Lite) :
-
use SOAP::Lite;
-
use perl_axis_client;
-
-
-
my $service = "GetStuffService";
-
my $namespace = "http://myquickstart.samples/xsd";
-
my $proxy = getAxisConnection($service,$namespace);
-
-
...
-
my $str = $proxy->getStringTest();
-
if (callSuccess($str)) {
-
print $str->result."\n";
-
}
-
-
my $int = $proxy->getInt();
-
if (callSuccess($int)) {
-
print $int->result."\n";
-
}
-
...
-
my @test_array = ("Testingx","withx","newx","xxx");
-
my $hello = $proxy->setArray1(@test_array);
-
if (callSuccess($hello)) {
-
print "Get array1:".$hello->result."\n";
-
@res = $hello->paramsout;
-
#print "Res array size:".$#res."\n";
-
print "Res array1:@res\n";
-
}
-
-
@test_array = ("Testingy","withy","newy","yyy");
-
my $hello = $proxy->setArray2(@test_array);
-
if (callSuccess($hello)) {
-
print "Get array2:".$hello->result."\n";
-
@res = $hello->paramsout;
-
#print "Res array size:".$#res."\n";
-
print "Res array2:@res\n";
-
}
-
Thanks,
Rinat