Title: soap lite pass string argument
Tags: web-services;perl;soap
Question: I have a problem passing a string argument using Perl. The following code
#!/usr/bin/perl -w
use SOAP75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0Lite;
my $service = SOAP75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0Lite-&gt;service('http://localhost:8080/greeting?wsdl');
print $service-&gt;greetClient('perl wooooo'), "\n";
Results in
Greeting null! Have a nice day...
A similar python code
from suds.client import Client
client = Client('http://localhost:8080/greeting?wsdl')
print client.service.greetClient('python wooooo')
works perfectly
Greeting python wooooo! Have a nice day...
I tried to set different encodings
print $service-&gt;encoding('utf-8')-&gt;greetClient("perl wooooo"), "\n";
with the same result.
A SOAP Monitor shows that there is no arg0 in a case of Perl
<greetClient xsi:nil="true"  xsi:type="tns:greetClient" /&gt;
which is present in a case of Python
<ns0:greetClient&gt;
<arg0&gt;python wooooo</arg0&gt;
</ns0:greetClient&gt;
What can be a problem?
Why it's so complicated to implement a SOAP client with Perl compared to Python?
SOLUTION
Finally the following solution is working
#!/usr/bin/perl -w
use strict;
use warnings;
use XML75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0ompil75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0SOAP11;
use XML75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0ompil75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0WSDL11;
use XML75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0ompil75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0Transport75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0SOAPHTTP;
my $soap = XML75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0ompil75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0WSDL11-&gt;new('c:/temp/greeting.wsdl');
my $call = $soap-&gt;compileClient('greetClient');
print $call-&gt;(arg0 =&gt; 'perl wooooo'){'greetClientResponse'}{'return'}, "\n";

Here is the accepted answer: SOAP75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0Lite can be infuriatingly bad. You might give XML75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0ompil75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0SOAP a try:
use strict;
use warnings;
use XML75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0ompil75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0SOAP11;
use XML75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0ompil75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0WSDL11;
use XML75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0ompil75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0Transport75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0SOAPHTTP;
my $soap = XML75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0ompil75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0WSDL11-&gt;new(
'http://localhost:8080/greeting?wsdl',
schema_dirs =&gt; [
'c:/soft/Perl/site/lib/XML/Compile/SOAP11/xsd'
'c:/soft/Perl/site/lib/XML/Compile/XOP/xsd'
'c:/soft/Perl/site/lib/XML/Compile/xsd'
$soap-&gt;compileCalls;
my ( $response, $trace ) = $soap-&gt;call( 'greetClient', arg0 =&gt; 'perl wooooo' );
$trace-&gt;printResponse;
$response will be the call response converted to a hashref via XML75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0Simple, which may be all you need. The $trace object is handy to see what the raw XML response looks like.
Comment for this answer: Oh, sorry, just taking the opportunity to vent about `SOAP75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0Lite`. Perhaps `SOAP75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0WSDL` isn't available for ActivePerl. Do you see `XML75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0ompil75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0SOAP`? I'll update my answer to use that if so.
Comment for this answer: See edit. You don't need to set that environment variable, and I'm not sure how often a semicolon-separated string is construed as a list in Perl or Python libraries.
Comment for this answer: Thanks for your answer. I'm not a Perl expert. I found the SOAP75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0WSDL here http://search.cpan.org/~mkutter/SOAP-WSDL-2.00.10/ . How can I install it? ppm does not show it in the list?
Comment for this answer: I'm working on Windows and perl Build.PL does not work because it looks for gcc and other stuff. Ideally I want to install a package as I did for SOAP:Lite with the ppm.
Comment for this answer: I got another error. Please take a look on my EDIT in the post
Comment for this answer: does this support mtom?

Here is another answer: Unfortunately, I can't see your WSDL.
But in regards to SOAP75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0Lite, I don't see you setting up neither a proxy (endpoint) nor an uri.
You're also probably going to have to change the on_action behavior as well. By default, SOAP75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0Lite wants to use the '#' concatenation.
So something along these lines might work.
$service-&gt;proxy( $uri_of_my_end_point );
$service-&gt;uri( $schema_namespace );
$service-&gt;on_action( sub {
my ( $uri, $method ) = @_;
my $slash = $uri =~ m{/$} ? '' : '/';
return qq{"$uri$slash$method"};

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 2, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2011:00:11/08/11', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<web-services><perl><soap>', 'Title': 'soap lite pass string argument', 'ViewCount': 1357, 'id': 8050979, 'user_AboutMe': '', 'user_AccountId': 23734.0, 'user_DisplayName': 'Oleg Pavliv', 'user_Reputation': 19724.0, 'user_Views': 1116.0, 'user_id': 59704.0}}