C:\SoapTest>perl perlMonk.pl 3519
Reference found where even-sized list expected at C:/Perl/site/lib/SOAP/WSDL.pm
line 235.
$VAR1 = 'NULL test';
####
use SOAP::WSDL;
use Data::Dumper;
use strict;
my $proxy = "http://localhost:" . $ARGV[0] . "/";
my $soap = SOAP::WSDL->new();
$soap->wsdl('http://localhost:8000/');
$soap->proxy($proxy);
#$soap->on_action(sub { return $_[0].$_[1]; }); $soap->wsdlinit(caching => 1);
my $som = $soap->SampleTest({ Name => 'Nathan', Age => 22});
if ($som->fault)
{
print "SampleTest Error: ".$som->faultstring."\n";
}
else
{
print Dumper($som->paramsall);
}
####
public string SampleTest(Tester test)
{
if (test == null)
{
return String.Format("NULL test");
}
else if (test.Age == 22)
{
return String.Format("SUCCESS test");
}
else
{
return String.Format("FAILURE test");
}
}
####
[DataContract]
public class Tester
{
private string name;
private int age;
public Tester(string n, int a)
{
name = n;
age = a;
}
[DataMember(IsRequired = true)]
public string Name
{
get
{
return name;
}
set
{
name = value;
}
}
[DataMember(IsRequired = true)]
public int Age
{
get
{
return age;
}
set
{
age = value;
}
}
}
####
public string HelloWorld(string name)
{
return String.Format("Hello {0}!!!", name);
}