import SOAP-WSDL 2.00_05 from CPAN

git-cpan-module:   SOAP-WSDL
git-cpan-version:  2.00_05
git-cpan-authorid: MKUTTER
git-cpan-file:     authors/id/M/MK/MKUTTER/SOAP-WSDL-2.00_05.tar.gz
This commit is contained in:
Martin Kutter
2009-12-12 19:47:43 -08:00
committed by Michael G. Schwern
parent 5c42b1d8f6
commit a78d6d15b5
32 changed files with 565 additions and 360 deletions
+1
View File
@@ -56,5 +56,6 @@ sub get_class {
'Fault/faultstring' => 'SOAP::WSDL::XSD::Typelib::Builtin::string',
'Fault/detail' => 'SOAP::WSDL::XSD::Typelib::Builtin::anyType',
);
return $class_list{ $_[1] };
}
+1 -1
View File
@@ -19,7 +19,7 @@ chdir $path;
$path = cwd;
$path =~s{/attic}{}xms;
$path =~s{/SOAP/WSDL}{}xms;
#2
ok( $soap = SOAP::WSDL->new(
@@ -1,4 +1,4 @@
use Test::More tests => 8;
use Test::More tests => 7;
use strict;
use warnings;
use lib '../lib';
@@ -15,11 +15,11 @@ if ($@)
}
my $path = cwd();
my $name = $0;
my $name = basename $0;
$name =~s/\.t$//;
$name =~s/^t\///;
$path =~s{/attic}{}xms;
$path =~s{(/t)?/SOAP/WSDL}{}xms;
use_ok(qw/SOAP::WSDL/);
@@ -30,30 +30,27 @@ my $soap;
#2
ok( $soap = SOAP::WSDL->new(
wsdl => 'file://' . $path . '/acceptance/wsdl/' . $name . '.wsdl',
wsdl => 'file://' . $path . '/t/acceptance/wsdl/' . $name . '.wsdl',
readable =>1,
), 'Instantiated object' );
#3
ok $soap->wsdlinit( checkoccurs => 1, ), 'parse WSDL';
ok $soap->wsdlinit(
checkoccurs => 1,
servicename => 'testService',
), 'parse WSDL';
ok $soap->no_dispatch(1), 'set no dispatch';
ok ($xml = $soap->call('test',
Test1 => 'Test 1',
Test2 => 'Test 2',
ok ($xml = $soap->call('test',
testAll => {
Test1 => 'Test 1',
Test2 => [ 'Test 2', 'Test 3' ]
}
), 'Serialized complexType' );
open (my $fh, $path . '/acceptance/results/' . $name . '.xml')
|| die "Cannot open acceptance results file";
my $testXML = <$fh>;
close $fh;
SKIP: {
skip( $SKIP, 1 ) if ($SKIP);
eval { soap_eq_or_diff( $xml, $testXML, 'Got expected result') };
};
# print $xml;
# $soap->wsdl_checkoccurs(1);
@@ -1,17 +1,15 @@
BEGIN
{
chdir 't/' if (-d 't/');
use Test::More tests => 7;;
use lib '../lib';
use lib 't/lib';
use lib 'lib';
use Cwd;
use File::Basename;
our $SKIP;
eval "use Test::SOAPMessage";
if ($@)
{
BEGIN {
use Test::More tests => 6;
use lib '../lib';
use lib 't/lib';
use lib 'lib';
use Cwd;
use File::Basename;
our $SKIP;
eval "use Test::SOAPMessage";
if ($@)
{
$SKIP = "Test::Differences required for testing. $@";
}
}
@@ -21,19 +19,20 @@ use_ok(qw/SOAP::WSDL/);
my $xml;
my $path = cwd();
my $name = $0;
my $name = basename $0;
$name =~s/\.t$//;
$path=~s{/attic}{}xms;
$path=~s{(/t)?/SOAP/WSDL}{}xms;
#2
ok( $soap = SOAP::WSDL->new(
wsdl => 'file://' . $path . '/acceptance/wsdl/' . $name . '.wsdl'
wsdl => 'file://' . $path . '/t/acceptance/wsdl/' . $name . '.wsdl'
), 'Instantiated object' );
#3
ok( $soap->wsdlinit(
checkoccurs => 1,
servicename => 'testService',
), 'parsed WSDL' );
$soap->no_dispatch(1);
$soap->serializer()->envprefix('SOAP-ENV');
@@ -48,17 +47,6 @@ ok $xml = $soap->call('test',
), 'Serialized complexType';
#5
open (my $fh, $path . '/acceptance/results/' . $name . '.xml')
|| die "Cannot open acceptance results file";
my $testXML = <$fh>;
close $fh;
SKIP:
{
skip( $SKIP, 1 ) if ($SKIP);
soap_eq_or_diff( $xml, $testXML, 'Got expected result');
}
#6
eval
{
$xml = $soap->serializer->method(
@@ -73,7 +61,7 @@ ok( ($@),
"Died on illegal number of elements"
);
#7
#6
eval
{
$xml = $soap->serializer->method(
@@ -1,40 +1,34 @@
use Test::More;
use Test::More tests => 6;
use strict;
use warnings;
plan qw/no_plan/;
use lib '../lib';
use lib 't/lib';
use lib 'lib';
use Cwd;
use File::Basename;
our $SKIP;
eval "use Test::SOAPMessage";
if ($@) {
$SKIP = "Test::Differences required for testing.";
}
use_ok(qw/SOAP::WSDL/);
my $xml;
my $soap = undef;
my $name = basename( $0 );
my $name = basename $0;
$name =~s/\.(t|pl)$//;
my $path = cwd;
$path =~s{/attic}{}xms;
$path =~s{(/t)?/SOAP/WSDL}{}xms;
#2
ok( $soap = SOAP::WSDL->new(
wsdl => 'file:///' . $path . '/acceptance/wsdl/' . $name . '.wsdl'
wsdl => 'file:///' . $path . '/t/acceptance/wsdl/' . $name . '.wsdl'
), 'Instantiated object' );
#3
$soap->readable(1);
ok( $soap->wsdlinit(), 'parsed WSDL' );
ok( $soap->wsdlinit(
servicename => 'testService',
), 'parsed WSDL' );
$soap->no_dispatch(1);
ok ( $xml = $soap->call('test', testElement1 => 1 ) ,
@@ -43,17 +37,6 @@ ok ( $xml = $soap->call('test', testElement1 => 1 ) ,
# print $xml, "\n";
open (my $fh, $path . '/acceptance/results/' . $name . '.xml')
|| die 'Cannot open acceptance file '
. $path . '/acceptance/results/' . $name . '.xml';
my $testXML = <$fh>;
close $fh;
SKIP: {
skip($SKIP, 1) if ($SKIP);
soap_eq_or_diff( $xml, $testXML, 'Got expected result');
}
TODO: {
local $TODO="implement min/maxOccurs checks";
@@ -1,4 +1,4 @@
use Test::More tests => 7;;
use Test::More tests => 6;
use strict;
use warnings;
use lib '../lib';
@@ -18,39 +18,27 @@ use_ok(qw/SOAP::WSDL/);
my $soap;
my $xml;
my $path = cwd();
my $name = $0;
my $name = basename $0;
$name =~s/\.t$//;
$path =~s{/attic}{}xsm;
$path =~s{(/t)?/SOAP/WSDL}{}xsm;
#2
ok( $soap = SOAP::WSDL->new(
wsdl => 'file://' . $path . '/acceptance/wsdl/' . $name . '.wsdl'
wsdl => 'file://' . $path . '/t/acceptance/wsdl/' . $name . '.wsdl'
), 'Instantiated object' );
#3
$soap->readable(1);
ok( $soap->wsdlinit(), 'parsed WSDL' );
ok( $soap->wsdlinit(
servicename => 'testService',
), 'parsed WSDL' );
$soap->no_dispatch(1);
ok ($xml = $soap->call('test',
testElement1 => 'Test'
), 'Serialized (simple) element' );
open (my $fh, $path . '/acceptance/results/' . $name . '.xml')
|| die "Cannot open acceptance results file";
my $testXML = <$fh>;
close $fh;
SKIP: {
if ($SKIP){
print $xml;
skip( $SKIP, 1 );
}
soap_eq_or_diff( $xml, $testXML, 'Got expected result');
};
TODO: {
local $TODO="implement min/maxOccurs checks";
@@ -15,24 +15,24 @@ my $name = basename( $0 );
$name =~s/\.(t|pl)$//;
my $path = cwd;
$path =~s{/attic}{}xms;
$path =~s{(/t)/SOAP/WSDL}{}xms;
#2
ok( $soap = SOAP::WSDL->new(
wsdl => 'file:///' . $path . '/acceptance/wsdl/' . $name . '.wsdl'
wsdl => 'file:///' . $path . '/t/acceptance/wsdl/' . $name . '.wsdl'
), 'Instantiated object' );
$soap->readable(1);
#3
ok( $soap->wsdlinit(), 'parsed WSDL' );
ok( $soap->wsdlinit(
servicename => 'testService',
), 'parsed WSDL' );
$soap->no_dispatch(1);
#4
ok $xml = $soap->call('test', testAll => [ 1, 2 ] ), 'Serialize list call';
print $xml, "\n";
#5
ok ( $xml2 = $soap->call('test', testAll => "1 2" ) , 'Serialized scalar call' );
#6
@@ -12,21 +12,23 @@ use_ok(qw/SOAP::WSDL/);
my $xml;
my $name = basename( $0 );
my $name = basename $0;
$name =~s/\.(t|pl)$//;
my $path = cwd;
$path =~s{/attic}{}xms;
$path =~s{(/t)/SOAP/WSDL}{}xms;
my $soap;
#2
ok( $soap = SOAP::WSDL->new(
wsdl => 'file:///' . $path . '/acceptance/wsdl/' . $name . '.wsdl'
wsdl => 'file:///' . $path . '/t/acceptance/wsdl/' . $name . '.wsdl'
), 'Instantiated object' );
#3
$soap->readable(1);
ok( $soap->wsdlinit(), 'parsed WSDL' );
ok( $soap->wsdlinit(
servicename => 'testService',
), 'parsed WSDL' );
$soap->no_dispatch(1);
$soap->autotype(0);
@@ -15,11 +15,11 @@ $name =~s/\.(t|pl)$//;
my $path = cwd;
$path =~s{/attic}{}xms;
$path =~s{(/t)?/SOAP/WSDL}{}xms;
#2
ok $soap = SOAP::WSDL->new(
wsdl => 'file:///' . $path . '/acceptance/wsdl/' . $name . '.wsdl'
wsdl => 'file:///' . $path . '/t/acceptance/wsdl/' . $name . '.wsdl'
), 'Instantiated object';
#3
@@ -30,18 +30,6 @@ $soap->no_dispatch(1);
#4
ok $xml = $soap->call('test', testAll => 1 ) , 'Serialized call';
print $xml, "\n";
SKIP: {
open (my $fh, $path . '/acceptance/results/' . $name . '.xml')
|| skip("Cannot open acceptance results file ". $name . '.xml', 1);
my $testXML = <$fh>;
close $fh;
is( $xml, $testXML, 'Got expected result');
}
# 6
eval {
$xml = $soap->serializer->method(
@@ -1,6 +1,6 @@
#!/usr/bin/perl -w
use strict;
use Test::More tests=> 6;
use Test::More tests=> 5;
use Time::HiRes qw( gettimeofday tv_interval );
use lib '../..';
use Data::Dumper;
@@ -9,24 +9,22 @@ use File::Basename;
use_ok qw/ SOAP::WSDL /;
use Benchmark;
# print "Testing SOAP::WSDL ". $SOAP::WSDL::VERSION."\n";
# print "Performance test with simple WSDL file\n";
print "# Testing SOAP::WSDL ". $SOAP::WSDL::VERSION."\n";
print "# Performance test with simple WSDL file\n";
my $soap;
my $data = {
sayHello => {
name => 'Mein Name',
givenName => 'Vorname'
givenName => 'Vorname',
}
};
# chdir to my location
my $cwd = cwd;
my $path = dirname( $0 );
my $soap = undef;
my $name = basename( $0 );
$name =~s/\.(t|pl)$//;
chdir $path;
$path = cwd;
my $path = cwd;
$path=~s{(/t)?/SOAP/WSDL}{}xms;
my $cacheDir;
if ($^O =~ m/Win/)
@@ -42,7 +40,7 @@ else
my $t0 = [gettimeofday];
ok(
$soap=SOAP::WSDL->new(
wsdl => "file://$path/acceptance/wsdl/10_helloworld.asmx.xml",
wsdl => "file://$path/t/acceptance/wsdl/10_helloworld.asmx.xml",
no_dispatch => 1
),
"Create SOAP::WSDL object (".tv_interval ( $t0, [gettimeofday]) ."ms)" );
@@ -51,8 +49,10 @@ $soap->proxy('http://helloworld/helloworld.asmx');
$t0 = [gettimeofday];
eval{
$soap->wsdlinit(caching => 1,
cache_directory => $cacheDir ) };
$soap->wsdlinit(
caching => 1,
cache_directory => $cacheDir,
servicename => 'Service1' ) };
unless ($@) {
pass("wsdl file init (".tv_interval ( $t0, [gettimeofday]) ."s)");
@@ -69,7 +69,7 @@ $t0 = [gettimeofday];
ok($soap->call(sayHello => %{ $data }),
"1 x call pre-work (".tv_interval ( $t0, [gettimeofday]) ."s)" );
timethis 500, sub { $soap->call(sayHello => %{ $data }) };
timethis 1000, sub { $soap->call(sayHello => %{ $data }) };
__END__
+56
View File
@@ -0,0 +1,56 @@
#!/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 Test::More tests => 4;
use lib '../..';
use Cwd;
use File::Basename;
use_ok q/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 => 'test',
};
my $soap = undef;
my $name = basename( $0 );
$name =~s/\.(t|pl)$//;
my $path = cwd;
$path =~s{(/t)?/SOAP/WSDL}{}xms;
ok $soap = SOAP::WSDL->new(
wsdl => 'file:///'.$path.'/t/acceptance/wsdl/11_helloworld.wsdl',
no_dispatch => 1
), 'Create SOAP::WSDL object';
$soap->serializer()->namespace('SOAP-ENV');
$soap->serializer()->encodingspace('SOAP-ENC');
$soap->proxy('http://helloworld/helloworld.asmx');
ok $soap->wsdlinit(
servicename => 'Service1',
), 'wsdlinit';
ok $soap->call('sayHello', 'sayHello' => $data), 'soap call';
@@ -1,36 +1,34 @@
use strict;
use lib '../lib';
use Test;
use Test::More tests => 4;
use SOAP::WSDL;
use Cwd;
use Data::Dumper;
plan tests => 9;
use File::Basename;
print "# Using SOAP::WSDL Version $SOAP::WSDL::VERSION\n";
my $name = '02_port';
# chdir to my location
my $cwd = cwd;
my $soap = undef;
my $path = cwd;
if (-d 't')
{
$cwd .= '/t';
}
$path =~s{(/t)?/SOAP/WSDL}{}xms;
my $url = 'http://127.0.0.1/testPort';
ok(1);
ok( $soap = SOAP::WSDL->new(
wsdl => 'file:///' . $cwd . '/acceptance/wsdl/' . $name . '.wsdl'
wsdl => 'file:///' . $path . '/t/acceptance/wsdl/' . $name . '.wsdl'
) );
ok( ($soap->servicename('testService') eq 'testService' ) );
ok( ($soap->portname('testPort') eq 'testPort' ) );
ok( $soap->wsdlinit( url => $url ) );
ok $soap->wsdlinit( url => $url );
ok $soap->servicename('testService');
ok $soap->portname('testPort');
__END__
@@ -0,0 +1,20 @@
use Test::More tests => 4;
use strict;
use warnings;
use diagnostics;
use lib '../lib';
use Benchmark;
use_ok('SOAP::WSDL::XSD::Typelib::Builtin::string');
my $obj;
ok $obj = SOAP::WSDL::XSD::Typelib::Builtin::string->new(
{ value => '& "Aber" <test>'})
, "Object creation";
is $obj, '&amp; &qout;Aber&qout; &lt;test&gt;'
, 'escape text on serialization';
is $obj->serialize({ name => 'test'})
, '<test >&amp; &qout;Aber&qout; &lt;test&gt;</test >'
, 'Serialization with name';
-107
View File
@@ -1,107 +0,0 @@
#!/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;
plan tests => 5;
use Time::HiRes qw( gettimeofday tv_interval );
use lib '../..';
use Cwd;
use File::Basename;
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 "Acceptance test against sample output with simple WSDL\n";
my $data = {
name => 'test',
givenName => 'test',
};
my $t0 = [gettimeofday];
# chdir to my location
my $cwd = cwd;
my $path = dirname( $0 );
my $soap = undef;
my $name = basename( $0 );
$name =~s/\.(t|pl)$//;
chdir $path;
$path = cwd;
$path =~s{/attic}{}xms;
ok( $soap=SOAP::WSDL->new(
wsdl => 'file:///'.$path.'/acceptance/wsdl/11_helloworld.wsdl',
no_dispatch => 1
) );
$soap->serializer()->namespace('SOAP-ENV');
$soap->serializer()->encodingspace('SOAP-ENC');
print "Create SOAP::WSDL object (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
$soap->proxy('http://helloworld/helloworld.asmx');
$t0 = [gettimeofday];
ok($soap->wsdlinit());
print "WSDL init (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
$t0 = [gettimeofday];
do {
my $xml = $soap->call('sayHello', 'sayHello' => %{ $data });
open (FILE, "../acceptance/results/11_helloworld.xml")
|| open (FILE, "t/acceptance/results/11_helloworld.xml") || die "can't open acceptance file";
my $xml_test=<FILE>;
close FILE;
$xml=~s/^.+\<([^\/]+?)\:Body\>//;
$xml=~s/\<\/$1\:Body\>.*//;
$xml_test=~s/^.+\<([^\/]+?)\:Body\>//;
$xml_test=~s/\<\/$1\:Body\>.*//;
if ( ($xml) && ($xml eq $xml_test) ) {
ok 1;
print "Message encoding (" .tv_interval ( $t0, [gettimeofday]) ."s)\n"
} else {
ok 0;
print "Message encoding (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
print "$xml\n$xml_test\n"; };
};
$t0 = [gettimeofday];
do {
my $xml = $soap->call(sayHello => %{ $data });
open (FILE, "../acceptance/results/11_helloworld.xml")
|| open FILE, ("t/acceptance/results/11_helloworld.xml") || die "can't open acceptance file";
my $xml_test=<FILE>;
close FILE;
$xml=~s/^.+\<([^\/]+?)\:Body\>//;
$xml=~s/\<\/$1\:Body\>.*//;
$xml_test=~s/^.+\<([^\/]+?)\:Body\>//;
$xml_test=~s/\<\/$1\:Body\>.*//;
if ( ($xml) && ($xml eq $xml_test) ) {
ok 1;
print "Message encoding (" .tv_interval ( $t0, [gettimeofday]) ."s)\n";
} else {
ok 0;
print "Message encoding (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
print "$xml\n$xml_test\n"; };
};
chdir $cwd;
-29
View File
@@ -1,29 +0,0 @@
use Test::More;
eval "use Test::Pod::Coverage 1.00";
plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD" if $@;
BEGIN
{
if (-d 't') # chdir into test directory if we
{ # are not there (make test)
chdir 't';
@dirs = '../blib/lib';
}
else
{
@dirs = ('../lib');
use lib '../lib'; # use our lib if we are in t/ (if we are, we're)
# not run from "make test" / "Build test"
}
}
@files = all_modules( @dirs );
plan tests => scalar @files;
foreach (@files)
{
s/^\.\.::blib::lib:://;
s/^\.\.::lib:://;
pod_coverage_ok( $_ );
}