import SOAP-WSDL 1.24 from CPAN

git-cpan-module:   SOAP-WSDL
git-cpan-version:  1.24
git-cpan-authorid: MKUTTER
git-cpan-file:     authors/id/M/MK/MKUTTER/SOAP-WSDL-1.24.tar.gz
This commit is contained in:
Martin Kutter
2009-12-12 19:47:56 -08:00
committed by Michael G. Schwern
parent 7ba2f93e44
commit 9e85f63aa0
228 changed files with 2369 additions and 22762 deletions
-4
View File
@@ -1,4 +0,0 @@
use Test::More tests => 2;
use lib '../lib';
use_ok(qw/SOAP::WSDL/);
ok( SOAP::WSDL->new(), 'Instantiated object' );
-35
View File
@@ -1,35 +0,0 @@
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');
-87
View File
@@ -1,87 +0,0 @@
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)');
}
-12
View File
@@ -1,12 +0,0 @@
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";
}
@@ -1,22 +0,0 @@
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";
}
-47
View File
@@ -1,47 +0,0 @@
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';
-22
View File
@@ -1,22 +0,0 @@
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";
}
-80
View File
@@ -1,80 +0,0 @@
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"
);
};
@@ -1,22 +0,0 @@
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";
}
-4
View File
@@ -1,4 +0,0 @@
use Test::More skip_all => 'TODO: implement tests';
use lib '../lib';
-53
View File
@@ -1,53 +0,0 @@
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)';
}
-72
View File
@@ -1,72 +0,0 @@
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)');
}
-56
View File
@@ -1,56 +0,0 @@
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)');
}
-62
View File
@@ -1,62 +0,0 @@
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');
}
-69
View File
@@ -1,69 +0,0 @@
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)');
-58
View File
@@ -1,58 +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 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';
-29
View File
@@ -1,29 +0,0 @@
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');
-44
View File
@@ -1,44 +0,0 @@
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' ) );
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';
}
@@ -1 +0,0 @@
test2
@@ -1 +0,0 @@
<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>
@@ -1,20 +0,0 @@
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';
@@ -1,44 +0,0 @@
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'
@@ -1,74 +0,0 @@
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';
@@ -1,25 +0,0 @@
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') },
#~ }
@@ -1,32 +0,0 @@
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');
@@ -1,19 +0,0 @@
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, '&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';