import SOAP-WSDL 2.00_16 from CPAN
git-cpan-module: SOAP-WSDL git-cpan-version: 2.00_16 git-cpan-authorid: MKUTTER git-cpan-file: authors/id/M/MK/MKUTTER/SOAP-WSDL-2.00_16.tar.gz
This commit is contained in:
committed by
Michael G. Schwern
parent
2347a88353
commit
30be0da3dc
@@ -0,0 +1,4 @@
|
||||
use Test::More tests => 2;
|
||||
use lib '../lib';
|
||||
use_ok(qw/SOAP::WSDL/);
|
||||
ok( SOAP::WSDL->new(), 'Instantiated object' );
|
||||
@@ -0,0 +1,35 @@
|
||||
use Test::More tests => 7;
|
||||
use strict;
|
||||
use warnings;
|
||||
use diagnostics;
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
use Data::Dumper;
|
||||
use lib '../lib';
|
||||
|
||||
use_ok(qw/SOAP::WSDL/);
|
||||
|
||||
# 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{/SOAP/WSDL}{}xms;
|
||||
|
||||
#2
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file:///' . $path . '/acceptance/wsdl/' . $name . '.wsdl'
|
||||
), 'Instantiated object' );
|
||||
|
||||
ok( ($soap->servicename('testService') ), 'set service' );
|
||||
ok( ($soap->portname('testPort2') ) ,'set portname');
|
||||
ok( $soap->wsdlinit(), 'parsed WSDL' );
|
||||
|
||||
ok( $soap->wsdlinit( servicename => 'testService', portname => 'testPort'), 'parsed WSDL' );
|
||||
|
||||
ok( ($soap->portname() eq 'testPort' ), 'found port passed to wsdlinit');
|
||||
@@ -0,0 +1,87 @@
|
||||
use Test::More tests => 7;
|
||||
use strict;
|
||||
use warnings;
|
||||
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. ";
|
||||
}
|
||||
|
||||
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,
|
||||
), 'Instantiated object' );
|
||||
|
||||
|
||||
#3
|
||||
ok $soap->wsdlinit(
|
||||
checkoccurs => 1,
|
||||
servicename => 'testService',
|
||||
), 'parse WSDL';
|
||||
ok $soap->no_dispatch(1), 'set no dispatch';
|
||||
|
||||
# won't work without - would require SOAP::WSDL::Deserializer::SOM,
|
||||
# which requires SOAP::Lite
|
||||
$soap->outputxml(1);
|
||||
|
||||
ok ($xml = $soap->call('test',
|
||||
testAll => {
|
||||
Test1 => 'Test 1',
|
||||
Test2 => [ 'Test 2', 'Test 3' ]
|
||||
}
|
||||
), 'Serialized complexType' );
|
||||
|
||||
|
||||
# print $xml;
|
||||
|
||||
# $soap->wsdl_checkoccurs(1);
|
||||
|
||||
TODO: {
|
||||
local $TODO = "not implemented yet";
|
||||
|
||||
eval
|
||||
{
|
||||
$xml = $soap->call('test',
|
||||
testAll => {
|
||||
Test1 => 'Test 1',
|
||||
Test2 => [ 'Test 2', 'Test 3' ]
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
ok( ($@ =~m/illegal\snumber\sof\selements/),
|
||||
"Died on illegal number of elements (too many)"
|
||||
);
|
||||
|
||||
eval {
|
||||
$xml = $soap->call('test',
|
||||
testAll => {
|
||||
Test1 => 'Test 1',
|
||||
}
|
||||
);
|
||||
};
|
||||
ok($@, 'Died on illegal number of elements (not enough)');
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
use Test::More tests => 2;
|
||||
use lib '../lib';
|
||||
|
||||
use_ok qw/SOAP::WSDL/;
|
||||
|
||||
my $soap = SOAP::WSDL->new();
|
||||
|
||||
|
||||
TODO: {
|
||||
local $TODO="implement <choice> support";
|
||||
fail "serialize choice element";
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
use Test::More tests => 2;
|
||||
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 $soap = SOAP::WSDL->new();
|
||||
|
||||
|
||||
TODO: {
|
||||
local $TODO="implement <complexContent> support";
|
||||
fail "serialize complexContent element";
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
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' );
|
||||
|
||||
# won't work without - would require SOAP::WSDL::Deserializer::SOM,
|
||||
# which requires SOAP::Lite
|
||||
$soap->outputxml(1);
|
||||
|
||||
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';
|
||||
@@ -0,0 +1,22 @@
|
||||
use Test::More tests => 2;
|
||||
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 $soap = SOAP::WSDL->new();
|
||||
|
||||
|
||||
TODO: {
|
||||
local $TODO="implement <group> support";
|
||||
fail "serialize group element";
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
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. $@";
|
||||
}
|
||||
}
|
||||
|
||||
use_ok(qw/SOAP::WSDL/);
|
||||
|
||||
my $xml;
|
||||
|
||||
my $path = cwd();
|
||||
my $name = basename $0;
|
||||
$name =~s/\.t$//;
|
||||
|
||||
$path=~s{(/t)?/SOAP/WSDL}{}xms;
|
||||
|
||||
#2
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file://' . $path . '/t/acceptance/wsdl/' . $name . '.wsdl'
|
||||
), 'Instantiated object' );
|
||||
|
||||
#3
|
||||
ok( $soap->wsdlinit(
|
||||
checkoccurs => 1,
|
||||
servicename => 'testService',
|
||||
), 'parsed WSDL' );
|
||||
$soap->no_dispatch(1);
|
||||
|
||||
# won't work without - would require SOAP::WSDL::Deserializer::SOM,
|
||||
# which requires SOAP::Lite
|
||||
$soap->outputxml(1);
|
||||
|
||||
|
||||
#4
|
||||
ok $xml = $soap->call('test',
|
||||
testSequence => {
|
||||
Test1 => 'Test 1',
|
||||
Test2 => 'Test 2',
|
||||
}
|
||||
), 'Serialized complexType';
|
||||
|
||||
TODO: {
|
||||
local $TODO = "not implemented yet";
|
||||
#5
|
||||
eval
|
||||
{
|
||||
$xml = $soap->call('test',
|
||||
testSequence => {
|
||||
Test1 => 'Test 1',
|
||||
}
|
||||
);
|
||||
};
|
||||
ok( ($@),
|
||||
"Died on illegal number of elements"
|
||||
);
|
||||
|
||||
#6
|
||||
eval
|
||||
{
|
||||
$xml = $soap->call('test',
|
||||
testSequence => {
|
||||
Test1 => 'Test 1',
|
||||
Test2 => [ 1, 2, 3, ]
|
||||
}
|
||||
);
|
||||
};
|
||||
ok( ($@),
|
||||
"Died on illegal number of elements"
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
use Test::More tests => 2;
|
||||
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 $soap = SOAP::WSDL->new();
|
||||
|
||||
|
||||
TODO: {
|
||||
local $TODO="implement <simpleContent> support";
|
||||
fail "serialize simpleContent element";
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
use Test::More skip_all => 'TODO: implement tests';
|
||||
use lib '../lib';
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
use Test::More tests => 6;
|
||||
use strict;
|
||||
use warnings;
|
||||
use lib '../lib';
|
||||
use lib 't/lib';
|
||||
use lib 'lib';
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
|
||||
use_ok(qw/SOAP::WSDL/);
|
||||
|
||||
my $xml;
|
||||
|
||||
my $soap = undef;
|
||||
my $name = basename $0;
|
||||
$name =~s/\.(t|pl)$//;
|
||||
|
||||
my $path = cwd;
|
||||
|
||||
$path =~s{(/t)?/SOAP/WSDL}{}xms;
|
||||
|
||||
#2
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file:///' . $path . '/t/acceptance/wsdl/' . $name . '.wsdl'
|
||||
), 'Instantiated object' );
|
||||
|
||||
#3
|
||||
$soap->readable(1);
|
||||
|
||||
# won't work without - would require SOAP::WSDL::Deserializer::SOM,
|
||||
# which requires SOAP::Lite
|
||||
$soap->outputxml(1);
|
||||
|
||||
ok( $soap->wsdlinit(
|
||||
servicename => 'testService',
|
||||
), 'parsed WSDL' );
|
||||
$soap->no_dispatch(1);
|
||||
|
||||
ok ( $xml = $soap->call('test', testElement1 => 1 ) ,
|
||||
'Serialized (simpler) element' );
|
||||
|
||||
|
||||
TODO: {
|
||||
local $TODO="implement min/maxOccurs checks";
|
||||
|
||||
eval { $soap->call('test', testAll => [ 2, 3 ] ); };
|
||||
|
||||
like $@, qr{illegal\snumber\sof\selements}, "Died on illegal number of elements (too many)";
|
||||
|
||||
eval { $soap->call('test', testAll => undef ) };
|
||||
ok $@, 'Died on illegal number of elements (not enough)';
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
use Test::More tests => 8;
|
||||
use strict;
|
||||
use warnings;
|
||||
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 $soap;
|
||||
my $xml;
|
||||
my $path = cwd();
|
||||
my $name = basename $0;
|
||||
$name =~s/\.t$//;
|
||||
|
||||
$path =~s{(/t)?/SOAP/WSDL}{}xsm;
|
||||
|
||||
#2
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file://' . $path . '/t/acceptance/wsdl/' . $name . '.wsdl'
|
||||
), 'Instantiated object' );
|
||||
|
||||
#3
|
||||
$soap->readable(1);
|
||||
$soap->outputxml(1);
|
||||
|
||||
ok( $soap->wsdlinit(
|
||||
servicename => 'testService',
|
||||
), 'parsed WSDL' );
|
||||
$soap->no_dispatch(1);
|
||||
|
||||
ok ($xml = $soap->call('test',
|
||||
testElement1 => 'Test'
|
||||
), 'Serialized (simple) element' );
|
||||
|
||||
ok ($xml = $soap->call('testRef',
|
||||
testElementRef => 'Test'
|
||||
), 'Serialized (simple) element' );
|
||||
|
||||
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><testElementRef xmlns="urn:Test">Test</testElementRef>
|
||||
</SOAP-ENV:Body></SOAP-ENV:Envelope>}
|
||||
, 'element ref serialization result'
|
||||
;
|
||||
|
||||
TODO: {
|
||||
local $TODO="implement min/maxOccurs checks";
|
||||
|
||||
eval {
|
||||
$xml = $soap->call('test',
|
||||
testAll => [ 'Test 2', 'Test 3' ]
|
||||
);
|
||||
};
|
||||
|
||||
ok( ($@ =~m/illegal\snumber\sof\selements/),
|
||||
"Died on illegal number of elements (too many)"
|
||||
);
|
||||
|
||||
eval {
|
||||
$xml = $soap->call('test', testAll => undef );
|
||||
};
|
||||
ok($@, 'Died on illegal number of elements (not enough)');
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
use Test::More tests => 8;
|
||||
use strict;
|
||||
use lib '../lib';
|
||||
use lib 'lib';
|
||||
use lib 't/lib';
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
|
||||
use_ok(qw/SOAP::WSDL/);
|
||||
|
||||
my ($soap, $xml, $xml2);
|
||||
|
||||
# chdir to my location
|
||||
my $name = basename( $0 );
|
||||
$name =~s/\.(t|pl)$//;
|
||||
|
||||
my $path = cwd;
|
||||
$path =~s{(/t)/SOAP/WSDL}{}xms;
|
||||
|
||||
#2
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file:///' . $path . '/t/acceptance/wsdl/' . $name . '.wsdl'
|
||||
), 'Instantiated object' );
|
||||
|
||||
$soap->readable(1);
|
||||
# won't work without - would require SOAP::WSDL::Deserializer::SOM,
|
||||
# which requires SOAP::Lite
|
||||
$soap->outputxml(1);
|
||||
|
||||
#3
|
||||
ok( $soap->wsdlinit(
|
||||
servicename => 'testService',
|
||||
), 'parsed WSDL' );
|
||||
$soap->no_dispatch(1);
|
||||
|
||||
#4
|
||||
ok $xml = $soap->call('test', testAll => [ 1, 2 ] ), 'Serialize list call';
|
||||
|
||||
#5
|
||||
ok ( $xml2 = $soap->call('test', testAll => "1 2" ) , 'Serialized scalar call' );
|
||||
#6
|
||||
ok( $xml eq $xml2, 'Got expected result');
|
||||
|
||||
#7
|
||||
TODO: {
|
||||
local $TODO = "implement minLength check";
|
||||
eval { $xml = $soap->call('test', testAll => undef ) };
|
||||
ok($@, 'Died on illegal number of elements (not enough)');
|
||||
}
|
||||
|
||||
#8
|
||||
TODO: {
|
||||
local $TODO = "maxLength test not implemented";
|
||||
eval { $xml = $soap->call('test', testAll => [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 ] ) };
|
||||
ok($@, 'Died on illegal number of elements (more than maxLength)');
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
use Test::More tests => 8;
|
||||
use strict;
|
||||
use warnings;
|
||||
use diagnostics;
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
use lib '../lib';
|
||||
use lib 'lib';
|
||||
use lib 't/lib';
|
||||
|
||||
use_ok(qw/SOAP::WSDL/);
|
||||
|
||||
my $xml;
|
||||
|
||||
my $name = basename $0;
|
||||
$name =~s/\.(t|pl)$//;
|
||||
|
||||
my $path = cwd;
|
||||
$path =~s{(/t)/SOAP/WSDL}{}xms;
|
||||
|
||||
my $soap;
|
||||
#2
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file:///' . $path . '/t/acceptance/wsdl/' . $name . '.wsdl'
|
||||
), 'Instantiated object' );
|
||||
|
||||
#3
|
||||
$soap->readable(1);
|
||||
ok( $soap->wsdlinit(
|
||||
servicename => 'testService',
|
||||
), 'parsed WSDL' );
|
||||
$soap->no_dispatch(1);
|
||||
$soap->autotype(0);
|
||||
# won't work without - would require SOAP::WSDL::Deserializer::SOM,
|
||||
# which requires SOAP::Lite
|
||||
$soap->outputxml(1);
|
||||
|
||||
#4
|
||||
ok $xml = $soap->call('test', testAll => [ 1, 2 ] ) , 'Serialize list call';
|
||||
|
||||
# print $xml, "\n";
|
||||
|
||||
TODO: {
|
||||
local $TODO = "implement minLength/maxLength checks";
|
||||
eval { $soap->call('test', testAll => [ 1, 2, 3 ] ) };
|
||||
ok($@, 'Died on illegal number of elements (too many)');
|
||||
|
||||
eval { $soap->call('test', testAll => [] ) };
|
||||
ok($@, 'Died on illegal number of elements (not enough)');
|
||||
}
|
||||
|
||||
TODO: {
|
||||
local $TODO = "minValue check not implemented ";
|
||||
eval { $xml = $soap->call('test', testAll => 0 ) };
|
||||
ok($@, 'Died on illegal value');
|
||||
}
|
||||
|
||||
TODO: {
|
||||
local $TODO = "maxValue check not implemented ";
|
||||
eval { $xml = $soap->call('test', testAll => 100 ) };
|
||||
ok($@, 'Died on illegal value');
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
use Test::More skip_all => 'Not supported yet';
|
||||
use strict;
|
||||
use warnings;
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
|
||||
use lib '../lib';
|
||||
|
||||
use_ok qw/SOAP::WSDL/;
|
||||
|
||||
my $xml;
|
||||
my $soap = undef;
|
||||
my $name = basename( $0 );
|
||||
$name =~s/\.(t|pl)$//;
|
||||
|
||||
my $path = cwd;
|
||||
|
||||
$path =~s{(/t)?/SOAP/WSDL}{}xms;
|
||||
|
||||
#2
|
||||
ok $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file:///' . $path . '/t/acceptance/wsdl/' . $name . '.wsdl'
|
||||
), 'Instantiated object';
|
||||
|
||||
#3
|
||||
$soap->readable(1);
|
||||
ok $soap->wsdlinit(), 'parsed WSDL';
|
||||
$soap->no_dispatch(1);
|
||||
# won't work without - would require SOAP::WSDL::Deserializer::SOM,
|
||||
# which requires SOAP::Lite
|
||||
$soap->outputxml(1);
|
||||
|
||||
#4
|
||||
ok $xml = $soap->call('test', testAll => 1 ) , 'Serialized call';
|
||||
|
||||
# 6
|
||||
eval {
|
||||
$xml = $soap->serializer->method(
|
||||
$soap->call('test',
|
||||
testAll => [ 1 , 'union']
|
||||
)
|
||||
)
|
||||
};
|
||||
ok($@, 'Died on illegal number of elements (not enough)');
|
||||
|
||||
eval {
|
||||
$xml = $soap->serializer->method(
|
||||
$soap->call('test',
|
||||
testAll => undef
|
||||
)
|
||||
)
|
||||
};
|
||||
ok($@, 'Died on illegal number of elements (not enough)');
|
||||
|
||||
#8
|
||||
ok ( $xml = $soap->serializer->method( $soap->call('test2',
|
||||
testAll => 1 )
|
||||
),
|
||||
'Serialized (simple) call (list)' );
|
||||
|
||||
#9
|
||||
eval {
|
||||
$xml = $soap->serializer->method(
|
||||
$soap->call('test',
|
||||
testAll => [ 1 , 'union']
|
||||
)
|
||||
)
|
||||
};
|
||||
ok($@, 'Died on illegal number of elements (not enough)');
|
||||
@@ -0,0 +1,58 @@
|
||||
#!/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 '../../../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';
|
||||
|
||||
# won't work without - would require SOAP::WSDL::Deserializer::SOM,
|
||||
# which requires SOAP::Lite
|
||||
$soap->outputxml(1);
|
||||
|
||||
$soap->proxy('http://helloworld/helloworld.asmx');
|
||||
|
||||
ok $soap->wsdlinit(
|
||||
servicename => 'Service1',
|
||||
), 'wsdlinit';
|
||||
|
||||
|
||||
ok $soap->call('sayHello', 'sayHello' => $data), 'soap call';
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
use strict;
|
||||
use lib '../lib';
|
||||
use Test::More tests => 4;
|
||||
use SOAP::WSDL;
|
||||
use Cwd;
|
||||
use Data::Dumper;
|
||||
use File::Basename;
|
||||
|
||||
print "# Using SOAP::WSDL Version $SOAP::WSDL::VERSION\n";
|
||||
|
||||
my $name = '02_port';
|
||||
|
||||
# chdir to my location
|
||||
my $soap = undef;
|
||||
|
||||
my $path = cwd;
|
||||
|
||||
$path =~s{(/t)?/SOAP/WSDL}{}xms;
|
||||
|
||||
my $url = 'http://127.0.0.1/testPort';
|
||||
|
||||
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file:///' . $path . '/t/acceptance/wsdl/' . $name . '.wsdl'
|
||||
) );
|
||||
|
||||
ok $soap->wsdlinit( url => $url );
|
||||
ok $soap->servicename('testService');
|
||||
ok $soap->portname('testPort');
|
||||
@@ -0,0 +1,17 @@
|
||||
use Test::More qw(no_plan);
|
||||
use lib '../../../lib';
|
||||
use_ok qw(SOAP::WSDL::Deserializer::Hash);
|
||||
|
||||
ok my $deserializer = SOAP::WSDL::Deserializer::Hash->new();
|
||||
|
||||
ok my $data = $deserializer->deserialize(q{<a><b>1</b><b>2</b><c>3</c></a>});
|
||||
is $data->{a}->{b}->[0], 1;
|
||||
is $data->{a}->{b}->[1], 2;
|
||||
is $data->{a}->{c}, 3;
|
||||
|
||||
ok $data = $deserializer->deserialize(q{<a><b><c>1</c></b><b><c>2</c></b></a>});
|
||||
is $data->{a}->{b}->[0]->{c}, 1;
|
||||
is $data->{a}->{b}->[1]->{c}, 2;
|
||||
|
||||
eval { $deserializer->deserialize('grzlmpfh') };
|
||||
ok $@->isa('SOAP::WSDL::SOAP::Typelib::Fault11');
|
||||
@@ -0,0 +1,63 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More qw(no_plan);
|
||||
use Template;
|
||||
use File::Basename;
|
||||
use File::Spec;
|
||||
use SOAP::WSDL::Expat::WSDLParser;
|
||||
use SOAP::WSDL::Generator::Template::XSD;
|
||||
|
||||
my $path = dirname __FILE__;
|
||||
|
||||
my $parser = SOAP::WSDL::Expat::WSDLParser->new();
|
||||
|
||||
$parser->parse_file("$path/../../../acceptance/wsdl/006_sax_client.wsdl");
|
||||
#"$path/../../../../example/wsdl/globalweather.xml");
|
||||
my $definitions = $parser->get_data();
|
||||
|
||||
my $generator = SOAP::WSDL::Generator::Template::XSD->new({
|
||||
definitions => $definitions,
|
||||
});
|
||||
my $output = q{};
|
||||
$generator->generate_interface({
|
||||
NO_POD => 1,
|
||||
output => \$output,
|
||||
});
|
||||
|
||||
ok eval $output;
|
||||
|
||||
$output = q{};
|
||||
$generator->generate_typemap({
|
||||
NO_POD => 1,
|
||||
output => \$output,
|
||||
});
|
||||
|
||||
ok eval $output;
|
||||
print $@ if $@;
|
||||
|
||||
print $output;
|
||||
__END__
|
||||
|
||||
my $tt = Template->new(
|
||||
DEBUG => 1,
|
||||
EVAL_PERL => 1,
|
||||
RECURSION => 1,
|
||||
INCLUDE_PATH => "$path/../../../../lib/SOAP/WSDL/Template",
|
||||
);
|
||||
|
||||
foreach my $service (@{ $definitions->get_service }) {
|
||||
my $output;
|
||||
$tt->process( 'Interface.tt', {
|
||||
definitions => $definitions,
|
||||
service => $service,
|
||||
interface_prefix => 'MyInterface',
|
||||
type_prefix => 'MyTypes',
|
||||
TYPE_PREFIX => 'MyTypes',
|
||||
element_prefix => 'MyElement',
|
||||
}, \$output);
|
||||
die $tt->error if $tt->error();
|
||||
|
||||
ok eval $output, 'eval output';
|
||||
|
||||
print $output;
|
||||
};
|
||||
@@ -0,0 +1,144 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 5;
|
||||
use File::Basename;
|
||||
use File::Spec;
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
|
||||
use_ok qw(SOAP::WSDL::Generator::Visitor::Typemap);
|
||||
|
||||
my $visitor;
|
||||
ok $visitor = SOAP::WSDL::Generator::Visitor::Typemap->new(), 'constructor';
|
||||
|
||||
use SOAP::WSDL::Expat::WSDLParser;
|
||||
|
||||
my $parser = SOAP::WSDL::Expat::WSDLParser->new();
|
||||
|
||||
$parser->parse_file(
|
||||
$path . '/../../../../acceptance/wsdl/'
|
||||
#. '04_element.wsdl'
|
||||
#. '11_helloworld.wsdl'
|
||||
#. '008_complexType.wsdl'
|
||||
. '006_sax_client.wsdl'
|
||||
);
|
||||
|
||||
my $definitions = $parser->get_data();
|
||||
|
||||
$definitions->_accept( $visitor );
|
||||
|
||||
#use Data::Dumper;
|
||||
#print Dumper $visitor->get_typemap();
|
||||
|
||||
my $typemap = $visitor->get_typemap();
|
||||
is $typemap->{'EnqueueMessage/MMessage/MKeepalive'}, 'MyTypes::TKeepalive', 'content';
|
||||
is $typemap->{'EnqueueMessageResponse'}, 'MyTypes::TMessageID', 'content';
|
||||
is $typemap->{'KeepaliveMessageResponse'}, 'MyTypes::TMessageID', 'content';
|
||||
|
||||
|
||||
sub wsdl {
|
||||
q{<?xml version="1.0" encoding="UTF-8"?>
|
||||
<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
|
||||
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
|
||||
xmlns:s="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:s0="urn:HelloWorld"
|
||||
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
|
||||
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
|
||||
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
|
||||
targetNamespace="urn:HelloWorld"
|
||||
xmlns="http://schemas.xmlsoap.org/wsdl/">
|
||||
<types>
|
||||
<s:schema elementFormDefault="qualified"
|
||||
targetNamespace="urn:HelloWorld">
|
||||
<s:element name="sayHello">
|
||||
<s:complexType>
|
||||
<s:sequence>
|
||||
<s:element minOccurs="0" maxOccurs="1" name="name"
|
||||
type="s:string" />
|
||||
|
||||
<s:element minOccurs="0" maxOccurs="1" name="givenName"
|
||||
type="s:string" nillable="1"/>
|
||||
|
||||
<!-- <s:element minOccurs="0" maxOccurs="1" name="test"
|
||||
type="s0:test2" /> //-->
|
||||
</s:sequence>
|
||||
</s:complexType>
|
||||
</s:element>
|
||||
|
||||
<s:element name="sayHelloResponse">
|
||||
<s:complexType>
|
||||
<s:sequence>
|
||||
<s:element minOccurs="0" maxOccurs="1"
|
||||
name="sayHelloResult" type="s:string" />
|
||||
</s:sequence>
|
||||
</s:complexType>
|
||||
</s:element>
|
||||
|
||||
<s:complexType name="test2">
|
||||
<s:sequence>
|
||||
<s:element minOccurs="0" maxOccurs="1" name="name"
|
||||
type="s:string" />
|
||||
|
||||
<s:element minOccurs="0" maxOccurs="1" name="givenName"
|
||||
type="s:string" />
|
||||
</s:sequence>
|
||||
</s:complexType>
|
||||
|
||||
<s:complexType name="testExtended">
|
||||
<s:extension base="s0:test2">
|
||||
<s:sequence>
|
||||
<s:element minOccurs="0" maxOccurs="1" name="extend"
|
||||
type="s:string" />
|
||||
</s:sequence>
|
||||
</s:extension>
|
||||
</s:complexType>
|
||||
</s:schema>
|
||||
</types>
|
||||
|
||||
<message name="sayHelloSoapIn">
|
||||
<part name="parameters" element="s0:sayHello" />
|
||||
|
||||
<!-- <part name="test1" type="s0:testExtended" />
|
||||
|
||||
<part name="test2" type="s0:test2"
|
||||
targetNamespace="urn:test2" /> //-->
|
||||
</message>
|
||||
|
||||
<message name="sayHelloSoapOut">
|
||||
<part name="parameters" element="s0:sayHelloResponse" />
|
||||
</message>
|
||||
|
||||
<portType name="Service1Soap">
|
||||
<operation name="sayHello">
|
||||
<input message="s0:sayHelloSoapIn" />
|
||||
|
||||
<output message="s0:sayHelloSoapOut" />
|
||||
</operation>
|
||||
</portType>
|
||||
|
||||
<binding name="Service1Soap" type="s0:Service1Soap">
|
||||
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
|
||||
style="document" />
|
||||
|
||||
<operation name="sayHello">
|
||||
<soap:operation soapAction="urn:HelloWorld#sayHello"
|
||||
style="document" />
|
||||
|
||||
<input>
|
||||
<soap:body use="literal" />
|
||||
</input>
|
||||
|
||||
<output>
|
||||
<soap:body use="literal" />
|
||||
</output>
|
||||
</operation>
|
||||
</binding>
|
||||
|
||||
<service name="Service1">
|
||||
<port name="Service1Soap" binding="s0:Service1Soap">
|
||||
<soap:address
|
||||
location="http://helloworld/helloworld.asmx" />
|
||||
</port>
|
||||
</service>
|
||||
</definitions>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
use Test::More qw(no_plan);
|
||||
use File::Basename qw(dirname);
|
||||
use File::Spec;
|
||||
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
|
||||
use_ok qw(SOAP::WSDL::Generator::Visitor::Typelib);
|
||||
use_ok qw(SOAP::WSDL::Generator::Template::XSD);
|
||||
|
||||
use SOAP::WSDL::Expat::WSDLParser;
|
||||
|
||||
my $parser = SOAP::WSDL::Expat::WSDLParser->new();
|
||||
my $definitions = $parser->parse_file(
|
||||
"$path/../../../acceptance/wsdl/generator_test.wsdl"
|
||||
#"$path/../../../acceptance/wsdl/elementAtomicComplexType.xml"
|
||||
);
|
||||
|
||||
my $generator = SOAP::WSDL::Generator::Template::XSD->new({
|
||||
definitions => $definitions,
|
||||
});
|
||||
|
||||
my $code = "";
|
||||
$generator->set_output(\$code);
|
||||
$generator->generate_typelib();
|
||||
eval $code;
|
||||
ok !$@;
|
||||
print $@ if $@;
|
||||
#print $code;
|
||||
@@ -0,0 +1,24 @@
|
||||
use Test::More tests => 3;
|
||||
use File::Basename qw(dirname);
|
||||
use File::Spec;
|
||||
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
|
||||
use_ok qw(SOAP::WSDL::Generator::Visitor::Typelib);
|
||||
use_ok qw(SOAP::WSDL::Generator::Template::XSD);
|
||||
|
||||
use SOAP::WSDL::Expat::WSDLParser;
|
||||
|
||||
my $parser = SOAP::WSDL::Expat::WSDLParser->new();
|
||||
my $definitions = $parser->parse_file(
|
||||
"$path/../../../acceptance/wsdl/generator_unsupported_test.wsdl"
|
||||
);
|
||||
|
||||
my $generator = SOAP::WSDL::Generator::Template::XSD->new({
|
||||
definitions => $definitions,
|
||||
});
|
||||
|
||||
{
|
||||
eval { $generator->generate_typelib() };
|
||||
}
|
||||
ok $@;
|
||||
@@ -0,0 +1,47 @@
|
||||
use Test::More tests => 9;
|
||||
use strict;
|
||||
use warnings;
|
||||
use File::Basename;
|
||||
use SOAP::WSDL::Client;
|
||||
|
||||
my $soap;
|
||||
my $base_dir = dirname( __FILE__ );
|
||||
use_ok(qw/SOAP::WSDL::Transport::Test/);
|
||||
|
||||
$soap = SOAP::WSDL::Client->new();
|
||||
$soap->set_proxy('http://somewhere.over.the.rainbow');
|
||||
|
||||
ok( $soap->get_transport->set_base_dir( join '/', $base_dir, 'acceptance' ) );
|
||||
|
||||
{
|
||||
local $SIG{__WARN__} = sub {};
|
||||
my $response = $soap->call({ operation => 'test', soap_action => 'http://test' }, {});
|
||||
ok ! $response, 'Returned fault on error';
|
||||
is $response->get_faultcode(), 'soap:Server', 'faultcode';
|
||||
is $response->get_faultactor(), 'urn:localhost', 'faultactor';
|
||||
|
||||
$soap->outputxml(1);
|
||||
$response = $soap->call({ operation => 'test', soap_action => 'http://test2' }, {});
|
||||
is $response, 'test2', 'Returned file content';
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
eval { require SOAP::WSDL::Deserializer::SOM; }
|
||||
or skip 'SOAP::WSDL::Deserializer::SOM required', 3;
|
||||
# requre SOAP::WSDL::Factory::Deserializer;
|
||||
SOAP::WSDL::Factory::Deserializer->register('1.1', 'SOAP::WSDL::Deserializer::SOM');
|
||||
|
||||
my $soap_som = SOAP::WSDL::Client->new();
|
||||
$soap_som->set_proxy('http://somewhere.over.the.rainbow');
|
||||
$soap_som->get_transport->set_base_dir( join '/', $base_dir, 'acceptance' );
|
||||
|
||||
my $som;
|
||||
ok $som = $soap_som->call({ operation => 'test', soap_action => 'http://test3' }, {})
|
||||
, 'Call with SOAP::WSDL::Deserializer::SOM';
|
||||
|
||||
# In the somewhat weird logic of SOAP::Lite, the first node inside the root element
|
||||
# is the reault, all others are output parameters (and may be accessed via "paramsout")
|
||||
is $som->result(), 'Munich', 'Result match';
|
||||
is $som->paramsout(), 'Germany' , 'Output parameter match';
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
test2
|
||||
@@ -0,0 +1 @@
|
||||
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" ><SOAP-ENV:Body><GetWeatherResponse xmlns="http://www.webserviceX.NET"><CityName>Munich</CityName><CountryName>Germany</CountryName></GetWeatherResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
||||
@@ -0,0 +1,20 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More qw(no_plan);
|
||||
use Scalar::Util qw(blessed);
|
||||
use lib '../../../../../../lib';
|
||||
use_ok qw(SOAP::WSDL::XSD::Typelib::Builtin::anyType);
|
||||
|
||||
my $obj = SOAP::WSDL::XSD::Typelib::Builtin::anyType->new({
|
||||
xmlns => 'urn:Siemens.mosaic'
|
||||
});
|
||||
|
||||
ok blessed $obj, 'constructor returned blessed reference';
|
||||
|
||||
ok $obj->set_xmlns('urn:SOAP-WSDL'), 'set_xmlns';
|
||||
is $obj->get_xmlns(), 'urn:SOAP-WSDL', 'get_xmlns';
|
||||
|
||||
is $obj->start_tag({ name => 'test' }), '<test >', 'start_tag';
|
||||
is $obj->end_tag({ name => 'test' }), '</test >', 'end_tag';
|
||||
|
||||
is "$obj", q{}, 'serialize overloading';
|
||||
@@ -0,0 +1,44 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More qw(no_plan);
|
||||
use Scalar::Util qw(blessed);
|
||||
use lib '../../../../../../lib';
|
||||
use_ok qw(SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType);
|
||||
|
||||
my $obj = SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType->new({});
|
||||
|
||||
ok $obj->set_xmlns('urn:SOAP-WSDL'), 'set_xmlns';
|
||||
is $obj->get_xmlns(), 'urn:SOAP-WSDL', 'get_xmlns';
|
||||
|
||||
ok blessed $obj, 'constructor returned blessed reference';
|
||||
|
||||
is $obj->start_tag({ name => 'test' }), '<test >', 'start_tag';
|
||||
is $obj->end_tag({ name => 'test' }), '</test >', 'end_tag';
|
||||
|
||||
ok $obj->set_value('test'), 'set_value';
|
||||
is $obj->get_value(), 'test', 'get_value';
|
||||
|
||||
is "$obj", q{test}, 'serialize overloading';
|
||||
|
||||
ok ($obj)
|
||||
? pass 'boolean overloading'
|
||||
: fail 'boolean overloading';
|
||||
|
||||
ok ! $obj->set_value(undef), 'set_value with explicit undef';
|
||||
is $obj->get_value(), undef, 'get_value';
|
||||
|
||||
is "$obj", q{}, 'stringification overloading';
|
||||
|
||||
ok $obj = SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType->new({
|
||||
xmlns => 'urn:XSD',
|
||||
value => 'test2',
|
||||
});
|
||||
|
||||
is $obj->get_xmlns(), 'urn:XSD', 'get_xmlns on attr value';
|
||||
is $obj->get_value(), 'test2', 'get_value on attr value';
|
||||
|
||||
$obj->set_value(undef);
|
||||
|
||||
is $obj->serialize({ name => 'foo' }), '<foo ></foo >'
|
||||
, 'serialize undef value with name';
|
||||
is $obj->serialize(), q{}, 'serialize undef value without name'
|
||||
@@ -0,0 +1,74 @@
|
||||
use Test::More tests => 30;
|
||||
use strict;
|
||||
use Carp qw(cluck);
|
||||
|
||||
$SIG{__WARN__} = sub { cluck @_ };
|
||||
use warnings;
|
||||
use lib '../lib';
|
||||
use Date::Format;
|
||||
use Date::Parse;
|
||||
use_ok('SOAP::WSDL::XSD::Typelib::Builtin::date');
|
||||
my $obj;
|
||||
|
||||
sub timezone {
|
||||
my @time = map { defined $_ ? $_ : 0 } strptime shift;
|
||||
my $tz = strftime('%z', @time);
|
||||
substr $tz, -2, 0, ':';
|
||||
return $tz;
|
||||
}
|
||||
|
||||
my %dates = (
|
||||
'2007/12/31' => '2007-12-31',
|
||||
'2007:08:31' => '2007-08-31',
|
||||
'30 Aug 2007' => '2007-08-30',
|
||||
);
|
||||
|
||||
my %localized_date_of = (
|
||||
'2007-12-31T00:00:00.0000000+0000' => '2007-12-31+00:00',
|
||||
'2007-12-31T00:00:00.0000000+0130' => '2007-12-31+01:30',
|
||||
'2007-12-31T00:00:00.0000000+0200' => '2007-12-31+02:00',
|
||||
'2007-12-31T00:00:00.0000000+0300' => '2007-12-31+03:00',
|
||||
'2007-12-31T00:00:00.0000000+0400' => '2007-12-31+04:00',
|
||||
'2007-12-31T00:00:00.0000000+0500' => '2007-12-31+05:00',
|
||||
'2007-12-31T00:00:00.0000000+0600' => '2007-12-31+06:00',
|
||||
'2007-12-31T00:00:00.0000000+0700' => '2007-12-31+07:00',
|
||||
'2007-12-31T00:00:00.0000000+0800' => '2007-12-31+08:00',
|
||||
'2007-12-31T00:00:00.0000000+0900' => '2007-12-31+09:00',
|
||||
'2007-12-31T00:00:00.0000000+1000' => '2007-12-31+10:00',
|
||||
'2007-12-31T00:00:00.0000000+1100' => '2007-12-31+11:00',
|
||||
'2007-12-31T00:00:00.0000000+1200' => '2007-12-31+12:00',
|
||||
'2007-12-31T00:00:00.0000000-0100' => '2007-12-31-01:00',
|
||||
'2007-12-31T00:00:00.0000000-0200' => '2007-12-31-02:00',
|
||||
'2007-12-31T00:00:00.0000000-0300' => '2007-12-31-03:00',
|
||||
'2007-12-31T00:00:00.0000000-0400' => '2007-12-31-04:00',
|
||||
'2007-12-31T00:00:00.0000000-0500' => '2007-12-31-05:00',
|
||||
'2007-12-31T00:00:00.0000000-0600' => '2007-12-31-06:00',
|
||||
'2007-12-31T00:00:00.0000000-0700' => '2007-12-31-07:00',
|
||||
'2007-12-31T00:00:00.0000000-0800' => '2007-12-31-08:00',
|
||||
'2007-12-31T00:00:00.0000000-0900' => '2007-12-31-09:00',
|
||||
'2007-12-31T00:00:00.0000000-1000' => '2007-12-31-10:00',
|
||||
'2007-12-31T00:00:00.0000000-1100' => '2007-12-31-11:00',
|
||||
'2007-12-31T00:00:00.0000000-1200' => '2007-12-31-12:00',
|
||||
|
||||
|
||||
);
|
||||
|
||||
while (my ($date, $converted) = each %localized_date_of ) {
|
||||
|
||||
$obj = SOAP::WSDL::XSD::Typelib::Builtin::date->new();
|
||||
$obj->set_value( $date );
|
||||
|
||||
is $obj->get_value() , $converted , 'conversion';
|
||||
}
|
||||
|
||||
while (my ($date, $converted) = each %dates ) {
|
||||
|
||||
$obj = SOAP::WSDL::XSD::Typelib::Builtin::date->new();
|
||||
$obj->set_value( $date );
|
||||
|
||||
is $obj->get_value() , $converted . timezone($date), 'conversion';
|
||||
}
|
||||
|
||||
$obj->set_value( '2037-12-31+12:00' );
|
||||
is $obj->get_value() , '2037-12-31+12:00', 'no conversion on match';
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
use Test::More tests => 3;
|
||||
use strict;
|
||||
use warnings;
|
||||
use lib '../lib';
|
||||
|
||||
use_ok('SOAP::WSDL::XSD::Typelib::Builtin::time');
|
||||
my $obj;
|
||||
|
||||
$obj = SOAP::WSDL::XSD::Typelib::Builtin::time->new();
|
||||
|
||||
$obj->set_value( '12:23:03' );
|
||||
is $obj->get_value() , '12:23:03+01:00', 'conversion';
|
||||
|
||||
$obj->set_value( '12:23:03.12345+01:00' ), ;
|
||||
is $obj->get_value() , '12:23:03.12345+01:00', 'no conversion';
|
||||
|
||||
|
||||
|
||||
# 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') },
|
||||
#~ }
|
||||
@@ -0,0 +1,32 @@
|
||||
use Test::More tests => 4;
|
||||
use strict;
|
||||
use warnings;
|
||||
use lib '../lib';
|
||||
use Date::Parse;
|
||||
use Date::Format;
|
||||
|
||||
sub timezone {
|
||||
my @time = strptime shift;
|
||||
my $tz = strftime('%z', @time);
|
||||
substr $tz, -2, 0, ':';
|
||||
return $tz;
|
||||
}
|
||||
|
||||
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',
|
||||
'2007-08-31 00:32' => '2007-08-31T00:32:00',
|
||||
'30 Aug 2007' => '2007-08-30T00:00:00',
|
||||
);
|
||||
|
||||
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 with timezone';
|
||||
}
|
||||
$obj->set_value('2007-12-31T00:00:00.0000000+01:00');
|
||||
@@ -0,0 +1,19 @@
|
||||
use Test::More tests => 4;
|
||||
use strict;
|
||||
use warnings;
|
||||
use lib '../lib';
|
||||
|
||||
use_ok('SOAP::WSDL::XSD::Typelib::Builtin::string');
|
||||
my $obj;
|
||||
|
||||
$obj = SOAP::WSDL::XSD::Typelib::Builtin::string->new();
|
||||
|
||||
$obj->set_value( '& "Aber" <test>');
|
||||
is $obj->get_value() , '& "Aber" <test>';
|
||||
|
||||
is $obj, '& &qout;Aber&qout; <test>'
|
||||
, 'escape text on serialization';
|
||||
|
||||
is $obj->serialize({ name => 'test'})
|
||||
, '<test >& &qout;Aber&qout; <test></test >'
|
||||
, 'Serialization with name';
|
||||
Reference in New Issue
Block a user