import SOAP-WSDL 2.00_11 from CPAN
git-cpan-module: SOAP-WSDL git-cpan-version: 2.00_11 git-cpan-authorid: MKUTTER git-cpan-file: authors/id/M/MK/MKUTTER/SOAP-WSDL-2.00_11.tar.gz
This commit is contained in:
committed by
Michael G. Schwern
parent
7ba1959888
commit
c2da74b5ae
@@ -0,0 +1,43 @@
|
||||
use Test::More tests => 4;
|
||||
use strict;
|
||||
use warnings;
|
||||
use lib '../lib';
|
||||
use lib 't/lib';
|
||||
use lib 'lib';
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
|
||||
my $path = cwd();
|
||||
my $name = basename $0;
|
||||
$name =~s/\.t$//;
|
||||
$name =~s/^t\///;
|
||||
|
||||
$path =~s{(/t)?/SOAP/WSDL}{}xms;
|
||||
|
||||
use_ok(qw/SOAP::WSDL/);
|
||||
|
||||
print "# SOAP::WSDL Version: $SOAP::WSDL::VERSION\n";
|
||||
|
||||
my $xml;
|
||||
my $soap;
|
||||
|
||||
#2
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file://' . $path . '/t/acceptance/wsdl/' . $name . '.wsdl',
|
||||
readable => 1,
|
||||
no_dispatch => 1,
|
||||
), 'Instantiated object' );
|
||||
|
||||
ok ($xml = $soap->call('test',
|
||||
testAll => {
|
||||
Test2 => 'Test2',
|
||||
TestRef => 'TestRef'
|
||||
}
|
||||
), 'Serialized complexType' );
|
||||
|
||||
is $xml, q{<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" ><SOAP-ENV:Body><testAll>
|
||||
<TestRef>TestRef</TestRef>
|
||||
<Test2>Test2</Test2>
|
||||
</testAll>
|
||||
</SOAP-ENV:Body></SOAP-ENV:Envelope>}
|
||||
, 'element ref="" serialization';
|
||||
@@ -1,83 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
use Test::More tests=> 5;
|
||||
use Time::HiRes qw( gettimeofday tv_interval );
|
||||
use lib '../..';
|
||||
use Data::Dumper;
|
||||
use Cwd;
|
||||
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";
|
||||
my $soap;
|
||||
my $data = {
|
||||
sayHello => {
|
||||
name => 'Mein Name',
|
||||
givenName => 'Vorname',
|
||||
}
|
||||
};
|
||||
|
||||
my $name = basename( $0 );
|
||||
$name =~s/\.(t|pl)$//;
|
||||
|
||||
my $path = cwd;
|
||||
|
||||
$path=~s{(/t)?/SOAP/WSDL}{}xms;
|
||||
|
||||
my $cacheDir;
|
||||
if ($^O =~ m/Win/)
|
||||
{
|
||||
$cacheDir = 'C:/Temp/WSDL';
|
||||
}
|
||||
else
|
||||
{
|
||||
$cacheDir = '/tmp/';
|
||||
}
|
||||
|
||||
|
||||
my $t0 = [gettimeofday];
|
||||
ok(
|
||||
$soap=SOAP::WSDL->new(
|
||||
wsdl => "file://$path/t/acceptance/wsdl/10_helloworld.asmx.xml",
|
||||
no_dispatch => 1
|
||||
),
|
||||
"Create SOAP::WSDL object (".tv_interval ( $t0, [gettimeofday]) ."ms)" );
|
||||
|
||||
$soap->proxy('http://helloworld/helloworld.asmx');
|
||||
|
||||
$t0 = [gettimeofday];
|
||||
eval{
|
||||
$soap->wsdlinit(
|
||||
caching => 1,
|
||||
cache_directory => $cacheDir,
|
||||
servicename => 'Service1' ) };
|
||||
|
||||
unless ($@) {
|
||||
pass("wsdl file init (".tv_interval ( $t0, [gettimeofday]) ."s)");
|
||||
} else {
|
||||
fail( $@ );
|
||||
}
|
||||
$soap->readable(1);
|
||||
|
||||
$t0 = [gettimeofday];
|
||||
ok( $soap->call("sayHello" , %{ $data }),
|
||||
"1 x call pre-work (".tv_interval ( $t0, [gettimeofday]) ."s)") ;
|
||||
|
||||
$t0 = [gettimeofday];
|
||||
ok($soap->call(sayHello => %{ $data }),
|
||||
"1 x call pre-work (".tv_interval ( $t0, [gettimeofday]) ."s)" );
|
||||
|
||||
timethis 1000, sub { $soap->call(sayHello => %{ $data }) };
|
||||
|
||||
__END__
|
||||
|
||||
$t0 = [gettimeofday];
|
||||
for (my $i=1; $i<100; $i++)
|
||||
{
|
||||
$soap->call(sayHello => %{ $data });
|
||||
}
|
||||
ok(1, "100 x call pre-work (".tv_interval ( $t0, [gettimeofday]) ."s)");
|
||||
|
||||
chdir $cwd;
|
||||
@@ -13,6 +13,8 @@ sub timezone {
|
||||
}
|
||||
|
||||
use_ok('SOAP::WSDL::XSD::Typelib::Builtin::dateTime');
|
||||
|
||||
print "# timezone is " . timezone( scalar localtime(time) ) . "\n";
|
||||
my $obj;
|
||||
my %dates = (
|
||||
'2007-12-31 12:32' => '2007-12-31T12:32:00',
|
||||
@@ -25,14 +27,6 @@ while (my ($date, $converted) = each %dates ) {
|
||||
$obj = SOAP::WSDL::XSD::Typelib::Builtin::dateTime->new();
|
||||
$obj->set_value( $date );
|
||||
|
||||
is $obj->get_value() , $converted . timezone($date), 'conversion';
|
||||
is $obj->get_value() , $converted . timezone($date), 'conversion with timezone';
|
||||
}
|
||||
$obj->set_value('2007-12-31T00:00:00.0000000+01:00');
|
||||
|
||||
# exit;
|
||||
|
||||
#~ use Benchmark;
|
||||
#~ timethese 10000, {
|
||||
#~ xml => sub { $obj->set_value('2037-12-31T00:00:00.0000000+01:00') },
|
||||
#~ string => sub { $obj->set_value('2037-12-31') },
|
||||
#~ }
|
||||
Reference in New Issue
Block a user