import SOAP-WSDL 1.23 from CPAN

git-cpan-module:   SOAP-WSDL
git-cpan-version:  1.23
git-cpan-authorid: MKUTTER
git-cpan-file:     authors/id/M/MK/MKUTTER/SOAP-WSDL-1.23.tar.gz
This commit is contained in:
Martin Kutter
2007-06-05 11:52:26 -08:00
committed by Michael G. Schwern
parent 903b3e95e4
commit bfbf5e27e0
8 changed files with 2048 additions and 1886 deletions

View File

@@ -1,107 +1,107 @@
#!/usr/bin/perl -w
use strict;
use Test;
plan tests=> 11;
use Time::HiRes qw( gettimeofday tv_interval );
use lib '../lib';
use Data::Dumper;
use Cwd;
use SOAP::WSDL;
ok 1; # if we made it this far, we're ok
### test vars END
print "# Testing SOAP::WSDL ". $SOAP::WSDL::VERSION."\n";
print "# Performance test with WSDL file\n";
my $data = { name => 'Mein Name',
givenName => 'Vorname' };
my $dir = cwd;
# chomp /t/ to allow running the script from t/ directory
$dir=~s|/t/?||;
my $t0 = [gettimeofday];
{
ok( my $soap=SOAP::WSDL->new(
wsdl => "file://$dir/t/acceptance/helloworld.asmx.xml",
no_dispatch => 1
) );
print "# Test with NO caching\n";
print "# Create SOAP::WSDL object (".tv_interval ( $t0, [gettimeofday]) ."ms)\n" ;
$t0 = [gettimeofday];
eval{ $soap->wsdlinit(caching => 0) };
unless ($@) {
ok(1);
} else {
ok 0;
print STDERR $@;
}
print "# wsdl file init (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;;
$soap->readable(1);
$soap->wsdl_cache_store();
$soap->servicename("Service1");
$soap->portname("Service1Soap");
$t0 = [gettimeofday];
ok( $soap->call("sayHello" , %{ $data }));
print "# NO cache first call: (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
$t0 = [gettimeofday];
ok($soap->call(sayHello => %{ $data }) );
print "# NO cache second call (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
$t0 = [gettimeofday];
for (my $i=1; $i<100; $i++) {
$soap->call(sayHello => %{ $data });
}
ok(1);
print "# NO cache: 100 x call (".tv_interval ( $t0, [gettimeofday]) ."s)\n";
}
{
print "# Test with caching ENABLED\n";
$t0 = [gettimeofday];
ok(my $soap=SOAP::WSDL->new(
wsdl => "file://$dir/t/acceptance/helloworld.asmx.xml",
no_dispatch => 1
) );
print "# Create SOAP::WSDL object (".tv_interval ( $t0, [gettimeofday]) ."ms)\n" ;
-e "$dir/t/cache" or mkdir "$dir/t/cache";
$t0 = [gettimeofday];
eval{ $soap->wsdlinit(caching => 1,cache_directory =>"$dir/t/cache") };
unless ($@) {
ok(1);
} else {
ok 0;
print STDERR $@;
}
print "# wsdl file init (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;;
$soap->readable(1);
$soap->servicename("Service1");
$soap->portname("Service1Soap");
$t0 = [gettimeofday];
ok( $soap->call("sayHello" , %{ $data }));
print "# CACHE first call (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
$t0 = [gettimeofday];
ok($soap->call(sayHello => %{ $data }) );
print "# CACHE second call: (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
$t0 = [gettimeofday];
for (my $i=1; $i<100; $i++) {
$soap->call(sayHello => %{ $data });
}
ok(1);
print "# CACHE: 100 x call (".tv_interval ( $t0, [gettimeofday]) ."s)\n";
}
#!/usr/bin/perl -w
use strict;
use Test;
plan tests=> 11;
use Time::HiRes qw( gettimeofday tv_interval );
use lib '../lib';
use Data::Dumper;
use Cwd;
use SOAP::WSDL;
ok 1; # if we made it this far, we're ok
### test vars END
print "# Testing SOAP::WSDL ". $SOAP::WSDL::VERSION."\n";
print "# Performance test with WSDL file\n";
my $data = { name => 'Mein Name',
givenName => 'Vorname' };
my $dir = cwd;
# chomp /t/ to allow running the script from t/ directory
$dir=~s|/t/?||;
my $t0 = [gettimeofday];
{
ok( my $soap=SOAP::WSDL->new(
wsdl => "file://$dir/t/acceptance/helloworld.asmx.xml",
no_dispatch => 1
) );
print "# Test with NO caching\n";
print "# Create SOAP::WSDL object (".tv_interval ( $t0, [gettimeofday]) ."ms)\n" ;
$t0 = [gettimeofday];
eval{ $soap->wsdlinit(caching => 0) };
unless ($@) {
ok(1);
} else {
ok 0;
print STDERR $@;
}
print "# wsdl file init (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;;
$soap->readable(1);
$soap->wsdl_cache_store();
$soap->servicename("Service1");
$soap->portname("Service1Soap");
$t0 = [gettimeofday];
ok( $soap->call("sayHello" , %{ $data }));
print "# NO cache first call: (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
$t0 = [gettimeofday];
ok($soap->call(sayHello => %{ $data }) );
print "# NO cache second call (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
$t0 = [gettimeofday];
for (1..10) {
$soap->call(sayHello => %{ $data });
}
ok(1);
print "# NO cache: 10 x call (".tv_interval ( $t0, [gettimeofday]) ."s)\n";
}
{
print "# Test with caching ENABLED\n";
$t0 = [gettimeofday];
ok(my $soap=SOAP::WSDL->new(
wsdl => "file://$dir/t/acceptance/helloworld.asmx.xml",
no_dispatch => 1
) );
print "# Create SOAP::WSDL object (".tv_interval ( $t0, [gettimeofday]) ."ms)\n" ;
-e "$dir/t/cache" or mkdir "$dir/t/cache";
$t0 = [gettimeofday];
eval{ $soap->wsdlinit(caching => 1,cache_directory =>"$dir/t/cache") };
unless ($@) {
ok(1);
} else {
ok 0;
print STDERR $@;
}
print "# wsdl file init (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;;
$soap->readable(1);
$soap->servicename("Service1");
$soap->portname("Service1Soap");
$t0 = [gettimeofday];
ok( $soap->call("sayHello" , %{ $data }));
print "# CACHE first call (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
$t0 = [gettimeofday];
ok($soap->call(sayHello => %{ $data }) );
print "# CACHE second call: (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
$t0 = [gettimeofday];
for (1..10) {
$soap->call(sayHello => %{ $data });
}
ok(1);
print "# CACHE: 10 x call (".tv_interval ( $t0, [gettimeofday]) ."s)\n";
}

View File

@@ -1,112 +1,109 @@
#!/usr/bin/perl -w
use strict;
use Test;
plan tests=> 8;
use Time::HiRes qw( gettimeofday tv_interval );
use lib '../lib';
use Data::Dumper;
use Cwd;
use SOAP::WSDL;
ok 1; # if we made it this far, we're ok
### test vars END
print "# Testing SOAP::WSDL ". $SOAP::WSDL::VERSION."\n";
print "# Various Features Test with WSDL file \n";
my $data = {name => 'Mein Name',
givenName => 'Vorname'};
my $dir = cwd;
# chomp /t/ to allow running the script from t/ directory
$dir=~s|/t/?||;
my $t0 = [gettimeofday];
ok( my $soap=SOAP::WSDL->new(wsdl => "file://$dir/t/acceptance/helloworld.asmx.xml",
no_dispatch => 1
));
print "# Create SOAP::WSDL object (".tv_interval ( $t0, [gettimeofday]) ."ms)\n" ;
$t0 = [gettimeofday];
eval{ $soap->wsdlinit(caching => 0) };
unless ($@) {
ok(1);
} else {
ok 0;
print STDERR $@;
}
print "# wsdl file init (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;;
$soap->readable(1);
$soap->servicename("Service1");
$soap->portname("Service1Soap");
$t0 = [gettimeofday];
ok( $soap->call("sayHello" , %{ $data }));
print "# Normal Call: (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
$soap->servicename("Service2");
$soap->portname("Service2Soap");
$data = {name => 'Mein Name',
givenName => 'Vorname'};
$t0 = [gettimeofday];
ok($soap->call(sayGoodBye => %{ $data }) );
print "# Multiple Services/Port Call: (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
$soap->servicename("Service2");
$soap->portname("Service2Soap");
$data = {name => 'Mein Name',
givenName => 'Vorname',
wsdl_input_name => 'firstOverload'
};
$t0 = [gettimeofday];
my $xml = $soap->serializer->method( $soap->call(sayGoodByeOverload => %{ $data }) );
$xml =~ /<name/ and ok(1);
$data = {
name => 'Mein Name',
givenName => 'Vorname',
wsdl_input_name => 'secondOverload'
};
$t0 = [gettimeofday];
$xml = $soap->serializer->method( $soap->call(sayGoodByeOverload => %{ $data }) );
$xml !~ /<name/ and ok(1);
print "# Overloaded Calls: (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
$soap->servicename("Service2");
$soap->portname("Service2Soap");
$data = { name => 'Mein Name',
'recipients' => [
{user_name => 'Adam', last_name => "Eden"},
{user_name => 'Eve',last_name => 'Apple'},
],
wsdl_input_name => 'thirdOverload'
};
$t0 = [gettimeofday];
$xml = $soap->serializer->method( $soap->call(sayGoodByeOverload => %{ $data }) );
my $xpath = new XML::XPath->new(xml=>$xml);
my @recipients = $xpath->findnodes('//recipients');
if($recipients[0]->findvalue("user_name") eq "Adam" and
$recipients[0]->findvalue("last_name") eq "Eden" and
$recipients[1]->findvalue("user_name") eq "Eve" and
$recipients[1]->findvalue("last_name") eq "Apple"){
ok(1);
}else{
ok(0);
}
print "# Restricted Arrays: (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
print "#End\n";
#!/usr/bin/perl -w
use strict;
use warnings;
use diagnostics;
use Test::More tests=> 9;
use Time::HiRes qw( gettimeofday tv_interval );
use lib '../lib';
use Data::Dumper;
use Cwd;
use_ok qw/SOAP::WSDL/;
print "# Testing SOAP::WSDL ". $SOAP::WSDL::VERSION."\n";
print "# Various Features Test with WSDL file \n";
my $data = {name => 'Mein Name',
givenName => 'Vorname'};
my $dir = cwd;
# chomp /t/ to allow running the script from t/ directory
$dir=~s|/t/?||;
my $t0 = [gettimeofday];
ok( my $soap=SOAP::WSDL->new(wsdl => "file://$dir/t/acceptance/helloworld.asmx.xml",
no_dispatch => 1
));
print "# Create SOAP::WSDL object (".tv_interval ( $t0, [gettimeofday]) ."ms)\n" ;
$t0 = [gettimeofday];
eval{ $soap->wsdlinit(caching => 0) };
if ($@) {
fail("wsdlinit");
print STDERR $@;
} else {
pass("wsdlinit");
}
print "# wsdl file init (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;;
$soap->readable(1);
$soap->servicename("Service1");
$soap->portname("Service1Soap");
$t0 = [gettimeofday];
ok( $soap->call("sayHello" , %{ $data }), "call sayHello");
print "# Normal Call: (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
$soap->servicename("Service2");
is( $soap->portname("Service2Soap"), 'Service2Soap' );
$data = {name => 'Mein Name',
givenName => 'Vorname'};
$t0 = [gettimeofday];
ok($soap->call(sayGoodBye => %{ $data }), "Multiple Services/Port Call" );
print "# Multiple Services/Port Call: (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
$soap->servicename("Service2");
$soap->portname("Service2Soap");
$data = {name => 'Mein Name',
givenName => 'Vorname',
wsdl_input_name => 'firstOverload'
};
$t0 = [gettimeofday];
my $xml = $soap->serializer->method( $soap->call(sayGoodByeOverload => %{ $data }) );
like($xml , qr/<name/, 'serialized overloaded method');
$data = {
name => 'Mein Name',
givenName => 'Vorname',
wsdl_input_name => 'secondOverload'
};
$t0 = [gettimeofday];
$xml = $soap->serializer->method( $soap->call(sayGoodByeOverload => %{ $data }) );
unlike($xml , qr/<name/ , 'Overloaded calls');
print "# Overloaded Calls: (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
$soap->servicename("Service2");
$soap->portname("Service2Soap");
$data = { name => 'Mein Name',
'recipients' => [
{user_name => 'Adam', last_name => "Eden"},
{user_name => 'Eve',last_name => 'Apple'},
],
wsdl_input_name => 'thirdOverload'
};
$t0 = [gettimeofday];
$xml = $soap->serializer->method( $soap->call(sayGoodByeOverload => %{ $data }) );
my $xpath = new XML::XPath->new(xml=>$xml);
my @recipients = $xpath->findnodes('//recipients');
if($recipients[0]->findvalue("user_name") eq "Adam" and
$recipients[0]->findvalue("last_name") eq "Eden" and
$recipients[1]->findvalue("user_name") eq "Eve" and
$recipients[1]->findvalue("last_name") eq "Apple"){
ok(1);
}else{
ok(0);
}
print "# Restricted Arrays: (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
print "#End\n";

55
t/4_auto_set_port.t Normal file
View File

@@ -0,0 +1,55 @@
#!/usr/bin/perl -w
#######################################################################################
#
# 2_helloworld.t
#
# Acceptance test for message encoding, based on .NET wsdl and example code.
# SOAP::WSDL's encoding doesn't I<exactly> match the .NET example, because
# .NET doesn't always specify types (SOAP::WSDL does), and the namespace
# prefixes chosen are different (maybe the encoding style, too ? this would be a bug !)
#
########################################################################################
use strict;
use diagnostics;
use Test::More tests => 6;
use Time::HiRes qw( gettimeofday tv_interval );
use lib '../lib';
use Cwd;
use_ok qw/SOAP::WSDL/;
### test vars END
print "# Testing SOAP::WSDL ". $SOAP::WSDL::VERSION."\n";
print "# Acceptance test against sample output with simple WSDL\n";
my $data = {
name => 'test',
givenName => 'GIVENNAME',
test => {
name => 'TESTNAME',
givenName => 'GIVENNAME',
},
};
my $dir= cwd;
$dir=~s/\/t\/?//;
# print $dir;
my $url = $dir . '/t/acceptance/test.wsdl.xml';
die "no wsdl found" if (not -e $url);
ok( my $soap=SOAP::WSDL->new( wsdl => 'file:///'. $url ), "Create SOAP::WSDL object");
$soap->no_dispatch( 1 );
eval{ $soap->wsdlinit() };
unless ($@) {
pass "wsdlinit";
} else {
fail "wsdlinit - $@";
}
ok( $soap->call(sayHello => %{ $data }) , "SOAP call");
is( $soap->servicename() , 'Service1', "Auto-detected servicename");
is( $soap->portname() , 'Service1Soap', "Auto-detected portname");