473,386 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Perl client to AXIS2 with arrays

1
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):
Expand|Select|Wrap|Line Numbers
  1. package samples.myquickstart.service.pojo;
  2.  
  3. import java.util.HashMap;
  4. import java.util.Date;
  5. import java.lang.reflect.Array;
  6.  
  7. public class GetStuffService {
  8. ...
  9.     public double getDouble() {
  10.          return 100.00;
  11.     }
  12.     public int getInt() {
  13.          return 100;
  14.     }
  15.     public String getStringTest() {
  16.          return "test";
  17.     }
  18.  
  19.     public String getHello(String name) {
  20.          return "Hello,"+name;
  21.     }
  22.  
  23.     public String[] getArray () {
  24.         return string_array;
  25.     }
  26.  
  27.     // Does not work
  28.     public String[] setArray (String[] str_array) {
  29.         string_array = str_array;
  30.         return string_array;
  31.     }
  32.  
  33.     // Does not work, tried also without "toString"
  34.     public String setArray1 (Array str_array) {
  35.         //string_array1 = str_array;
  36.         //return string_array1;
  37.         return str_array.toString();
  38.     }
  39.  
  40.     // This works , but then I am limited to array of size 3
  41.     public String[] setArray2 (String str0, String str1, String str2) {
  42.         string_array[0] = str0;
  43.         string_array[1] = str1;
  44.         string_array[2] = str2;
  45.         return string_array;
  46.     }
  47.  
  48.  
  49. }
  50.  
Client (Perl with SOAP::Lite) :
Expand|Select|Wrap|Line Numbers
  1. use SOAP::Lite;
  2. use perl_axis_client;
  3.  
  4.  
  5. my $service = "GetStuffService";
  6. my $namespace = "http://myquickstart.samples/xsd";
  7. my $proxy = getAxisConnection($service,$namespace);
  8.  
  9. ...
  10. my $str = $proxy->getStringTest();  
  11. if (callSuccess($str)) {
  12.     print $str->result."\n";             
  13. }
  14.  
  15. my $int = $proxy->getInt();
  16. if (callSuccess($int)) {
  17.     print $int->result."\n";
  18. }
  19.  ...
  20. my @test_array = ("Testingx","withx","newx","xxx");
  21. my $hello = $proxy->setArray1(@test_array);
  22. if (callSuccess($hello)) {
  23.     print "Get array1:".$hello->result."\n";
  24.     @res = $hello->paramsout;
  25.     #print "Res array size:".$#res."\n";
  26.     print "Res array1:@res\n";
  27. }
  28.  
  29. @test_array = ("Testingy","withy","newy","yyy");
  30. my $hello = $proxy->setArray2(@test_array);
  31. if (callSuccess($hello)) {
  32.     print "Get array2:".$hello->result."\n";
  33.     @res = $hello->paramsout;
  34.     #print "Res array size:".$#res."\n";
  35.     print "Res array2:@res\n";
  36. }
  37.  
Thanks,
Rinat
Jan 14 '09 #1
1 3430
KevinADC
4,059 Expert 2GB
To me it looks like the problem is in the java(?) code. I don't know java, so I can only suggest you ask on a Java forum how to stringify your array properly.
Jan 14 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: John Smith | last post by:
Can someone point me to an example of how to implement and access the kind of object shown below? Most of the examples if found are an object that contains one other object. I need to create an...
0
by: Vsevolod (Simon) Ilyushchenko | last post by:
Hi, I have succesfully connected from a dotnet client on Windows to a Perl service and was able to send basic data types and arrays back to Windows. However, I tried sending a two-dimensional...
2
by: kelly | last post by:
Hi, I don't have a code to show you, what I need are references or algorithms so that I'm in a right track. By the way, thanks for introducing me the array or arrays. Now I can continue my...
6
by: Vinit | last post by:
Hi I am passing an arraylist to a c#/.net webmethod from a perl client using soap:lite. The trace shows the elements in the xml request. The arraylist input in the webmethod however does not...
1
by: zaheermabbas | last post by:
Hello All, I have been following the release documentation of axis, i wanted the axis2.war by building the sources, i have downloaded the source, and as it is specified in the doc to build the...
2
by: Paul BE | last post by:
Hi, Can someone point me to a C# sample which calls an Axis2 XML Web Service? Thanks !
1
by: popemonica | last post by:
Hi Everybody! I´m trying to use a webservice made with axis2 from VB6. I have severals methods in the service. One of them doesn´t recive parameters when I invoke it and the result of the calling...
1
by: dwilcoxen | last post by:
I am looking for an example of how to connect from a .Net Windows client to an Axis (Java) web service, and upload a binary file to it using SOAP with attachments, or MTOM, or whatever works. If...
0
by: Michael Janulaitis | last post by:
I created a simple hello world web service that works great with a .Net client, however; I am not able to access the service from a Java Axis2 client. I get the following error: The input...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.