SOAP-WSDL-2.00.10/0000755000175000017500000000000011203370730012525 5ustar martinmartinSOAP-WSDL-2.00.10/benchmark/0000755000175000017500000000000011203370730014457 5ustar martinmartinSOAP-WSDL-2.00.10/benchmark/person.pl0000444000175000017500000001403311203370730016321 0ustar martinmartinuse lib '../lib'; use lib '../example/lib'; use lib '../../Class-Std-Fast/lib'; use lib '../../SOAP-Lite-0.71/lib'; use lib '../../SOAP-WSDL_XS/blib/lib'; use lib '../../SOAP-WSDL_XS/blib/arch'; use strict; use Benchmark qw(cmpthese); use XML::Compile::SOAP11; use XML::Compile::Transport::SOAPHTTP(); use XML::Compile::Util; use XML::Compile::WSDL11; use XML::Simple; use SOAP::Lite; use MyInterfaces::TestService::TestPort; #use SOAP::WSDL::Deserializer::XSD_XS; use SOAP::WSDL::Factory::Deserializer; # # register SOAP::WSDL's transport as default for SOAP::WSDL and SOAP::WSDL_XS # - they use SOAP::Lite's SOAP::Transport::* if available # use SOAP::WSDL::Transport::HTTP; use SOAP::WSDL::Factory::Transport; SOAP::WSDL::Factory::Transport->register('http', 'SOAP::WSDL::Transport::HTTP'); $XML::Simple::PREFERRED_PARSER = 'XML::Parser'; my $person = { PersonID => { # MyTypes::PersonID ID => 1, # int }, Salutation => 'Salutation0', # string Name => 'Name0', # string GivenName => 'Martin', # string DateOfBirth => '1970-01-01', # date HomeAddress => { # MyTypes::Address Street => 'Street 0', # string ZIP => '00000', # string City => 'City0', # string Country => 'Country0', # string PhoneNumber => '++499131123456', # PhoneNumber MobilePhoneNumber => '++49150123456', # PhoneNumber }, WorkAddress => { # MyTypes::Address Street => 'Somestreet 23', # string ZIP => '12345', # string City => 'SomeCity', # string Country => 'Germany', # string PhoneNumber => '++499131123456', # PhoneNumber MobilePhoneNumber => '++49150123456', # PhoneNumber }, Contracts => { # MyTypes::ArrayOfContract Contract => [ { # MyTypes::Contract ContractID => 100000, # long ContractName => 'SomeContract0', # string }, { # MyTypes::Contract ContractID => 100001, # long ContractName => 'SomeContract1', # string }, { # MyTypes::Contract ContractID => 100002, # long ContractName => 'SomeContract2', # string }, { # MyTypes::Contract ContractID => 100003, # long ContractName => 'SomeContract3', # string }, ], }, } ; # # compile XML::Compile client with the options suggested by Mark Overmeer # for maximum speedup # my $compile = XML::Compile::WSDL11->new('../example/wsdl/Person.wsdl', sloppy_integers => 1, check_values => 0, validation => 0, ignore_facets => 1, ); # # Call all variants once to allow their first-time tasks to be done # my $call = $compile->compileClient('ListPerson'); $call->({ in => undef}); # Initialize SOAP::WSDL interface my $soap = MyInterfaces::TestService::TestPort->new(); # Load all classes - XML::Compile has created everything before, too $soap->ListPerson({}); my $lite = SOAP::Lite->new()->default_ns('http://www.example.org/benchmark/') ->proxy('http://localhost:81/soap-wsdl-test/person.pl'); $lite->on_action( sub { 'http://www.example.org/benchmark/ListPerson' } ); $lite->ListPerson(); my $lite_xml = SOAP::Lite->new()->default_ns('http://www.example.org/benchmark/') ->proxy('http://localhost:81/soap-wsdl-test/person.pl'); $lite_xml->on_action( sub { 'http://www.example.org/benchmark/ListPerson' } ); $lite_xml->outputxml(1); $lite_xml->ListPerson(); # # register for SOAP 1.1 #SOAP::WSDL::Factory::Deserializer->register('1.1' => 'SOAP::WSDL::Deserializer::XSD_XS' ); #my $wsdl_xs = MyInterfaces::TestService::TestPort->new(); my $count = 70; my @data = (); my $n = 0; print "Benchmark conducted with SOAP::Lite - $SOAP::Lite::VERSION SOAP::WSDL - $SOAP::WSDL::Client::VERSION SOAP::WSDL_XS - $SOAP::WSDL::Deserializer::XSD_XS::VERSION; XML::Compile::SOAP - $XML::Compile::SOAP::VERSION XML::Simple - $XML::Simple::VERSION XML::Simple uses XML::Parser as backend and SOAP::Lite with outputxml(1) set as SOAP client. XML::Parser - $XML::Parser::VERSION XML::Simple is not benchmarked in run 3ff, as it is expected do deliver the same result. Benchmark $n: Store result in private variable and destroy it "; $n++; cmpthese $count, { 'SOAP::Lite' => sub { my $som = $lite->call('ListPerson') }, 'SOAP::WSDL' => sub { my $result = $soap->ListPerson({}) }, # 'SOAP::WSDL_XS' => sub { my $result = $wsdl_xs->ListPerson({}) }, 'XML::Compile' => sub { my $result = $call->() }, 'XML::Simple' => sub { my $result = XMLin( $lite_xml->call('ListPerson')) }, }; print "\nBenchmark $n: Push result on list\n"; $n++; cmpthese $count, { 'SOAP::Lite' => sub { push @data, $lite->call('ListPerson') }, 'SOAP::WSDL' => sub { push @data, $soap->ListPerson({}) }, # 'SOAP::WSDL_XS' => sub { push @data, $wsdl_xs->ListPerson({}) }, 'XML::Compile' => sub { push @data, $call->() }, 'XML::Simple' => sub { push @data, XMLin( $lite_xml->call('ListPerson')) }, }; @data = (); print "\nBenchmark $n: Play it, please play it again, Sam\n"; $n++; cmpthese $count, { 'SOAP::WSDL' => sub { push @data, $soap->ListPerson({}) }, # 'SOAP::WSDL_XS' => sub { push @data, $wsdl_xs->ListPerson({}) }, # 'XML::Compile' => sub { push @data, $call->() }, # 'SOAP::Lite' => sub { push @data, $lite->call('ListPerson') }, }; print "\nBenchmark $n: ca. 1kB request - result destroyed immediately\n"; $n++; cmpthese $count, { 'SOAP::WSDL' => sub { my $result = $soap->ListPerson({ in => $person }) }, # 'SOAP::WSDL_XS' => sub { my $result = $wsdl_xs->ListPerson({ in => $person }) }, 'XML::Compile' => sub { my $result = $call->({ in => $person }) }, }; print "\nBenchmark $n: ca. 1kB request - push result on list\n"; $n++; cmpthese $count, { 'SOAP::WSDL' => sub { push @data, $soap->ListPerson({ in => $person }) }, # 'SOAP::WSDL_XS' => sub { push @data, $wsdl_xs->ListPerson({ in => $person }) }, 'XML::Compile' => sub { push @data, $call->({ in => $person }) }, }; SOAP-WSDL-2.00.10/benchmark/XSD/0000755000175000017500000000000011203370730015115 5ustar martinmartinSOAP-WSDL-2.00.10/benchmark/XSD/01_anyType.t0000444000175000017500000000041411203370730017230 0ustar martinmartinuse strict; use warnings; use Benchmark; use lib '../../lib'; use SOAP::WSDL::XSD::Typelib::Builtin::anyType; my $obj = SOAP::WSDL::XSD::Typelib::Builtin::anyType->new(); timethese 10000, { 'new' => sub { SOAP::WSDL::XSD::Typelib::Builtin::anyType->new() }, }; SOAP-WSDL-2.00.10/benchmark/XSD/strftime.pl0000444000175000017500000000176011203370730017311 0ustar martinmartinuse Benchmark qw(cmpthese timethis timethese); use POSIX (); use Date::Format (); my @time_from = localtime; #use lib '../../lib'; use SOAP::WSDL::XSD::Typelib::Builtin::dateTime; my $date = SOAP::WSDL::XSD::Typelib::Builtin::dateTime->new(); timethese 10000, { 'sprintf' => sub { $date->set_value('Dec 24 2004 CET'); } }; __END__ print "Comparing POSIX::strftime and Date::Format::strftime '%Y-%m-%dT%H:%M:%S%z'\n\n"; print 'POSIX: ', POSIX::strftime('%Y-%m-%dT%H:%M:%S%z', @time_from), "\n"; print 'Date::Format: ', Date::Format::strftime('%Y-%m-%dT%H:%M:%S%z', @time_from), "\n"; cmpthese 100000, { POSIX => sub { POSIX::strftime('%Y-%m-%dT%H:%M:%S%z', @time_from) }, 'Date::Format' => sub { Date::Format::strftime('%Y-%m-%dT%H:%M:%S%z', @time_from) }, }; __END__ results with perl-5.8.8 on Ubuntu 8.04 on a Thinkpad T42 (1.7GHz Dothan): Rate Date::Format POSIX Date::Format 10684/s -- -93% POSIX 153846/s 1340% -- SOAP-WSDL-2.00.10/benchmark/XSD/03_string.t0000444000175000017500000000416511203370730017116 0ustar martinmartinuse strict; use warnings; use Benchmark; use lib '../../lib'; use lib '../../../Class-Std-Fast/lib'; use SOAP::WSDL::XSD::Typelib::Builtin::string; my $obj = SOAP::WSDL::XSD::Typelib::Builtin::string->new(); timethese 20000, { 'new' => sub { SOAP::WSDL::XSD::Typelib::Builtin::string->new() }, 'new + params' => sub { SOAP::WSDL::XSD::Typelib::Builtin::string->new({ value => 'Teststring', }) }, }; $obj->set_value('Foobar'); timethese 20000, { serialize => sub { $obj->serialize() } }; my $data; timethese 1000000, { 'set_FOO' => sub { $obj->set_value('Test') }, 'get_FOO' => sub { $data = $obj->get_value() }, }; __END__ Benchmark: timing 20000 iterations of new, new + params... new: 1 wallclock secs ( 0.41 usr + 0.00 sys = 0.41 CPU) @ 48780.49/s (n=20000) new + params: 1 wallclock secs ( 0.53 usr + 0.01 sys = 0.54 CPU) @ 37037.04/s (n=20000) Benchmark: timing 1000000 iterations of get_FOO, set_FOO... get_FOO: 2 wallclock secs ( 1.43 usr + 0.01 sys = 1.44 CPU) @ 694444.44/s (n=1000000) set_FOO: 0 wallclock secs ( 1.43 usr + 0.01 sys = 1.44 CPU) @ 694444.44/s (n=1000000) ::Fast --- Benchmark: timing 20000 iterations of new, new + params... new: 0 wallclock secs ( 0.44 usr + 0.01 sys = 0.45 CPU) @ 44444.44/s (n=20000) new + params: 1 wallclock secs ( 0.55 usr + 0.00 sys = 0.55 CPU) @ 36363.64/s (n=20000) Benchmark: timing 1000000 iterations of get_FOO, set_FOO... get_FOO: 0 wallclock secs ( 0.81 usr + 0.00 sys = 0.81 CPU) @ 1234567.90/s (n=1000000) set_FOO: 2 wallclock secs ( 0.87 usr + 0.01 sys = 0.88 CPU) @ 1136363.64/s (n=1000000) ::Fast with inlined ID Benchmark: timing 20000 iterations of new, new + params... new: 0 wallclock secs ( 0.41 usr + 0.00 sys = 0.41 CPU) @ 48780.49/s (n=20000) new + params: 1 wallclock secs ( 0.52 usr + 0.00 sys = 0.52 CPU) @ 38461.54/s (n=20000) Benchmark: timing 1000000 iterations of get_FOO, set_FOO... get_FOO: 2 wallclock secs ( 0.80 usr + 0.00 sys = 0.80 CPU) @ 1250000.00/s (n=1000000) set_FOO: 2 wallclock secs ( 0.89 usr + -0.01 sys = 0.88 CPU) @ 1136363.64/s (n=1000000)SOAP-WSDL-2.00.10/benchmark/XSD/02_anySimpleType.t0000444000175000017500000000526411203370730020413 0ustar martinmartinuse strict; use warnings; use Benchmark; use lib '../../lib'; use lib '../../../Class-Std-Fast/lib'; use SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType; my $obj = SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType->new(); timethese 10000, { 'new' => sub { SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType->new() }, 'new + params' => sub { SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType->new({ value => 'Teststring', }) }, 'set_FOO' => sub { $obj->set_value('Test') }, }; my $data; timethese 1000000, { 'set_FOO' => sub { $obj->set_value('Test') }, 'get_FOO' => sub { $data = $obj->get_value() }, }; __END__ Benchmark: timing 10000 iterations of new, new + params, set_FOO... new: 0 wallclock secs ( 0.83 usr + 0.00 sys = 0.83 CPU) @ 12048.19/s (n=10000) new + params: 1 wallclock secs ( 0.58 usr + 0.00 sys = 0.58 CPU) @ 17241.38/s (n=10000) set_FOO: 0 wallclock secs ( 0.01 usr + 0.00 sys = 0.01 CPU) @ 1000000.00/s (n=10000) (warning: too few iterations for a reliable count) Benchmark: timing 1000000 iterations of get_FOO, set_FOO... get_FOO: 1 wallclock secs ( 1.79 usr + 0.01 sys = 1.80 CPU) @ 555555.56/s (n=1000000) set_FOO: 2 wallclock secs ( 1.44 usr + 0.03 sys = 1.47 CPU) @ 680272.11/s (n=1000000) ## Fast: Benchmark: timing 10000 iterations of new, new + params, set_FOO... new: 1 wallclock secs ( 0.67 usr + 0.01 sys = 0.68 CPU) @ 14705.88/s (n=10000) new + params: 1 wallclock secs ( 0.54 usr + 0.00 sys = 0.54 CPU) @ 18518.52/s (n=10000) set_FOO: 0 wallclock secs ( 0.01 usr + 0.00 sys = 0.01 CPU) @ 1000000.00/s (n=10000) (warning: too few iterations for a reliable count) Benchmark: timing 1000000 iterations of get_FOO, set_FOO... get_FOO: 2 wallclock secs ( 1.11 usr + 0.00 sys = 1.11 CPU) @ 900900.90/s (n=1000000) set_FOO: 2 wallclock secs ( 0.80 usr + 0.00 sys = 0.80 CPU) @ 1250000.00/s (n=1000000) ## Fast qw(2); Benchmark: timing 10000 iterations of new, new + params, set_FOO... new: 1 wallclock secs ( 0.17 usr + 0.00 sys = 0.17 CPU) @ 58823.53/s (n=10000) (warning: too few iterations for a reliable count) new + params: 0 wallclock secs ( 0.19 usr + 0.00 sys = 0.19 CPU) @ 52631.58/s (n=10000) (warning: too few iterations for a reliable count) set_FOO: 0 wallclock secs ( 0.01 usr + 0.00 sys = 0.01 CPU) @ 1000000.00/s (n=10000) (warning: too few iterations for a reliable count) Benchmark: timing 1000000 iterations of get_FOO, set_FOO... get_FOO: 1 wallclock secs ( 1.12 usr + 0.00 sys = 1.12 CPU) @ 892857.14/s (n=1000000) set_FOO: 0 wallclock secs ( 0.80 usr + 0.01 sys = 0.81 CPU) @ 1234567.90/s (n=1000000) SOAP-WSDL-2.00.10/benchmark/MEMORY_FOOTPRINT0000444000175000017500000000633511203370730017063 0ustar martinmartinMemory footprints for example/ scripts comparing SOAP::WSDL, SOAP::Lite and XML::Compile::SOAP Results with perl-5.8.8 on Ubuntu 8.04 (x86): PID %CPU %MEM VSZ RSS COMMAND 10183 12.0 1.1 14292 11492 perl -I../lib hello.pl 10554 7.2 0.9 12636 9828 perl hello_lite.pl 10224 17.5 1.6 20780 17012 perl hello_compile.pl 10287 25.0 1.1 14680 11776 perl -I../lib person.pl 10313 24.0 1.6 21068 17312 perl person_compile.pl Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=linux, osvers=2.6.15.7, archname=i486-linux-gnu-thread-multi uname='linux palmer 2.6.15.7 #1 smp thu sep 7 19:42:20 utc 2006 i686 gnulinux ' config_args='-Dusethreads -Duselargefiles -Dccflags=-DDEBIAN -Dcccdlflags=-fPIC -Darchname=i486-linux-gnu -Dprefix=/usr -Dprivlib=/usr/share/perl/5.8 -Darchlib=/usr/lib/perl/5.8 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.8.8 -Dsitearch=/usr/local/lib/perl/5.8.8 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Dsiteman3dir=/usr/local/man/man3 -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Ud_ualarm -Uusesfio -Uusenm -Duseshrplib -Dlibperl=libperl.so.5.8.8 -Dd_dosuid -des' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN -fno-strict-aliasing -pipe -I/usr/local/include' ccversion='', gccversion='4.2.3 20071123 (prerelease) (Ubuntu 4.2.2-3ubuntu4)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lgdbm -lgdbm_compat -ldb -ldl -lm -lpthread -lc -lcrypt perllibs=-ldl -lm -lpthread -lc -lcrypt libc=/lib/libc-2.6.1.so, so=so, useshrplib=true, libperl=libperl.so.5.8.8 gnulibc_version='2.6.1' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP THREADS_HAVE_PIDS USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API Built under linux Compiled at Nov 27 2007 10:44:36 @INC: /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl . SOAP-WSDL-2.00.10/benchmark/person.xml0000444000175000017500000003075511203370730016517 0ustar martinmartin 1 Salutation0 Name0 Martin 1970-01-01 Street 0 00000 City0 Country0 ++499131123456 ++49150123456 Somestreet 23 12345 SomeCity Germany ++499131123456 ++49150123456 100000 SomeContract0 100001 SomeContract1 100002 SomeContract2 100003 SomeContract3 2 Salutation2 Name2 Martin2 1970-01-02 Street 2 00002 City2 Country2 ++4900000002 ++491700000002 Somestreet 2 222222 SomeCity2 Germany ++4920000002 ++4920000002 100002 SomeContract2 100021 SomeContract21 100022 SomeContract22 1000023 SomeContract23 3 Salutation3 Name3 Martin3 1970-01-03 Street 3 00003 City3 Country3 ++4900000003 ++491700000003 Somestreet 3 333333 SomeCity3 Germany ++4930000003 ++4930000003 100003 SomeContract3 100031 SomeContract31 100033 SomeContract33 1000033 SomeContract33 4 Salutation4 Name4 Martin4 1970-01-04 Street 4 00004 City4 Country4 ++4900000004 ++491700000004 Somestreet 4 444444 SomeCity4 Germany ++4940000004 ++4940000004 100004 SomeContract4 100041 SomeContract41 100044 SomeContract44 1000044 SomeContract44 5 Salutation5 Name5 Martin5 1970-01-05 Street 5 00005 City5 Country5 ++4900000005 ++491700000005 Somestreet 5 555555 SomeCity5 Germany ++4950000005 ++4950000005 100005 SomeContract5 100051 SomeContract51 100055 SomeContract55 1000053 SomeContract53 6 Salutation6 Name6 Martin6 1970-01-06 Street 6 00006 City6 Country6 ++4900000006 ++491700000006 Somestreet 6 666666 SomeCity6 Germany ++4960000006 ++4960000006 100006 SomeContract6 100061 SomeContract61 100066 SomeContract66 1000063 SomeContract63 7 Salutation7 Name7 Martin7 1970-01-07 Street 7 00007 City7 Country7 ++4900000007 ++491700000007 Somestreet 7 777777 SomeCity7 Germany ++4970000007 ++4970000007 100007 SomeContract7 100071 SomeContract71 100077 SomeContract77 1000073 SomeContract73 8 Salutation8 Name8 Martin8 1970-01-08 Street 8 00008 City8 Country8 ++4900000008 ++491700000008 Somestreet 8 888888 SomeCity8 Germany ++4980000008 ++4980000008 100008 SomeContract8 100081 SomeContract81 100088 SomeContract88 1000083 SomeContract83 9 Salutation9 Name9 Martin9 1970-01-09 Street 9 00009 City9 Country9 ++4900000009 ++491700000009 Somestreet 9 999999 SomeCity9 Germany ++4990000009 ++4990000009 100009 SomeContract9 100091 SomeContract91 100099 SomeContract99 1000093 SomeContract93 10 Salutation10 Name10 Martin10 1970-01-010 Street 10 000010 City10 Country10 ++49000000010 ++4917000000010 Somestreet 10 101010101010 SomeCity10 Germany ++491000000010 ++491000000010 1000010 SomeContract10 1000101 SomeContract101 10001010 SomeContract1010 10000103 SomeContract103 SOAP-WSDL-2.00.10/benchmark/person_profile.pl0000444000175000017500000000111511203370730020036 0ustar martinmartinuse lib '../lib'; use lib '../example/lib'; use lib '../../SOAP-WSDL_XS/blib/lib'; use lib '../../SOAP-WSDL_XS/blib/arch'; use strict; # use Benchmark; use SOAP::WSDL::Deserializer::XSD_XS; use SOAP::WSDL::Factory::Deserializer; # # register for SOAP 1.1 SOAP::WSDL::Factory::Deserializer->register('1.1' => 'SOAP::WSDL::Deserializer::XSD_XS' ); use MyInterfaces::TestService::TestPort; my $soap = MyInterfaces::TestService::TestPort->new(); # Load all classes - XML::Compile has created everything before, too if (@ARGV) { print $soap->ListPerson({}) } else { $soap->ListPerson({}) } SOAP-WSDL-2.00.10/benchmark/01_expat.t0000444000175000017500000001367011203370730016272 0ustar martinmartin#!/usr/bin/perl -w use strict; use warnings; use lib '../lib'; use lib '../../Class-Std-Fast/lib'; use lib '/home/martin/workspace/SOAP-WSDL_XS/blib/lib'; use lib '/home/martin/workspace/SOAP-WSDL_XS/blib/arch'; use lib '../t/lib'; # use SOAP::WSDL::SAX::MessageHandler; use Benchmark qw(cmpthese timethese); use SOAP::WSDL::Expat::MessageParser; use SOAP::WSDL::Expat::Message2Hash; use SOAP::WSDL::Expat::MessageParser_XS; use SOAP::Lite; use XML::Simple; use XML::LibXML; use MyComplexType; use MyElement; use MySimpleType; my $xml = q{ Test2 Test3 Test4 Test5 Test6 Test7 Test8 Test9 Test10 Test11 Test12 Test13 Test55 Test14 Test15 Test16 Test17 Test18 Test19 Test20 Test21 Test22 Test23 Test24 Test25 Test565 Test27 Test28 Test29 Test30 Test31 Test32 Test33 Test34 Test35 Test36 Test37 Test38 Test55 }; my $parser = SOAP::WSDL::Expat::MessageParser->new({ class_resolver => 'FakeResolver' }); my $hash_parser = SOAP::WSDL::Expat::Message2Hash->new(); $XML::Simple::PREFERRED_PARSER = 'XML::Parser'; print "xml length: ${ \length $xml } bytes\n"; my $libxml = XML::LibXML->new(); $libxml->keep_blanks(0); my @data; my $deserializer = SOAP::Deserializer->new(); my $parser_xs = SOAP::WSDL::Expat::MessageParser_XS->new({ class_resolver => 'FakeResolver' }); sub libxml_test { my $dom = $libxml->parse_string( $xml ); push @data, dom2hash( $dom->firstChild ); }; sub dom2hash { for ($_[0]->childNodes) { if (exists $_[1]->{ $_->nodeName }) { if (ref $_[1]->{ $_->nodeName } eq 'ARRAY') { if ($_->nodeName eq '#text') { push @{ $_[1] } ,$_->textContent; } else { push @{ $_[1]->{ $_->nodeName } }, dom2hash( $_, {} ); } } else { if ($_->nodeName eq '#text') { $_[1] = [ $_[1], $_->textContent() ]; } else { $_[1]->{ $_->nodeName } = [ $_[1]->{ $_->nodeName } , dom2hash( $_, {} ) ]; } } } else { if ($_->nodeName eq '#text') { $_[1] = $_->textContent(); } else { $_[1]->{ $_->nodeName } = dom2hash( $_, {} ); } } } return $_[1]; } cmpthese 5000, { 'SOAP::WSDL (Hash)' => sub { push @data, $hash_parser->parse( $xml ) }, 'SOAP::WSDL (XSD)' => sub { push @data, $parser->parse( $xml ) }, 'SOAP::WSDL_XS (XSD)' => sub { push @data, $parser_xs->parse_string( $xml ) }, 'XML::Simple (Hash)' => sub { push @data, XMLin $xml }, 'XML::LibXML (DOM)' => sub { push @data, $libxml->parse_string( $xml ) }, 'XML::LibXML (Hash)' => \&libxml_test, 'SOAP::Lite' => sub { push @data, $deserializer->deserialize( $xml ) }, }; # data classes reside in t/lib/Typelib/ BEGIN { package FakeResolver; { my %class_list = ( 'MyAtomicComplexTypeElement' => 'MyAtomicComplexTypeElement', 'MyAtomicComplexTypeElement/test' => 'MyAtomicComplexTypeElement', 'MyAtomicComplexTypeElement/test/test2' => 'MyTestElement2', ); sub get_typemap { return \%class_list; }; sub get_map { return \%class_list }; sub new { return bless {}, 'FakeResolver' }; sub get_class { my $name = join('/', @{ $_[1] }); return ($class_list{ $name }) ? $class_list{ $name } : warn "no class found for $name"; }; }; }; __END__ Output on my machine: xml length: 641 bytes Rate SOAP::Lite XML::Simple (Hash) SOAP::WSDL (XSD) XML::LibXML (Hash) SOAP::WSDL (Hash) SOAP::WSDL_XS (XSD) XML::LibXML (DOM) SOAP::Lite 446/s -- -54% -72% -73% -80% -95% -96% XML::Simple (Hash) 963/s 116% -- -39% -41% -57% -89% -91% SOAP::WSDL (XSD) 1587/s 256% 65% -- -3% -29% -81% -86% XML::LibXML (Hash) 1629/s 265% 69% 3% -- -27% -81% -85% SOAP::WSDL (Hash) 2222/s 398% 131% 40% 36% -- -74% -80% SOAP::WSDL_XS (XSD) 8475/s 1798% 780% 434% 420% 281% -- -24% XML::LibXML (DOM) 11111/s 2389% 1053% 600% 582% 400% 31% -- SOAP-WSDL-2.00.10/benchmark/hello.pl0000444000175000017500000000461411203370730016122 0ustar martinmartin#!/usr/bin/perl -w use strict; use warnings; use diagnostics; use lib '../example/lib'; use lib '../../SOAP-Lite-0.71/lib'; use lib '/home/martin/workspace/SOAP-WSDL_XS/blib/lib'; use lib '/home/martin/workspace/SOAP-WSDL_XS/blib/arch'; use Data::Dumper; use SOAP::Lite; use XML::Compile::SOAP11; use XML::Compile::WSDL11; use XML::Compile::Transport::SOAPHTTP; use MyInterfaces::HelloWorld::HelloWorldSoap; #use SOAP::WSDL::Deserializer::XSD_XS; use Benchmark qw(cmpthese timethese); use SOAP::WSDL::Transport::HTTP; use SOAP::WSDL::Factory::Transport; SOAP::WSDL::Factory::Transport->register('http', 'SOAP::WSDL::Transport::HTTP'); my $proxy = 'http://localhost:81/soap-wsdl-test/helloworld.pl'; #my $proxy = 'http://localhost:81/soap-wsdl-test/helloworld'; my $lite = SOAP::Lite->new( proxy => $proxy ); $lite->on_action( sub { "urn:HelloWorld#sayHello" }); $lite->autotype(0); my $soap = MyInterfaces::HelloWorld::HelloWorldSoap->new({ proxy => $proxy, }); my $soap_xs = MyInterfaces::HelloWorld::HelloWorldSoap->new({ proxy => $proxy, }); #$soap_xs->set_deserializer( SOAP::WSDL::Deserializer::XSD_XS->new() ); my @result = ();; sub wsdl_bench { push @result, $soap->sayHello({ name => $ARGV[1] || '"Your name"', givenName => $ARGV[0] || '"Your given name"', }); } sub wsdl_xs_bench { push @result, $soap_xs->sayHello({ name => $ARGV[1] || '"Your name"', givenName => $ARGV[0] || '"Your given name"', }); } my $wsdl = XML::Compile::WSDL11->new('../example/wsdl/11_helloworld.wsdl'); my $call = $wsdl->compileClient('sayHello', sloppy_integers => 1, check_values => 0, check_values => 0, validation => 0, ); sub compile_bench { push @result, $call->( name => $ARGV[1] || '"Your name"', givenName => $ARGV[0] || '"Your given name"', ); } sub lite_bench { push @result, $lite->call( SOAP::Data->name("sayHello") ->attr({ xmlns => 'urn:HelloWorld' }), SOAP::Data->name('name')->value( $ARGV[1] || '"Your name"'), SOAP::Data->name('givenName')->value( $ARGV[0] || '"Your given name"'), ); } # give all a chance to perform first-run initializations compile_bench(); lite_bench(); wsdl_bench(); #wsdl_xs_bench(); timethese 150, { 'SOAP::WSDL' => \&wsdl_bench, # 'SOAP::WSDL_XS' => \&wsdl_xs_bench, 'XML::Compile' => \&compile_bench, 'SOAP::Lite' => \&lite_bench, }; SOAP-WSDL-2.00.10/benchmark/person_single.pl0000444000175000017500000002625111203370730017667 0ustar martinmartinuse lib '../lib'; use lib '../example/lib'; use lib '../../SOAP-WSDL_XS/blib/lib'; use lib '../../SOAP-WSDL_XS/blib/arch'; use strict; use Benchmark; use Storable; use SOAP::WSDL::Deserializer::XSD_XS; use SOAP::WSDL::Factory::Deserializer; # # register for SOAP 1.1 SOAP::WSDL::Factory::Deserializer->register('1.1' => 'SOAP::WSDL::Deserializer::XSD_XS' ); SOAP::WSDL::Factory::Transport->register('http' => 'Transport'); use MyInterfaces::TestService::TestPort; my @data = (); my $soap = MyInterfaces::TestService::TestPort->new(); # Load all classes - XML::Compile has created everything before, too timethis 150, sub { $soap->ListPerson({}) }; timethis 300, sub { push @data, $soap->ListPerson({}) }; @data = (); timethis 300, sub { push @data, $soap->ListPerson({}) }; # for (1..50) { push @data, $soap->ListPerson({}) }; #print $soap->ListPerson({}); my $result = $soap->ListPerson({}); timethis 30 , sub { my $frozen = Storable::freeze( $result ); my $thawed = Storable::thaw($frozen); }; # print $thawed; package Transport; use Class::Std::Fast; sub send_receive { return <<'EOT'; 1Salutation0Name0Martin1970-01-01Street 000000City0Country0++499131123456++49150123456Somestreet 2312345SomeCityGermany++499131123456++49150123456100000SomeContract0100001SomeContract1100002SomeContract2100003SomeContract31Salutation0Name0Martin1970-01-01Street 000000City0Country0++499131123456++49150123456Somestreet 2312345SomeCityGermany++499131123456++49150123456100000SomeContract0100001SomeContract1100002SomeContract2100003SomeContract31Salutation0Name0Martin1970-01-01Street 000000City0Country0++499131123456++49150123456Somestreet 2312345SomeCityGermany++499131123456++49150123456100000SomeContract0100001SomeContract1100002SomeContract2100003SomeContract31Salutation0Name0Martin1970-01-01Street 000000City0Country0++499131123456++49150123456Somestreet 2312345SomeCityGermany++499131123456++49150123456100000SomeContract0100001SomeContract1100002SomeContract2100003SomeContract31Salutation0Name0Martin1970-01-01Street 000000City0Country0++499131123456++49150123456Somestreet 2312345SomeCityGermany++499131123456++49150123456100000SomeContract0100001SomeContract1100002SomeContract2100003SomeContract31Salutation0Name0Martin1970-01-01Street 000000City0Country0++499131123456++49150123456Somestreet 2312345SomeCityGermany++499131123456++49150123456100000SomeContract0100001SomeContract1100002SomeContract2100003SomeContract31Salutation0Name0Martin1970-01-01Street 000000City0Country0++499131123456++49150123456Somestreet 2312345SomeCityGermany++499131123456++49150123456100000SomeContract0100001SomeContract1100002SomeContract2100003SomeContract31Salutation0Name0Martin1970-01-01Street 000000City0Country0++499131123456++49150123456Somestreet 2312345SomeCityGermany++499131123456++49150123456100000SomeContract0100001SomeContract1100002SomeContract2100003SomeContract31Salutation0Name0Martin1970-01-01Street 000000City0Country0++499131123456++49150123456Somestreet 2312345SomeCityGermany++499131123456++49150123456100000SomeContract0100001SomeContract1100002SomeContract2100003SomeContract31Salutation0Name0Martin1970-01-01Street 000000City0Country0++499131123456++49150123456Somestreet 2312345SomeCityGermany++499131123456++49150123456100000SomeContract0100001SomeContract1100002SomeContract2100003SomeContract3}; EOT } SOAP-WSDL-2.00.10/benchmark/README0000444000175000017500000000560211203370730015340 0ustar martinmartinThe benchmark directory includes a bunch of benchmarks. The most notable ones are listed below. Comparison benchmarks for SOAP::Lite, SOAP::WSDL, SOAP::WSDL_XS, and XML::Compile::WSDP need all of these installed for the benchmark to work (building and adding to the lib path suffices). All comparison benchmarks only account for the client part of the respective modules - the server part is not benchmarked. SOAP::WSDL_XS can be obtained from the project's subversion repository at https://soap-wsdl.svn.sourceforge.net/svnroot/SOAP-WSDL/SOAP-WSDL_XS/trunk Some benchmarks expect to find the SOAP servers "cgi-bin/person.pl" and "cgi-bin/hello.pl" from the examples directory at http://localhost:81/soap-wsdl-test/person.pl and http://localhost:81/soap-wsdl-test/hello.pl If the web services are not set up properly, you're benchmarking error creation times. To set up a SOAP server using apache, add the following to your apache config: # usually in main config Listen 127.0.0.1:81 # maybe in a # container # ScriptAlias /soap-wsdl-test/ /PATH_TO/SOAP-WSDL/example/cgi-bin/ AllowOverride None Order allow,deny Allow from all Using mod_perl is highly recommended to cut down benchmarking time. COMPARISON BENCHMARKS ===================== 01_expat.t ---------- Benchmarks XML parsing speed between XML::Simple with XML::Parser as backend, SOAP::Lite, SOAP::WSDL outputting objects, SOAP::WSDL outputting hash refs, XML::LibXML with a simple DOM walker outputting hash refs, XML::LibXML outputting the DOM and SOAP::WSDL_XS. No web server required. This benchmark sheds light on how much performance is - in theory - reachable by each approach: The XML::LibXML (Hash) benchmark converts the DOM into a nested hash using a recursive function. This is - basically - how XML::Compile works. XML::Simple uses XML::Parser's streaming API. SOAP::WSDL uses XML::Parser::Expat, XML::Parser's low-level backend, to create objects or - in the (Hash) variant - nested hashes similar to those created by XML::Simple. SOAP::WSDL_XS uses a libexpat-based XS parser to create perl objects, and XML::LibXML (DOM) creates a C level libxml2 DOM accessible from perl. person.pl: ---------- Sends a empty requests and receives a response of ca. 10kB. Modeled after a common enterprise setup: "Give me a list of person data sets". For this benchmark, XML parsing speed is important. XML generation speed is only weighted in the last two runs, and weights around 1/10 of parsing speed. hello.pl: --------- Sends a request containing name and given name and politely replies "Hello ". An example for very short requests and responses. For this example, handling and generating small requests/responses, and transport speed is important. As the XML transmitted is relatively small, the transport layer's overhead is important. SOAP-WSDL-2.00.10/MANIFEST0000444000175000017500000004377011203370730013667 0ustar martinmartinbenchmark/01_expat.t benchmark/hello.pl benchmark/MEMORY_FOOTPRINT benchmark/person.pl benchmark/person.xml benchmark/person_profile.pl benchmark/person_single.pl benchmark/README benchmark/XSD/01_anyType.t benchmark/XSD/02_anySimpleType.t benchmark/XSD/03_string.t benchmark/XSD/strftime.pl bin/wsdl2perl.pl Build.PL Changes example/cgi-bin/helloworld.pl example/cgi-bin/person.pl example/fortune.pl example/genericbarcode.pl example/hello.pl example/hello_compile.pl example/hello_lite.pl example/java/cxf/.classpath example/java/cxf/.settings/org.eclipse.jdt.core.prefs example/java/cxf/.settings/org.maven.ide.eclipse.prefs example/java/cxf/11_helloworld.wsdl example/java/cxf/jax-binding.xml example/java/cxf/pom.xml example/java/cxf/README example/java/cxf/src/main/resources/cxf.xml example/java/cxf/src/test/java/helloworld/HelloWorldTest.java example/java/cxf/src/test/resources/test-context.xml example/lib/MyElements/CountCookies.pm example/lib/MyElements/CountCookiesResponse.pm example/lib/MyElements/GenerateBarCode.pm example/lib/MyElements/GenerateBarCodeResponse.pm example/lib/MyElements/GetCitiesByCountry.pm example/lib/MyElements/GetCitiesByCountryResponse.pm example/lib/MyElements/GetFortuneCookie.pm example/lib/MyElements/GetFortuneCookieResponse.pm example/lib/MyElements/GetSpecificCookie.pm example/lib/MyElements/GetSpecificCookieResponse.pm example/lib/MyElements/GetWeather.pm example/lib/MyElements/GetWeatherResponse.pm example/lib/MyElements/int.pm example/lib/MyElements/ListPerson.pm example/lib/MyElements/ListPersonResponse.pm example/lib/MyElements/readNodeCount.pm example/lib/MyElements/readNodeCountResponse.pm example/lib/MyElements/sayHello.pm example/lib/MyElements/sayHelloResponse.pm example/lib/MyElements/string.pm example/lib/MyInterfaces/BarCode/BarCodeSoap.pm example/lib/MyInterfaces/FullerData_x0020_Fortune_x0020_Cookie/FullerData_x0020_Fortune_x0020_CookieSoap.pm example/lib/MyInterfaces/GlobalWeather/GlobalWeatherSoap.pm example/lib/MyInterfaces/HelloWorld/HelloWorldSoap.pm example/lib/MyInterfaces/TestService/TestPort.pm example/lib/MyServer/HelloWorld/HelloWorldSoap.pm example/lib/MyServer/TestService/TestPort.pm example/lib/MyTypemaps/BarCode.pm example/lib/MyTypemaps/FullerData_x0020_Fortune_x0020_Cookie.pm example/lib/MyTypemaps/GlobalWeather.pm example/lib/MyTypemaps/HelloWorld.pm example/lib/MyTypemaps/TestService.pm example/lib/MyTypes/Address.pm example/lib/MyTypes/ArrayOfContract.pm example/lib/MyTypes/ArrayOfPerson.pm example/lib/MyTypes/BarCodeData.pm example/lib/MyTypes/BarcodeOption.pm example/lib/MyTypes/BarcodeType.pm example/lib/MyTypes/CheckSumMethod.pm example/lib/MyTypes/Contract.pm example/lib/MyTypes/ImageFormats.pm example/lib/MyTypes/Person.pm example/lib/MyTypes/PersonID.pm example/lib/MyTypes/PhoneNumber.pm example/lib/MyTypes/ShowTextPosition.pm example/lib/MyTypes/test2.pm example/lib/MyTypes/testExtended.pm example/person.pl example/person_compile.pl example/server/hello_simple.pl example/visitor/visitor.pl example/weather.pl example/weather_wsdl.pl example/wsdl/11_helloworld.wsdl example/wsdl/FortuneCookie.xml example/wsdl/genericbarcode.xml example/wsdl/globalweather.xml example/wsdl/Person.wsdl example/wsdl/person.xml HACKING lib/SOAP/WSDL.pm lib/SOAP/WSDL/Base.pm lib/SOAP/WSDL/Binding.pm lib/SOAP/WSDL/Client.pm lib/SOAP/WSDL/Client/Base.pm lib/SOAP/WSDL/Definitions.pm lib/SOAP/WSDL/Deserializer/Hash.pm lib/SOAP/WSDL/Deserializer/SOM.pm lib/SOAP/WSDL/Deserializer/XSD.pm lib/SOAP/WSDL/Expat/Base.pm lib/SOAP/WSDL/Expat/Message2Hash.pm lib/SOAP/WSDL/Expat/MessageParser.pm lib/SOAP/WSDL/Expat/MessageStreamParser.pm lib/SOAP/WSDL/Expat/WSDLParser.pm lib/SOAP/WSDL/Factory/Deserializer.pm lib/SOAP/WSDL/Factory/Generator.pm lib/SOAP/WSDL/Factory/Serializer.pm lib/SOAP/WSDL/Factory/Transport.pm lib/SOAP/WSDL/Generator/Iterator/WSDL11.pm lib/SOAP/WSDL/Generator/PrefixResolver.pm lib/SOAP/WSDL/Generator/Template.pm lib/SOAP/WSDL/Generator/Template/Plugin/XSD.pm lib/SOAP/WSDL/Generator/Template/XSD.pm lib/SOAP/WSDL/Generator/Template/XSD/attribute.tt lib/SOAP/WSDL/Generator/Template/XSD/complexType.tt lib/SOAP/WSDL/Generator/Template/XSD/complexType/all.tt lib/SOAP/WSDL/Generator/Template/XSD/complexType/atomicTypes.tt lib/SOAP/WSDL/Generator/Template/XSD/complexType/attributeSet.tt lib/SOAP/WSDL/Generator/Template/XSD/complexType/complexContent.tt lib/SOAP/WSDL/Generator/Template/XSD/complexType/contentModel.tt lib/SOAP/WSDL/Generator/Template/XSD/complexType/extension.tt lib/SOAP/WSDL/Generator/Template/XSD/complexType/POD/all.tt lib/SOAP/WSDL/Generator/Template/XSD/complexType/POD/attributeSet.tt lib/SOAP/WSDL/Generator/Template/XSD/complexType/POD/choice.tt lib/SOAP/WSDL/Generator/Template/XSD/complexType/POD/complexContent.tt lib/SOAP/WSDL/Generator/Template/XSD/complexType/POD/content_model.tt lib/SOAP/WSDL/Generator/Template/XSD/complexType/POD/restriction.tt lib/SOAP/WSDL/Generator/Template/XSD/complexType/POD/simpleContent.tt lib/SOAP/WSDL/Generator/Template/XSD/complexType/POD/simpleContent/extension.tt lib/SOAP/WSDL/Generator/Template/XSD/complexType/POD/simpleContent/restriction.tt lib/SOAP/WSDL/Generator/Template/XSD/complexType/POD/structure.tt lib/SOAP/WSDL/Generator/Template/XSD/complexType/POD/structure/restriction.tt lib/SOAP/WSDL/Generator/Template/XSD/complexType/POD/structure/simpleContent.tt lib/SOAP/WSDL/Generator/Template/XSD/complexType/restriction.tt lib/SOAP/WSDL/Generator/Template/XSD/complexType/simpleContent.tt lib/SOAP/WSDL/Generator/Template/XSD/complexType/simpleContent/extension.tt lib/SOAP/WSDL/Generator/Template/XSD/complexType/variety.tt lib/SOAP/WSDL/Generator/Template/XSD/element.tt lib/SOAP/WSDL/Generator/Template/XSD/element/POD/contentModel.tt lib/SOAP/WSDL/Generator/Template/XSD/element/POD/structure.tt lib/SOAP/WSDL/Generator/Template/XSD/Interface.tt lib/SOAP/WSDL/Generator/Template/XSD/Interface/Body.tt lib/SOAP/WSDL/Generator/Template/XSD/Interface/Header.tt lib/SOAP/WSDL/Generator/Template/XSD/Interface/Operation.tt lib/SOAP/WSDL/Generator/Template/XSD/Interface/POD/Element.tt lib/SOAP/WSDL/Generator/Template/XSD/Interface/POD/Message.tt lib/SOAP/WSDL/Generator/Template/XSD/Interface/POD/method_info.tt lib/SOAP/WSDL/Generator/Template/XSD/Interface/POD/Operation.tt lib/SOAP/WSDL/Generator/Template/XSD/Interface/POD/Part.tt lib/SOAP/WSDL/Generator/Template/XSD/Interface/POD/Type.tt lib/SOAP/WSDL/Generator/Template/XSD/POD/annotation.tt lib/SOAP/WSDL/Generator/Template/XSD/Server.tt lib/SOAP/WSDL/Generator/Template/XSD/Server/POD/Message.tt lib/SOAP/WSDL/Generator/Template/XSD/Server/POD/method_info.tt lib/SOAP/WSDL/Generator/Template/XSD/Server/POD/Operation.tt lib/SOAP/WSDL/Generator/Template/XSD/Server/POD/OutPart.tt lib/SOAP/WSDL/Generator/Template/XSD/simpleType.tt lib/SOAP/WSDL/Generator/Template/XSD/simpleType/atomicType.tt lib/SOAP/WSDL/Generator/Template/XSD/simpleType/contentModel.tt lib/SOAP/WSDL/Generator/Template/XSD/simpleType/list.tt lib/SOAP/WSDL/Generator/Template/XSD/simpleType/POD/contentModel.tt lib/SOAP/WSDL/Generator/Template/XSD/simpleType/POD/list.tt lib/SOAP/WSDL/Generator/Template/XSD/simpleType/POD/restriction.tt lib/SOAP/WSDL/Generator/Template/XSD/simpleType/POD/structure.tt lib/SOAP/WSDL/Generator/Template/XSD/simpleType/POD/union.tt lib/SOAP/WSDL/Generator/Template/XSD/simpleType/restriction.tt lib/SOAP/WSDL/Generator/Template/XSD/simpleType/union.tt lib/SOAP/WSDL/Generator/Template/XSD/Typemap.tt lib/SOAP/WSDL/Generator/Visitor.pm lib/SOAP/WSDL/Generator/Visitor/Typemap.pm lib/SOAP/WSDL/Manual.pod lib/SOAP/WSDL/Manual/CodeFirst.pod lib/SOAP/WSDL/Manual/Cookbook.pod lib/SOAP/WSDL/Manual/Deserializer.pod lib/SOAP/WSDL/Manual/FAQ.pod lib/SOAP/WSDL/Manual/Glossary.pod lib/SOAP/WSDL/Manual/Parser.pod lib/SOAP/WSDL/Manual/Serializer.pod lib/SOAP/WSDL/Manual/WS_I.pod lib/SOAP/WSDL/Manual/XSD.pod lib/SOAP/WSDL/Message.pm lib/SOAP/WSDL/Operation.pm lib/SOAP/WSDL/OpMessage.pm lib/SOAP/WSDL/Part.pm lib/SOAP/WSDL/Port.pm lib/SOAP/WSDL/PortType.pm lib/SOAP/WSDL/Serializer/XSD.pm lib/SOAP/WSDL/Server.pm lib/SOAP/WSDL/Server/CGI.pm lib/SOAP/WSDL/Server/Mod_Perl2.pm lib/SOAP/WSDL/Server/Simple.pm lib/SOAP/WSDL/Service.pm lib/SOAP/WSDL/SOAP/Address.pm lib/SOAP/WSDL/SOAP/Body.pm lib/SOAP/WSDL/SOAP/Header.pm lib/SOAP/WSDL/SOAP/HeaderFault.pm lib/SOAP/WSDL/SOAP/Operation.pm lib/SOAP/WSDL/SOAP/Typelib/Fault.pm lib/SOAP/WSDL/SOAP/Typelib/Fault11.pm lib/SOAP/WSDL/Transport/HTTP.pm lib/SOAP/WSDL/Transport/Loopback.pm lib/SOAP/WSDL/Transport/Test.pm lib/SOAP/WSDL/TypeLookup.pm lib/SOAP/WSDL/Types.pm lib/SOAP/WSDL/XSD/Annotation.pm lib/SOAP/WSDL/XSD/Attribute.pm lib/SOAP/WSDL/XSD/AttributeGroup.pm lib/SOAP/WSDL/XSD/Builtin.pm lib/SOAP/WSDL/XSD/ComplexType.pm lib/SOAP/WSDL/XSD/Element.pm lib/SOAP/WSDL/XSD/Enumeration.pm lib/SOAP/WSDL/XSD/FractionDigits.pm lib/SOAP/WSDL/XSD/Group.pm lib/SOAP/WSDL/XSD/Length.pm lib/SOAP/WSDL/XSD/MaxExclusive.pm lib/SOAP/WSDL/XSD/MaxInclusive.pm lib/SOAP/WSDL/XSD/MaxLength.pm lib/SOAP/WSDL/XSD/MinExclusive.pm lib/SOAP/WSDL/XSD/MinInclusive.pm lib/SOAP/WSDL/XSD/MinLength.pm lib/SOAP/WSDL/XSD/Pattern.pm lib/SOAP/WSDL/XSD/Schema.pm lib/SOAP/WSDL/XSD/Schema/Builtin.pm lib/SOAP/WSDL/XSD/SimpleType.pm lib/SOAP/WSDL/XSD/TotalDigits.pm lib/SOAP/WSDL/XSD/Typelib/Attribute.pm lib/SOAP/WSDL/XSD/Typelib/AttributeSet.pm lib/SOAP/WSDL/XSD/Typelib/Builtin.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/anySimpleType.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/anyType.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/anyURI.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/base64Binary.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/boolean.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/byte.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/date.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/dateTime.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/decimal.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/double.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/duration.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/ENTITY.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/float.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/gDay.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/gMonth.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/gMonthDay.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/gYear.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/gYearMonth.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/hexBinary.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/ID.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/IDREF.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/IDREFS.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/int.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/integer.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/language.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/list.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/long.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/Name.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/NCName.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/negativeInteger.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/NMTOKEN.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/NMTOKENS.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/nonNegativeInteger.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/nonPositiveInteger.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/normalizedString.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/NOTATION.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/positiveInteger.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/QName.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/short.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/string.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/time.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/token.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/unsignedByte.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/unsignedInt.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/unsignedLong.pm lib/SOAP/WSDL/XSD/Typelib/Builtin/unsignedShort.pm lib/SOAP/WSDL/XSD/Typelib/ComplexType.pm lib/SOAP/WSDL/XSD/Typelib/Element.pm lib/SOAP/WSDL/XSD/Typelib/SimpleType.pm lib/SOAP/WSDL/XSD/WhiteSpace.pm LICENSE Makefile.PL MANIFEST This list of files META.yml MIGRATING README t/002_parse_wsdl.t t/003_wsdl_based_serializer.t t/006_client.t t/008_client_wsdl_complexType.t t/009_data_classes.t t/011_simpleType.t t/012_element.t t/013_complexType.t t/016_client_object.t t/094_cpan_meta.t t/095_copying.t t/096_characters.t t/097_kwalitee.t t/098_pod.t t/099_pod_coverage.t t/acceptance/results/03_complexType-all.xml t/acceptance/results/03_complexType-sequence.xml t/acceptance/results/04_element-simpleType.xml t/acceptance/results/04_element.xml t/acceptance/results/05_simpleType-list.xml t/acceptance/results/05_simpleType-restriction.xml t/acceptance/results/05_simpleType-union.xml t/acceptance/results/11_helloworld.xml t/acceptance/wsdl/006_sax_client.wsdl t/acceptance/wsdl/008_complexType.wsdl t/acceptance/wsdl/02_port.wsdl t/acceptance/wsdl/03_complexType-all.wsdl t/acceptance/wsdl/03_complexType-element-ref.wsdl t/acceptance/wsdl/03_complexType-sequence.wsdl t/acceptance/wsdl/04_element-simpleType.wsdl t/acceptance/wsdl/04_element.wsdl t/acceptance/wsdl/05_simpleType-list.wsdl t/acceptance/wsdl/05_simpleType-restriction.wsdl t/acceptance/wsdl/05_simpleType-union.wsdl t/acceptance/wsdl/10_helloworld.asmx.xml t/acceptance/wsdl/11_helloworld.wsdl t/acceptance/wsdl/elementAtomicComplexType.xml t/acceptance/wsdl/email_account.wsdl t/acceptance/wsdl/generator_test.wsdl t/acceptance/wsdl/generator_test_dot_names.wsdl t/acceptance/wsdl/generator_unsupported_test.wsdl t/acceptance/wsdl/helloWorld_header.wsdl t/acceptance/wsdl/import.xsd t/acceptance/wsdl/import_loop.xsd t/acceptance/wsdl/message_gateway.wsdl t/acceptance/wsdl/nested_complextype.wsdl t/acceptance/wsdl/WSDLParser-import.wsdl t/acceptance/wsdl/WSDLParser-imported.wsdl t/acceptance/wsdl/WSDLParser.wsdl t/acceptance/wsdl/WSDLParser/import_cascade.xsd t/acceptance/wsdl/WSDLParser/import_no_location.wsdl t/acceptance/wsdl/WSDLParser/import_xsd_cascade.wsdl t/acceptance/wsdl/WSDLParser/imported.xsd t/acceptance/wsdl/WSDLParser/xsd_import_no_location.wsdl t/acceptance/wsdl/WSDLParser_import_loop.wsdl t/CodeFirst/ComplexType.pm t/CodeFirst/element.pm t/CodeFirst/sequence.pm t/CodeFirst/test.pl t/contributed.wsdl t/lib/CodeFirst.pm t/lib/Mod_Perl2Test.pm t/lib/MyComplexType.pm t/lib/MyElement.pm t/lib/MySimpleElement.pm t/lib/MySimpleType.pm t/lib/Test/SOAP/WSDL/Expat/WSDLParser.pm t/lib/Test/SOAP/WSDL/Generator/Iterator/WSDL11.pm t/lib/Test/SOAP/WSDL/Generator/Visitor/Typemap.pm t/lib/Test/SOAP/WSDL/Tester.pm t/lib/Typelib/Base.pm t/lib/Typelib/TEnqueueMessage.pm t/lib/Typelib/TMessage.pm t/SOAP/WSDL.t t/SOAP/WSDL/02_port.t t/SOAP/WSDL/03_complexType-all.t t/SOAP/WSDL/03_complexType-choice.t t/SOAP/WSDL/03_complexType-complexContent.t t/SOAP/WSDL/03_complexType-element-ref.t t/SOAP/WSDL/03_complexType-group.t t/SOAP/WSDL/03_complexType-sequence.t t/SOAP/WSDL/03_complexType-simpleContent.t t/SOAP/WSDL/04_element-complexType.t t/SOAP/WSDL/04_element-simpleType.t t/SOAP/WSDL/04_element.t t/SOAP/WSDL/05_simpleType-list.t t/SOAP/WSDL/05_simpleType-restriction.t t/SOAP/WSDL/05_simpleType-union.t t/SOAP/WSDL/06_keep_alive.t t/SOAP/WSDL/11_helloworld.NET.t t/SOAP/WSDL/12_binding.t t/SOAP/WSDL/Base.t t/SOAP/WSDL/Client.t t/SOAP/WSDL/Client/Base.t t/SOAP/WSDL/Definitions.t t/SOAP/WSDL/Deserializer/Hash.t t/SOAP/WSDL/Deserializer/SOM.t t/SOAP/WSDL/Deserializer/XSD.t t/SOAP/WSDL/Expat/Base.t t/SOAP/WSDL/Expat/MessageParser.t t/SOAP/WSDL/Expat/WSDLParser.t t/SOAP/WSDL/Factory/Deserializer.t t/SOAP/WSDL/Factory/Serializer.t t/SOAP/WSDL/Factory/Transport.t t/SOAP/WSDL/Generator/Template.t t/SOAP/WSDL/Generator/Template/XSD/Import.t t/SOAP/WSDL/Generator/Template/XSD/Unqualified.t t/SOAP/WSDL/Generator/Visitor.t t/SOAP/WSDL/Generator/Visitor/Typemap.t t/SOAP/WSDL/Generator/XSD.t t/SOAP/WSDL/Generator/XSD_custom_resolver.t t/SOAP/WSDL/Generator/XSD_dot_names.t t/SOAP/WSDL/Generator/XSD_nested_complextype.t t/SOAP/WSDL/Generator/XSD_unsupported.t t/SOAP/WSDL/Part.t t/SOAP/WSDL/PortType.t t/SOAP/WSDL/Serializer/XSD.t t/SOAP/WSDL/Server.t t/SOAP/WSDL/Server/CGI.t t/SOAP/WSDL/Server/Mod_Perl2.t t/SOAP/WSDL/Server/Simple.t t/SOAP/WSDL/Transport/01_Test.t t/SOAP/WSDL/Transport/acceptance/test2.xml t/SOAP/WSDL/Transport/acceptance/test3.xml t/SOAP/WSDL/Transport/HTTP.t t/SOAP/WSDL/Typelib/Fault11.t t/SOAP/WSDL/Types.t t/SOAP/WSDL/XSD/Attribute.t t/SOAP/WSDL/XSD/AttributeGroup.t t/SOAP/WSDL/XSD/Builtin.t t/SOAP/WSDL/XSD/ComplexType.t t/SOAP/WSDL/XSD/Element.t t/SOAP/WSDL/XSD/Enumeration.t t/SOAP/WSDL/XSD/Schema.t t/SOAP/WSDL/XSD/SimpleType.t t/SOAP/WSDL/XSD/Typelib/Attribute.t t/SOAP/WSDL/XSD/Typelib/Builtin/anySimpleType.t t/SOAP/WSDL/XSD/Typelib/Builtin/anyType.t t/SOAP/WSDL/XSD/Typelib/Builtin/anyURI.t t/SOAP/WSDL/XSD/Typelib/Builtin/base64Binary.t t/SOAP/WSDL/XSD/Typelib/Builtin/boolean.t t/SOAP/WSDL/XSD/Typelib/Builtin/byte.t t/SOAP/WSDL/XSD/Typelib/Builtin/date.t t/SOAP/WSDL/XSD/Typelib/Builtin/dateTime.t t/SOAP/WSDL/XSD/Typelib/Builtin/decimal.t t/SOAP/WSDL/XSD/Typelib/Builtin/double.t t/SOAP/WSDL/XSD/Typelib/Builtin/duration.t t/SOAP/WSDL/XSD/Typelib/Builtin/ENTITY.t t/SOAP/WSDL/XSD/Typelib/Builtin/float.t t/SOAP/WSDL/XSD/Typelib/Builtin/gDay.t t/SOAP/WSDL/XSD/Typelib/Builtin/gMonth.t t/SOAP/WSDL/XSD/Typelib/Builtin/gMonthDay.t t/SOAP/WSDL/XSD/Typelib/Builtin/gYear.t t/SOAP/WSDL/XSD/Typelib/Builtin/gYearMonth.t t/SOAP/WSDL/XSD/Typelib/Builtin/hexBinary.t t/SOAP/WSDL/XSD/Typelib/Builtin/ID.t t/SOAP/WSDL/XSD/Typelib/Builtin/IDREF.t t/SOAP/WSDL/XSD/Typelib/Builtin/IDREFS.t t/SOAP/WSDL/XSD/Typelib/Builtin/int.t t/SOAP/WSDL/XSD/Typelib/Builtin/integer.t t/SOAP/WSDL/XSD/Typelib/Builtin/language.t t/SOAP/WSDL/XSD/Typelib/Builtin/list.t t/SOAP/WSDL/XSD/Typelib/Builtin/long.t t/SOAP/WSDL/XSD/Typelib/Builtin/Name.t t/SOAP/WSDL/XSD/Typelib/Builtin/NCName.t t/SOAP/WSDL/XSD/Typelib/Builtin/negativeInteger.t t/SOAP/WSDL/XSD/Typelib/Builtin/NMTOKEN.t t/SOAP/WSDL/XSD/Typelib/Builtin/NMTOKENS.t t/SOAP/WSDL/XSD/Typelib/Builtin/nonNegativeInteger.t t/SOAP/WSDL/XSD/Typelib/Builtin/nonPositiveInteger.t t/SOAP/WSDL/XSD/Typelib/Builtin/normalizedString.t t/SOAP/WSDL/XSD/Typelib/Builtin/NOTATION.t t/SOAP/WSDL/XSD/Typelib/Builtin/positiveInteger.t t/SOAP/WSDL/XSD/Typelib/Builtin/QName.t t/SOAP/WSDL/XSD/Typelib/Builtin/short.t t/SOAP/WSDL/XSD/Typelib/Builtin/string.t t/SOAP/WSDL/XSD/Typelib/Builtin/time.t t/SOAP/WSDL/XSD/Typelib/Builtin/token.t t/SOAP/WSDL/XSD/Typelib/Builtin/unsignedByte.t t/SOAP/WSDL/XSD/Typelib/Builtin/unsignedInt.t t/SOAP/WSDL/XSD/Typelib/Builtin/unsignedLong.t t/SOAP/WSDL/XSD/Typelib/Builtin/unsignedShort.t t/SOAP/WSDL/XSD/Typelib/ComplexType.t t/SOAP/WSDL/XSD/Typelib/Element.t t/SOAP/WSDL_1.wsdl t/SOAP/WSDL_EMPTY_DEFINITIONS.wsdl t/SOAP/WSDL_NO_BINDING.wsdl t/SOAP/WSDL_NO_MESSAGE.wsdl t/SOAP/WSDL_NO_PORTTYPE.wsdl t/test.wsdl TEST_COVERAGE test_html.pl TODO SOAP-WSDL-2.00.10/Build.PL0000444000175000017500000000374111203370730014024 0ustar martinmartinuse Module::Build; use version; $build = Module::Build->new( dist_author => 'Martin Kutter ', create_makefile_pl => 'small', dist_abstract => 'SOAP with WSDL support', dist_name => 'SOAP-WSDL', dist_version => '2.00.10', module_name => 'SOAP::WSDL', license => 'artistic', requires => { # 5.6.x is way too buggy and has no unicode support # for us. SOAP-WSDL relies on unicode (WS-I demands it) # and triggers several 5.6 bugs... 'perl' => q(5.8.0), 'Class::Std::Fast' => q(0.0.5), 'Data::Dumper' => 0, 'Date::Parse' => 0, 'Date::Format' => 0, 'File::Basename' => 0, 'File::Path' => 0, 'Getopt::Long' => 0, 'List::Util' => 0, 'LWP::UserAgent' => 0, 'Template' => q(2.18), 'Term::ReadKey' => 0, 'URI' => 0, 'XML::Parser::Expat' => 0, }, build_requires => { 'Class::Std::Fast' => q(0.0.5), 'Cwd' => 0, 'Date::Parse' => 0, 'Date::Format' => 0, 'Getopt::Long' => 0, 'List::Util' => 0, 'LWP::UserAgent' => 0, 'Module::Build' => 0, 'File::Basename' => 0, 'File::Path' => 0, 'File::Spec' => 0, 'Storable' => 0, 'Test::More' => 0, 'Template' => q(2.18), 'XML::Parser::Expat' => 0, }, recursive_test_files => 1, meta_add => { no_index => { directory => 'lib/SOAP/WSDL/Generator/Template/XSD/', }, } ); $build->add_build_element('tt'); $build->create_build_script; SOAP-WSDL-2.00.10/TODO0000444000175000017500000000057711203370730013224 0ustar martinmartinTODO list for SOAP::WSDL 2.1 release -------- * Support namespaces in SOAP message payload [ 1809057 ] * Support the xsi:type attribute on derived types on the wire [ 1809059 ] * SOAP1.2 support [ 1803331 ] 2.2 release -------- * XML schema support ("minimal conformant") [ 1764845 ] * Support SOAP attachments 3.0 release -------- We're not thinking that far ahead right now. SOAP-WSDL-2.00.10/MIGRATING0000444000175000017500000000500711203370730013771 0ustar martinmartinMIGRATING --------- MIGRATING FROM PRE-2.00_33 -------------------------- The handling of stringification of SOAP::WSDL::XSD simpleType objects with undef values changed in 2.00_33. While 2.00_32 and before returned undef on stringification of a undef value, >=2.00_33 now returns an empty string. This is due to common usage in templates or the like, where undef is likely to produce a warning, and the unreliable behavior of $obj eq undef which behaves differently in different versions of perl. MIGRATING FROM PRE-2.00_29 -------------------------- SOAP::WSDL 2.00_29 added experimental XML attribute support. The attribute support changed the code of the generated classes, which may now require the class SOAP::WSDL::XSD::Typelib::Attribute introduced in the same pre-release. While interfaces generated with pre-releases back to 2.00_25 work without change, this does not hold true vice versa: Interfaces generated with 2.00_29 and above won't work with older pre-releases. You'll have to update SOAP::WSDL on all your machines. MIGRATING FROM PRE-2.00_24 -------------------------- This section describes how to migrate from 2.00_24 and before versions to 2.00_25. Migrating from 2.00_xx ---------------------- Background SOAP::WSDL 2.00_xx has used Class::Std as base for its inside out objects up to 2.00_24. For performance reasons, now Class::Std::Fast is used. As Class::Std::Fast is a drop-in replacement for Class::Std, there should be no need to change anything in your (handwritten) code. Generated interfaces SOAP::WSDL's internal structure has changed, and this change needs to be reflected in all generated classes. This means you have to re-generate your interfaces (in case you use generated interfaces) Typemaps SOAP::WSDL now tries to load all typemap classes at once from 2.00_25 on. If you use __SKIP__ in your typemaps, you'll have to comment out all paths deeper than the path marked with __SKIP__ - if you don't, SOAP::WSDL will try to load all correspondent classes. Migrating from 1.xx ------------------- Background SOAP::WSDL uses a custom WSDL parser and serializer. It does not rely on XPath for on the fly WSDL processing, nor does it use SOAP::Data objects for encoding any more. You should be able to use your existing code under most circumstances. SOAP::WSDL is the compatibility module for old interfaces. Overloading Message overloading (as introduced in 1.23) is not supported any more. Message overloading is prohibited by the WS-I basic profile, therefore SOAP::WSDL does not implement it any more.SOAP-WSDL-2.00.10/HACKING0000444000175000017500000001142511203370730013515 0ustar martinmartinHACKING ======= Development of SOAP::WSDL takes place on sourceforge.net. There's a svn repository available at https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl Engagement in the further development of this module is highly encouraged - many people have already contributed, and many more probably will. I'm sometimes a bit slow in answering e-mails or merging in changes - so if you feel your changes are urgent, please set up a sourceforge account and ask me for commit permissions on the repository - I will happily accept you as co-author. TODO shows the current roadmap. SOAP-WSDL CODING GUIDELINES =========================== DESIGN PRINCIPLES ----------------- SOAP-WSDL is designed for the following principles: 1. SPEED A SOAP toolkit is useless, if it's not fast enough. Therefore SOAP::WSDL aims at always being fast enough. Please benchmark any contributions - if they slow down SOAP-WSDL (especially the XML parsing part), you should have good reasons. 2. USABILITY SOAP-WSDL is designed user-friendly. It tells the user whether it's capable of handling some WSDL or not, it gives friendly error messages, and if a user happens to call a non-existant method on XSD objects, they croak with a list of available methods to ease development. 3. EXTENSIBILITY If you plan an extension, look if the extension itself should be extensible, and which extension points to use. Creating new extension points is highly appreciated. 4. MAINTAINABILITY SOAP::Lite unfortunately shows where a toolkit can go without focus on maintainability. SOAP::WSDL tries to be highly maintainable and easy to understand. CODING STYLE ------------ The principles above dictate a clear, but not too lengthy coding style. SOAP::WSDL's coding style in principle follows Perl Best Practices by Damian Conway, but allows deviances for speed reasons The following guidelines apply: - Testing * SOAP::WSDL has a test coverage of >95% and aims at 100%. Please write a test first. * Use author tests for testing guidelines. Disable author tests for users - it's time consuming and of no use to have users run author tests. - Indentation and formatting * indent with spaces. * indent 4 characters per level * use \n (LF) for newlines, not CRLF * use blank lines to separate paragraphs * Coding style is similar to K&R (opening brace on last line, closing brace on new line. No cuddled else) * No trailing spaces allowed (except to indicate a blank line in a POD source block) - Flow control * postfix if is allowed for single statements only. Preferably for flow control only. * postfix for, while, until are not allowed. * unless is not allowed at all. Use if not. * goto is only allowed for jumping into subs. Nothing else. * redo, next, last etc. are preferred over goto. - Strictness and Warnings * always use strict and warnings. Switch off for the smallest block possible, but switch of if there's a reason (don't let tools like perlcritic fool you: no strict qw(refs); is often required. - Naming * variable names are lower case with _ separating words, except when a XML Schema, SOAP, or WSDL name is name-giving (don't force portType to become port_type) * hashes should be named FOO_of, lists FOO_from, references FOO_ref. * package names are CamelCase, except when a XML, SOAP or WSDL name is name-giving (don't force 'int' to become 'Int'. However, simpleType becomes SimpleType). - Subroutines * Subroutines shouldn't be more than around 50 lines long * @_ should be unpacked. Deviances are allowed for speed reasons. If you're not unpacking @_ in a sub of say, 5 lines or more, please comment what you're doing. * Always return. Always return. A single "return" allows perl to execute the subroutine in question in void context, which saves it from putting it's result in a temporary variable. Always return. - POD and comments * Comment extensively. Comments are the maintainer (and core developer's) documentation - aid them where possible (your're probably doing yourself a favor by adding extensive comments). * Comment either in blocks or as hanging side comments (especially when commenting @_ access). Example: sub baz { # @_ not unpacked for speed reasons. Read: # my ($self, $something, %args_of) = @_; $_[0]->bar($_[1]); # read as $self->bar($something); $_[0]->foo($_[2..$#]); # read as $self->foo(%args_of); return; } * POD is located at end of file, preferably after __END__ * Complete POD coverage is essential. However, if the package in question is used internally only, it's better to omit the POD completely - too many PODs to look at confuse the average CPAN user. July - November 2007, Martin KutterSOAP-WSDL-2.00.10/META.yml0000444000175000017500000003172711203370730014006 0ustar martinmartin--- name: SOAP-WSDL version: 2.00.10 author: - 'Martin Kutter ' abstract: SOAP with WSDL support license: artistic resources: license: http://opensource.org/licenses/artistic-license.php requires: Class::Std::Fast: 0.0.5 Data::Dumper: 0 Date::Format: 0 Date::Parse: 0 File::Basename: 0 File::Path: 0 Getopt::Long: 0 LWP::UserAgent: 0 List::Util: 0 Template: 2.18 Term::ReadKey: 0 URI: 0 XML::Parser::Expat: 0 perl: 5.8.0 build_requires: Class::Std::Fast: 0.0.5 Cwd: 0 Date::Format: 0 Date::Parse: 0 File::Basename: 0 File::Path: 0 File::Spec: 0 Getopt::Long: 0 LWP::UserAgent: 0 List::Util: 0 Module::Build: 0 Storable: 0 Template: 2.18 Test::More: 0 XML::Parser::Expat: 0 provides: SOAP::WSDL: file: lib/SOAP/WSDL.pm version: 2.00.10 SOAP::WSDL::Base: file: lib/SOAP/WSDL/Base.pm version: 2.00.10 SOAP::WSDL::Binding: file: lib/SOAP/WSDL/Binding.pm version: 2.00.10 SOAP::WSDL::Client: file: lib/SOAP/WSDL/Client.pm version: 2.00.10 SOAP::WSDL::Client::Base: file: lib/SOAP/WSDL/Client/Base.pm version: 2.00.10 SOAP::WSDL::Definitions: file: lib/SOAP/WSDL/Definitions.pm version: 2.00.10 SOAP::WSDL::Deserializer::Hash: file: lib/SOAP/WSDL/Deserializer/Hash.pm version: 2.00.10 SOAP::WSDL::Deserializer::SOM: file: lib/SOAP/WSDL/Deserializer/SOM.pm version: 2.00.10 SOAP::WSDL::Deserializer::XSD: file: lib/SOAP/WSDL/Deserializer/XSD.pm version: 2.00.10 SOAP::WSDL::Expat::Base: file: lib/SOAP/WSDL/Expat/Base.pm version: 2.00.10 SOAP::WSDL::Expat::Message2Hash: file: lib/SOAP/WSDL/Expat/Message2Hash.pm version: 2.00.10 SOAP::WSDL::Expat::MessageParser: file: lib/SOAP/WSDL/Expat/MessageParser.pm version: 2.00.10 SOAP::WSDL::Expat::MessageStreamParser: file: lib/SOAP/WSDL/Expat/MessageStreamParser.pm version: 2.00.10 SOAP::WSDL::Expat::WSDLParser: file: lib/SOAP/WSDL/Expat/WSDLParser.pm version: 2.00.10 SOAP::WSDL::Factory::Deserializer: file: lib/SOAP/WSDL/Factory/Deserializer.pm version: 2.00.10 SOAP::WSDL::Factory::Generator: file: lib/SOAP/WSDL/Factory/Generator.pm version: 2.00.10 SOAP::WSDL::Factory::Serializer: file: lib/SOAP/WSDL/Factory/Serializer.pm version: 2.00.10 SOAP::WSDL::Factory::Transport: file: lib/SOAP/WSDL/Factory/Transport.pm version: 2.00.10 SOAP::WSDL::Generator::Iterator::WSDL11: file: lib/SOAP/WSDL/Generator/Iterator/WSDL11.pm version: 2.00.10 SOAP::WSDL::Generator::PrefixResolver: file: lib/SOAP/WSDL/Generator/PrefixResolver.pm version: 2.00.10 SOAP::WSDL::Generator::Template: file: lib/SOAP/WSDL/Generator/Template.pm version: 2.00.10 SOAP::WSDL::Generator::Template::Plugin::XSD: file: lib/SOAP/WSDL/Generator/Template/Plugin/XSD.pm version: 2.00.10 SOAP::WSDL::Generator::Template::XSD: file: lib/SOAP/WSDL/Generator/Template/XSD.pm version: 2.00.10 SOAP::WSDL::Generator::Visitor: file: lib/SOAP/WSDL/Generator/Visitor.pm version: 2.00.10 SOAP::WSDL::Generator::Visitor::Typemap: file: lib/SOAP/WSDL/Generator/Visitor/Typemap.pm version: 2.00.10 SOAP::WSDL::Message: file: lib/SOAP/WSDL/Message.pm version: 2.00.10 SOAP::WSDL::OpMessage: file: lib/SOAP/WSDL/OpMessage.pm version: 2.00.10 SOAP::WSDL::Operation: file: lib/SOAP/WSDL/Operation.pm version: 2.00.10 SOAP::WSDL::Part: file: lib/SOAP/WSDL/Part.pm version: 2.00.10 SOAP::WSDL::Port: file: lib/SOAP/WSDL/Port.pm version: 2.00.10 SOAP::WSDL::PortType: file: lib/SOAP/WSDL/PortType.pm version: 2.00.10 SOAP::WSDL::SOAP::Address: file: lib/SOAP/WSDL/SOAP/Address.pm version: 2.00.10 SOAP::WSDL::SOAP::Body: file: lib/SOAP/WSDL/SOAP/Body.pm version: 2.00.10 SOAP::WSDL::SOAP::Header: file: lib/SOAP/WSDL/SOAP/Header.pm version: 2.00.10 SOAP::WSDL::SOAP::HeaderFault: file: lib/SOAP/WSDL/SOAP/HeaderFault.pm version: 2.00.10 SOAP::WSDL::SOAP::Operation: file: lib/SOAP/WSDL/SOAP/Operation.pm version: 2.00.10 SOAP::WSDL::SOAP::Typelib::Fault: file: lib/SOAP/WSDL/SOAP/Typelib/Fault.pm version: 2.00.10 SOAP::WSDL::SOAP::Typelib::Fault11: file: lib/SOAP/WSDL/SOAP/Typelib/Fault11.pm version: 2.00.10 SOAP::WSDL::SOAP::Typelib::Fault11Detail: file: lib/SOAP/WSDL/SOAP/Typelib/Fault11.pm SOAP::WSDL::Serializer::XSD: file: lib/SOAP/WSDL/Serializer/XSD.pm version: 2.00.10 SOAP::WSDL::Server: file: lib/SOAP/WSDL/Server.pm version: 2.00.10 SOAP::WSDL::Server::CGI: file: lib/SOAP/WSDL/Server/CGI.pm version: 2.00.10 SOAP::WSDL::Server::Mod_Perl2: file: lib/SOAP/WSDL/Server/Mod_Perl2.pm version: 2.00.10 SOAP::WSDL::Server::Simple: file: lib/SOAP/WSDL/Server/Simple.pm version: 2.00.10 SOAP::WSDL::Service: file: lib/SOAP/WSDL/Service.pm version: 2.00.10 SOAP::WSDL::Transport::HTTP: file: lib/SOAP/WSDL/Transport/HTTP.pm version: 2.00.10 SOAP::WSDL::Transport::Loopback: file: lib/SOAP/WSDL/Transport/Loopback.pm version: 2.00.10 SOAP::WSDL::Transport::Test: file: lib/SOAP/WSDL/Transport/Test.pm version: 2.00.10 SOAP::WSDL::TypeLookup: file: lib/SOAP/WSDL/TypeLookup.pm version: 2.00.10 SOAP::WSDL::Types: file: lib/SOAP/WSDL/Types.pm version: 2.00.10 SOAP::WSDL::XSD::Annotation: file: lib/SOAP/WSDL/XSD/Annotation.pm version: 2.00.10 SOAP::WSDL::XSD::Attribute: file: lib/SOAP/WSDL/XSD/Attribute.pm version: 2.00.10 SOAP::WSDL::XSD::AttributeGroup: file: lib/SOAP/WSDL/XSD/AttributeGroup.pm version: 2.00.10 SOAP::WSDL::XSD::Builtin: file: lib/SOAP/WSDL/XSD/Builtin.pm version: 2.00.10 SOAP::WSDL::XSD::ComplexType: file: lib/SOAP/WSDL/XSD/ComplexType.pm version: 2.00.10 SOAP::WSDL::XSD::Element: file: lib/SOAP/WSDL/XSD/Element.pm version: 2.00.10 SOAP::WSDL::XSD::Enumeration: file: lib/SOAP/WSDL/XSD/Enumeration.pm version: 2.00.10 SOAP::WSDL::XSD::FractionDigits: file: lib/SOAP/WSDL/XSD/FractionDigits.pm version: 2.00.10 SOAP::WSDL::XSD::Group: file: lib/SOAP/WSDL/XSD/Group.pm version: 2.00.10 SOAP::WSDL::XSD::Length: file: lib/SOAP/WSDL/XSD/Length.pm version: 2.00.10 SOAP::WSDL::XSD::MaxExclusive: file: lib/SOAP/WSDL/XSD/MaxExclusive.pm version: 2.00.10 SOAP::WSDL::XSD::MaxInclusive: file: lib/SOAP/WSDL/XSD/MaxInclusive.pm version: 2.00.10 SOAP::WSDL::XSD::MaxLength: file: lib/SOAP/WSDL/XSD/MaxLength.pm version: 2.00.10 SOAP::WSDL::XSD::MinExclusive: file: lib/SOAP/WSDL/XSD/MinExclusive.pm version: 2.00.10 SOAP::WSDL::XSD::MinInclusive: file: lib/SOAP/WSDL/XSD/MinInclusive.pm version: 2.00.10 SOAP::WSDL::XSD::MinLength: file: lib/SOAP/WSDL/XSD/MinLength.pm version: 2.00.10 SOAP::WSDL::XSD::Pattern: file: lib/SOAP/WSDL/XSD/Pattern.pm version: 2.00.10 SOAP::WSDL::XSD::Schema: file: lib/SOAP/WSDL/XSD/Schema.pm version: 2.00.10 SOAP::WSDL::XSD::Schema::Builtin: file: lib/SOAP/WSDL/XSD/Schema/Builtin.pm version: 2.00.10 SOAP::WSDL::XSD::SimpleType: file: lib/SOAP/WSDL/XSD/SimpleType.pm version: 2.00.10 SOAP::WSDL::XSD::TotalDigits: file: lib/SOAP/WSDL/XSD/TotalDigits.pm version: 2.00.10 SOAP::WSDL::XSD::Typelib::Attribute: file: lib/SOAP/WSDL/XSD/Typelib/Attribute.pm version: 2.00.10 SOAP::WSDL::XSD::Typelib::AttributeSet: file: lib/SOAP/WSDL/XSD/Typelib/AttributeSet.pm version: 2.00.10 SOAP::WSDL::XSD::Typelib::Builtin: file: lib/SOAP/WSDL/XSD/Typelib/Builtin.pm version: 2.00.10 SOAP::WSDL::XSD::Typelib::Builtin::ENTITY: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/ENTITY.pm SOAP::WSDL::XSD::Typelib::Builtin::ID: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/ID.pm SOAP::WSDL::XSD::Typelib::Builtin::IDREF: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/IDREF.pm SOAP::WSDL::XSD::Typelib::Builtin::IDREFS: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/IDREFS.pm SOAP::WSDL::XSD::Typelib::Builtin::NCName: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/NCName.pm SOAP::WSDL::XSD::Typelib::Builtin::NMTOKEN: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/NMTOKEN.pm SOAP::WSDL::XSD::Typelib::Builtin::NMTOKENS: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/NMTOKENS.pm SOAP::WSDL::XSD::Typelib::Builtin::NOTATION: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/NOTATION.pm SOAP::WSDL::XSD::Typelib::Builtin::Name: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/Name.pm SOAP::WSDL::XSD::Typelib::Builtin::QName: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/QName.pm SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/anySimpleType.pm SOAP::WSDL::XSD::Typelib::Builtin::anyType: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/anyType.pm version: 2.00.10 SOAP::WSDL::XSD::Typelib::Builtin::anyURI: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/anyURI.pm SOAP::WSDL::XSD::Typelib::Builtin::base64Binary: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/base64Binary.pm SOAP::WSDL::XSD::Typelib::Builtin::boolean: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/boolean.pm version: 2.00.10 SOAP::WSDL::XSD::Typelib::Builtin::byte: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/byte.pm SOAP::WSDL::XSD::Typelib::Builtin::date: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/date.pm SOAP::WSDL::XSD::Typelib::Builtin::dateTime: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/dateTime.pm SOAP::WSDL::XSD::Typelib::Builtin::decimal: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/decimal.pm SOAP::WSDL::XSD::Typelib::Builtin::double: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/double.pm SOAP::WSDL::XSD::Typelib::Builtin::duration: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/duration.pm SOAP::WSDL::XSD::Typelib::Builtin::float: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/float.pm SOAP::WSDL::XSD::Typelib::Builtin::gDay: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/gDay.pm SOAP::WSDL::XSD::Typelib::Builtin::gMonth: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/gMonth.pm SOAP::WSDL::XSD::Typelib::Builtin::gMonthDay: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/gMonthDay.pm SOAP::WSDL::XSD::Typelib::Builtin::gYear: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/gYear.pm SOAP::WSDL::XSD::Typelib::Builtin::gYearMonth: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/gYearMonth.pm SOAP::WSDL::XSD::Typelib::Builtin::hexBinary: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/hexBinary.pm SOAP::WSDL::XSD::Typelib::Builtin::int: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/int.pm SOAP::WSDL::XSD::Typelib::Builtin::integer: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/integer.pm SOAP::WSDL::XSD::Typelib::Builtin::language: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/language.pm SOAP::WSDL::XSD::Typelib::Builtin::list: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/list.pm SOAP::WSDL::XSD::Typelib::Builtin::long: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/long.pm SOAP::WSDL::XSD::Typelib::Builtin::negativeInteger: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/negativeInteger.pm SOAP::WSDL::XSD::Typelib::Builtin::nonNegativeInteger: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/nonNegativeInteger.pm SOAP::WSDL::XSD::Typelib::Builtin::nonPositiveInteger: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/nonPositiveInteger.pm SOAP::WSDL::XSD::Typelib::Builtin::normalizedString: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/normalizedString.pm SOAP::WSDL::XSD::Typelib::Builtin::positiveInteger: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/positiveInteger.pm SOAP::WSDL::XSD::Typelib::Builtin::short: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/short.pm SOAP::WSDL::XSD::Typelib::Builtin::string: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/string.pm SOAP::WSDL::XSD::Typelib::Builtin::time: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/time.pm version: 2.00.10 SOAP::WSDL::XSD::Typelib::Builtin::token: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/token.pm SOAP::WSDL::XSD::Typelib::Builtin::unsignedByte: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/unsignedByte.pm SOAP::WSDL::XSD::Typelib::Builtin::unsignedInt: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/unsignedInt.pm SOAP::WSDL::XSD::Typelib::Builtin::unsignedLong: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/unsignedLong.pm SOAP::WSDL::XSD::Typelib::Builtin::unsignedShort: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/unsignedShort.pm SOAP::WSDL::XSD::Typelib::ComplexType: file: lib/SOAP/WSDL/XSD/Typelib/ComplexType.pm version: 2.00.10 SOAP::WSDL::XSD::Typelib::Element: file: lib/SOAP/WSDL/XSD/Typelib/Element.pm version: 2.00.10 SOAP::WSDL::XSD::Typelib::SimpleType: file: lib/SOAP/WSDL/XSD/Typelib/SimpleType.pm version: 2.00.10 SOAP::WSDL::XSD::Typelib::SimpleType::restriction: file: lib/SOAP/WSDL/XSD/Typelib/SimpleType.pm version: 2.00.10 SOAP::WSDL::XSD::WhiteSpace: file: lib/SOAP/WSDL/XSD/WhiteSpace.pm version: 2.00.10 generated_by: Module::Build version 0.280801 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.2.html version: 1.2 no_index: directory: lib/SOAP/WSDL/Generator/Template/XSD/ SOAP-WSDL-2.00.10/test_html.pl0000444000175000017500000000122311203370730015061 0ustar martinmartin# perl usage: use lib 't/lib'; use TAP::Harness; use TAP::Formatter::HTML; my $fmt = TAP::Formatter::HTML->new({ verbosity => -2, }); use File::Find::Rule; my @tests = sort { $a cmp $b } File::Find::Rule->file() ->name( '*.t' ) ->in( 't/' ); local $ENV{TEST_VERBOSE} = 1; my $harness = TAP::Harness->new( { formatter => $fmt , merge => 1, # verbosity => 1, lib => [ 't/lib', 'lib' ], switches => ($ARGV[0] eq '--cover') ? [ '-MDevel::Cover=-ignore,.,-select,^lib/.+,-coverage,statement,subroutine,condition,branch' ] : [], }); $harness->runtests( @tests ); SOAP-WSDL-2.00.10/LICENSE0000444000175000017500000001504611203370730013536 0ustar martinmartinSOAP::WSDL is dual licensed under the same terms as Perl itself. This means at your choice, either the Perl Artistic License, or the GNU GPL version 1 or - at your choice - any higher version. The GNU GPL can be obtained from http://www.gnu.org/licenses/old-licenses/gpl-1.0.txt Newer versions can be found at http://www.gnu.org/licenses/gpl.html The Artistic License can be obtained from http://dev.perl.org/licenses/artistic.html and is included below. ARTISTIC LICENSE ================ The "Artistic License" Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder as specified below. "Copyright Holder" is whoever is named in the copyright or copyrights for the package. "You" is you, if you're thinking about copying or distributing this Package. "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as uunet.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) give non-standard executables non-standard names, and clearly document the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. You may embed this Package's interpreter within an executable of yours (by linking); this shall be construed as a mere form of aggregation, provided that the complete Standard Version of the interpreter is so embedded. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whoever generated them, and may be sold commercially, and may be aggregated with this Package. If such scripts or library files are aggregated with this Package via the so-called "undump" or "unexec" methods of producing a binary executable image, then distribution of such an image shall neither be construed as a distribution of this Package nor shall it fall under the restrictions of Paragraphs 3 and 4, provided that you do not represent such an executable image as a Standard Version of this Package. 7. C subroutines (or comparably compiled subroutines in other languages) supplied by you and linked into this Package in order to emulate subroutines and variables of the language defined by this Package shall not be considered part of this Package, but are the equivalent of input as in Paragraph 6, provided these subroutines do not change the language in any way that would cause it to fail the regression tests for the language. 8. Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package. 9. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End SOAP-WSDL-2.00.10/TEST_COVERAGE0000444000175000017500000000163011203370730014500 0ustar martinmartin# Unfortunately, Build testcover reports test coverage wrong. # # To get a complete coverage report, just run this file as a shell script # on a linux box (or execute the equivalent commands on another OS): # # Note that this shell script requires Devel::CoverX::Covered - if you # don't have it, comment out the line noted below # perl Build.PL && perl Build && \ perl -MTAP::Harness -MFile::Find::Rule -e ' local $ENV{TEST_VERBOSE} = 1; TAP::Harness->new({ merge => 1, lib => [ q{t/lib}, q{blib/lib} ], switches => [ q{-MDevel::Cover=-ignore,.,-select,^blib/lib/.+,-coverage,statement,-coverage,subroutine,-coverage,condition,-coverage,branch} ], })->runtests( sort { $a cmp $b } File::Find::Rule->file()->name( q{*.t} )->in( q{t/} ) ); ' # Devel::CoverX::Covered # covered runs cover # cover -coverage="statement" -coverage=condition -coverage=subroutine -coverage="branch" SOAP-WSDL-2.00.10/Makefile.PL0000444000175000017500000000044711203370730014502 0ustar martinmartin# Note: this file was auto-generated by Module::Build::Compat version 0.2808_01 require 5.8.0; use Module::Build::Compat 0.02; Module::Build::Compat->run_build_pl(args => \@ARGV); require Module::Build; Module::Build::Compat->write_makefile(build_class => 'Module::Build'); SOAP-WSDL-2.00.10/lib/0000755000175000017500000000000011203370730013273 5ustar martinmartinSOAP-WSDL-2.00.10/lib/SOAP/0000755000175000017500000000000011203370730014035 5ustar martinmartinSOAP-WSDL-2.00.10/lib/SOAP/WSDL/0000755000175000017500000000000011203370730014606 5ustar martinmartinSOAP-WSDL-2.00.10/lib/SOAP/WSDL/Server/0000755000175000017500000000000011203370730016054 5ustar martinmartinSOAP-WSDL-2.00.10/lib/SOAP/WSDL/Server/Mod_Perl2.pm0000444000175000017500000002073511203370730020202 0ustar martinmartinpackage SOAP::WSDL::Server::Mod_Perl2; use strict; use warnings; use base qw(SOAP::WSDL::Server); use Scalar::Util qw(blessed); use HTTP::Request (); use Apache2::RequestIO (); # $r->read() use Apache2::RequestRec (); # $r->headers_in use Apache2::RequestUtil(); # $r->dir_config() use APR::Table (); # $r->headers_in->get() use Apache2::Log (); # $r->log use Apache2::Const -compile => qw( OK SERVER_ERROR HTTP_LENGTH_REQUIRED ); use version; our $VERSION = qv('2.00.10'); my %LOADED_OF = (); sub handler { my $r = shift; my $rlog = $r->log(); # # Set up section; import requested modules, throwing errors if we're # unable to do so. For maximum performance, this should be re-worked # to use perl-based Apache directives rather than dir_config(), since # the former happens at startup time and the latter at request time. # # dispatch_to my $dispatch_to = $r->dir_config('dispatch_to'); if (! $dispatch_to) { $rlog->error("No 'dispatch_to' variable set in httpd.conf"); return Apache2::Const::SERVER_ERROR; } if (! exists $LOADED_OF{$dispatch_to}) { eval "require $dispatch_to"; if ($@) { $rlog->error("Failed to require [$dispatch_to]: $@"); return Apache2::Const::SERVER_ERROR; } $LOADED_OF{$dispatch_to} = undef; } # # SOAP service my $soap_service_package = $r->dir_config('soap_service'); if (! $soap_service_package) { $rlog->error("No 'soap_service' variable set in httpd.conf"); return Apache2::Const::SERVER_ERROR; } if (! exists $LOADED_OF{$soap_service_package}) { eval "require $soap_service_package"; if ($@) { $rlog->error("Failed to require [$soap_service_package]: $@"); return Apache2::Const::SERVER_ERROR; } $LOADED_OF{$soap_service_package} = undef; } # # transport_class (optional) my $transport_class = $r->dir_config('transport_class'); if ($transport_class) { eval "require $transport_class"; if ($@) { $rlog->error("Failed to require [$transport_class]: $@"); return Apache2::Const::SERVER_ERROR; } } else { # # if no transport class was specified, use this package's handle() # method $transport_class = __PACKAGE__; } # # instantiate SOAP server object my $server = $soap_service_package->new({ dispatch_to => $dispatch_to, # methods transport_class => $transport_class, # handle() call }); my $response_msg = $server->handle($r); if ($response_msg =~ /^\d{3}$/) { # # a 3-digit number is presumed to be an HTTP return status; since # we got this and not a SOAP response, it's presumed to be an # error; pass it back to the client as-is $rlog->error("Dispatcher returned HTTP $response_msg"); return $response_msg; } if ($response_msg) { $r->content_type('text/xml; charset="utf-8"'); $r->print($response_msg); return Apache2::Const::OK; } else { $rlog->error("No response returned from dispatcher"); return Apache2::Const::SERVER_ERROR; } } sub handle { my ($self, $r) = @_; my $rlog = $r->log(); my $length = $r->headers_in->get('content-length'); if (! $length) { $rlog->error("No content-length provided"); # TODO maybe throw instead of returning a HTTP code? # ... it's an exception, anyway... return Apache2::Const::HTTP_LENGTH_REQUIRED; } # read may return less than requested - read until there's no more... # TODO: We should note that LimitRequestBody is a must in apache config my ($buffer, $read_length); my $content = q{}; while ($read_length = $r->read($buffer, $length)) { $content .= $buffer; } if ($length != length $content) { $rlog->error("Read length mismatch; read [" . length($content) . "] bytes but received [$length] bytes"); return Apache2::Const::SERVER_ERROR; } # Shamelessly copied (with mild tweaks) from SOAP::WSDL::Server::CGI # ... which was as shamelessly copied from SOAP::Transport::HTTP... my $request = HTTP::Request->new( $r->method => $r->uri, HTTP::Headers->new( SOAPAction => $r->headers_in()->get('SOAPAction'), ), $content, ); my $response_message = eval { $self->SUPER::handle($request) }; # TODO return response if @$ is a SOAP::WSDL::XSD::Typelib::Builtin::anyType object if ($@ || blessed($@)) { $rlog->error("Failed to handle request: $@"); return Apache2::Const::SERVER_ERROR; } else { return $response_message; } } 1; __END__ =pod =head1 NAME SOAP::WSDL::Server::Mod_Perl2 - mod_perl based SOAP server using SOAP::WSDL =head1 DESCRIPTION Perl module providing a mod_perl2-based SOAP server using SOAP::WSDL =head1 CONFIGURATION Configuration is managed through the use of PerlSetVar directives. The following variables are available: =head2 dispatch_to Takes as a single argument the package name of the module which contains the methods which handle SOAP requests. PerlSetVar dispatch_to "WebPackage::SOAPMethods" =head2 soap_service Takes as a single argument the package name of the Server module generated by SOAP::WSDL using wsdl2perl.pl --server file:///path/to/your/wsdl By default, the name of the package is MyServer::$SERVICENAME::$PORTTYPE. EXAMPLE: Given this sample WSDL which wsdl2perl.pl was run against to generate perl packages: [...] [...] The following directive would be correct: PerlSetVar soap_service "MyServer::WebService::WebServiceSoap" =head2 transport_class [OPTIONAL] Takes as a single argument the package name of the perl module containing a handle() method used to assemble the HTTP request which will be passed to the methods in your L module (see above). A default handle() method is supplied in this module which should handle most common cases. handle() is called with the following parameters: $r - Apache::RequestRec object =head1 EXAMPLES The following snippet added to httpd.conf will enable a SOAP server at /WebService on your webserver: SetHandler perl-script PerlResponseHandler SOAP::WSDL::Server::Mod_Perl2 PerlSetVar dispatch_to "WebPackage::SOAPMethods" PerlSetVar soap_service "MyServer::WebService::WebServiceSoap" =head1 PERFORMANCE On my machine, a simple SOAP server (the HelloWorld service from the examples) needs around 20s to process 300 requests to a CGI script implemented with SOAP::WSDL::Server::CGI, around 4.5s to the same CGI with mod_perl enabled, and around 3.2s with SOAP::WSDL::Server::Mod_Perl2. All these figures include the time for creating the request and parsing the response. As general advice, using mod_perl is highly recommended in high-performance environments. Using SOAP::WSDL::Server::Mod_Perl2 yields an extra 20% speedup compared with mod_perl enabled CGI scripts - and it allows one to configure SOAP servers in the Apache config. =head1 THREAD SAFETY SOAP::WSDL uses Class::Std::Fast, which is not guaranteed to be threadsafe yet. Thread safety in Class::Std::Fast is dependent on whether my $foo = $bar++; is an atomic operation. I haven't found out yet. A load test on a single CPU machine with 4 clients using the worker mpm did not reveal any threading issues - but that does not mean there are none. =head1 CREDITS Contributed (along with lots of other little improvements) by Noah Robin. Thanks! =head1 LICENSE AND COPYRIGHT This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself =head1 AUTHOR Noah Robin Enoah.robin gmail.comE Based on SOAP::WSDL::Server::CGI, by Martin Kutter Emartin.kutter fen-net.deE =head1 REPOSITORY INFORMATION $Rev: 583 $ $LastChangedBy: kutterma $ $Id: $ $HeadURL: $ =cut SOAP-WSDL-2.00.10/lib/SOAP/WSDL/Server/Simple.pm0000444000175000017500000001022511203370730017641 0ustar martinmartinpackage SOAP::WSDL::Server::Simple; use strict; use warnings; use Encode; use HTTP::Request; use HTTP::Response; use HTTP::Status; use HTTP::Headers; use Scalar::Util qw(blessed); use Class::Std::Fast::Storable; use base qw(SOAP::WSDL::Server); use version; our $VERSION = qv('2.00.10'); # mostly copied from SOAP::Lite. Unfortunately we can't use SOAP::Lite's CGI # server directly - we would have to swap out it's base class... # # This should be a warning for us: We should not handle methods via inheritance, # but via some plugin mechanism, to allow alternative handlers to be plugged # in. sub handle { my ($self, $cgi) = @_; my $response; my $content = $cgi->param('POSTDATA'); my $request = HTTP::Request->new( $ENV{'REQUEST_METHOD'} || '' => $ENV{'SCRIPT_NAME'}, HTTP::Headers->new( map { (/^HTTP_(.+)/i ? ($1=~m/SOAPACTION/) ?('SOAPAction') :($1) : $_ ) => $ENV{$_} } keys %ENV), $content, ); # we copy the response message around here. # Passing by reference would be much better... my $response_message = eval { $self->SUPER::handle($request) }; # caveat: SOAP::WSDL::SOAP::Typelib::Fault11 is false in bool context... if ($@ || blessed $@) { my $exception = $@; $response = HTTP::Response->new(500); $response->header('Content-type' => 'text/xml; charset="utf-8"'); if (blessed($exception)) { $response->content( $self->get_serializer->serialize({ body => $exception }) ); } else { $response->content($exception); } } else { $response = HTTP::Response->new(200); $response->header('Content-type' => 'text/xml; charset="utf-8"'); $response->content( encode('utf8', $response_message ) ); { use bytes; $response->header('Content-length', length $response_message); } } $self->_output($response); return; } sub _output :PRIVATE { my ($self, $response) = @_; my $code = $response->code; binmode(STDOUT); print STDOUT "HTTP/1.0 $code ", HTTP::Status::status_message($code) , "\015\012", $response->headers_as_string("\015\012") , "\015\012", $response->content; warn "HTTP/1.0 $code ", HTTP::Status::status_message($code) , "\015\012", $response->headers_as_string("\015\012") , $response->content, "\n\n"; } 1; =pod =head1 NAME SOAP::WSDL::Server::Simple - CGI based SOAP server for HTTP::Server::Simple =head1 SYNOPSIS package TestServer; use base qw(HTTP::Server::Simple::CGI); use MyServer::TestService::TestPort; sub handle_request { my ($self, $cgi) = @_; my $server = MyServer::TestService::TestPort->new({ dispatch_to => 'main', transport_class => 'SOAP::WSDL::Server::Simple', }); $server->handle($cgi); } my $httpd = __PACKAGE__->new(); $httpd->run(); =head1 USAGE To use SOAP::WSDL::Server::Simple efficiently, you should first create a server interface using L. SOAP::WSDL::Server::Simple dispatches all calls to appropriately named methods in the class or object set via C. See the generated server class on details. =head1 DESCRIPTION Lightweight SOAP server for use with HTTP::Server::Simple, mainly designed for testing purposes. It allows to set up a simple SOAP server without having to configure CGI or mod_perl stuff. SOAP::WSDL::Server::Simple is not recommended for production use. =head1 METHODS =head2 handle See synopsis above. =head1 LICENSE AND COPYRIGHT Copyright 2004-2008 Martin Kutter. This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself =head1 AUTHOR Martin Kutter Emartin.kutter fen-net.deE =head1 REPOSITORY INFORMATION $Rev: 391 $ $LastChangedBy: kutterma $ $Id: Client.pm 391 2007-11-17 21:56:13Z kutterma $ $HeadURL: https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Client.pm $ =cut SOAP-WSDL-2.00.10/lib/SOAP/WSDL/Server/CGI.pm0000444000175000017500000001062111203370730017012 0ustar martinmartinpackage SOAP::WSDL::Server::CGI; use strict; use warnings; use Encode; use HTTP::Request; use HTTP::Response; use HTTP::Status; use HTTP::Headers; use Scalar::Util qw(blessed); use Class::Std::Fast::Storable; use base qw(SOAP::WSDL::Server); use version; our $VERSION = qv('2.00.10'); # mostly copied from SOAP::Lite. Unfortunately we can't use SOAP::Lite's CGI # server directly - we would have to swap out it's base class... # # This should be a warning for us: We should not handle methods via inheritance, # but via some plugin mechanism, to allow alternative handlers to be plugged # in. sub handle { my $self = shift; my $response; my $length = $ENV{'CONTENT_LENGTH'} || 0; if (!$length) { $response = HTTP::Response->new(411); # LENGTH REQUIRED $self->_output($response); return; } if (exists $ENV{EXPECT} && $ENV{EXPECT} =~ /\b100-Continue\b/i) { print "HTTP/1.1 100 Continue\r\n\r\n"; } my $content = q{}; my $buffer; # do we need to use bytes; here ? binmode(STDIN); while (read(STDIN,$buffer,$length - length($content))) { $content .= $buffer; } my $request = HTTP::Request->new( $ENV{'REQUEST_METHOD'} || '' => $ENV{'SCRIPT_NAME'}, HTTP::Headers->new( map { (/^HTTP_(.+)/i ? ($1=~m/SOAPACTION/) ?('SOAPAction') :($1) : $_ ) => $ENV{$_} } keys %ENV), $content, ); # we copy the response message around here. # Passing by reference would be much better... my $response_message = eval { $self->SUPER::handle($request) }; # caveat: SOAP::WSDL::SOAP::Typelib::Fault11 is false in bool context... if ($@ || blessed $@) { my $exception = $@; $response = HTTP::Response->new(500); $response->header('Content-type' => 'text/xml; charset="utf-8"'); if (blessed($exception)) { $response->content( $self->get_serializer->serialize({ body => $exception }) ); } else { $response->content($exception); } } else { $response = HTTP::Response->new(200); $response->header('Content-type' => 'text/xml; charset="utf-8"'); $response->content( encode('utf8', $response_message ) ); { use bytes; $response->header('Content-length', length $response_message); } } $self->_output($response); return; } sub _output :PRIVATE { my ($self, $response) = @_; # imitate nph- cgi for IIS (pointed by Murray Nesbitt) my $status = defined($ENV{'SERVER_SOFTWARE'}) && $ENV{'SERVER_SOFTWARE'}=~/IIS/ ? $ENV{SERVER_PROTOCOL} || 'HTTP/1.0' : 'Status:'; my $code = $response->code; binmode(STDOUT); print STDOUT "$status $code ", HTTP::Status::status_message($code) , "\015\012", $response->headers_as_string("\015\012") , "\015\012", $response->content; } 1; =pod =head1 NAME SOAP::WSDL::Server::CGI - CGI based SOAP server =head1 SYNOPSIS use MyServer::TestService::TestPort; my $server = MyServer::TestService::TestPort->new({ dispatch_to => 'main', transport_class => 'SOAP::WSDL::Server::CGI', # optional, default }); $server->handle(); =head1 USAGE To use SOAP::WSDL::Server::CGI efficiently, you should first create a server interface using L. SOAP::WSDL::Server dispatches all calls to appropriately named methods in the class or object set via C. See the generated server class on details. =head1 DESCRIPTION Lightweight CGI based SOAP server. SOAP::WSDL::Server::CGI does not provide the fancier things of CGI handling, like URL parsing, parameter extraction or the like, but provides a basic SOAP server using SOAP::WSDL::Server. =head1 METHODS =head2 handle See synopsis above. =head1 LICENSE AND COPYRIGHT Copyright 2004-2008 Martin Kutter. This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself =head1 AUTHOR Martin Kutter Emartin.kutter fen-net.deE =head1 REPOSITORY INFORMATION $Rev: 391 $ $LastChangedBy: kutterma $ $Id: Client.pm 391 2007-11-17 21:56:13Z kutterma $ $HeadURL: https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Client.pm $ =cut SOAP-WSDL-2.00.10/lib/SOAP/WSDL/Message.pm0000444000175000017500000000032411203370730016525 0ustar martinmartinpackage SOAP::WSDL::Message; use strict; use warnings; use Class::Std::Fast::Storable; use base qw(SOAP::WSDL::Base); use version; our $VERSION = qv('2.00.10'); my %part_of :ATTR(:name :default<[]>); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/Manual/0000755000175000017500000000000011203370730016023 5ustar martinmartinSOAP-WSDL-2.00.10/lib/SOAP/WSDL/Manual/Cookbook.pod0000444000175000017500000002172111203370730020276 0ustar martinmartin=pod =head1 NAME SOAP::WSDL::Manual::Cookbook - SOAP::WSDL recipes =head2 Accessing HTTPS webservices You need Crypt::SSLeay installed to access HTTPS webservices. =head2 Accessing protected web services Passing a username and password, or a client certificate and key, to the transport layer is highly dependent on the transport backend. The descriptions below are for HTTP(S) transport using LWP::UserAgent =head3 Accessing HTTP(S) webservices with basic/digest authentication When using SOAP::WSDL::Transport::HTTP (SOAP::Lite not installed), add a method called "get_basic_credentials" to SOAP::WSDL::Transport::HTTP: *SOAP::WSDL::Transport::HTTP::get_basic_credentials = sub { return ($user, $password); }; When using SOAP::Transport::HTTP (SOAP::Lite is installed), do the same to this backend: *SOAP::Transport::HTTP::Client::get_basic_credentials = sub { return ($user, $password); }; =head3 Accessing HTTP(S) webservices protected by NTLM authentication If you want to connect to a windows server using some Windows Domain Login, please consider using Kerberos instead of the (older) NTLM mechanism - see below. Kerberos and NTLM are (currently) mutually exclusive - when LWP::Authen::Negotiate is installed, it will always be queried (and will always raise an error), even if you don't want to use it. See http://rt.cpan.org/Public/Bug/Display.html?id=32826 for details. You need the L distribution installed to access webservices protected by NTLM authentication. More specifically, you need the Authen::NTLM module from this distribution. Note that this is different from the Authen::NTML distribution by Yee Man Chan also available from CPAN. Your user credentials usually need to include the windows domain or the windows hostname like this: testdomain\testuser or \\testhost\testuser Besides passing user credentials as when accessing a web service protected by basic or digest authentication, you also need to enforce connection keep_alive on the transport backens. To do so, pass a I argument to the new() method of the generated class. This unfortunately means that you have to set the endpoint URL, too: my $interface = MyInterfaces::SERVICE_NAME::PORT_NAME->new({ proxy => [ $url, keep_alive => 1 ] }); You may, of course, decide to just hack the generated class. Be advised that subclassing might be a more appropriate solution - re-generating overwrites changes in interface classes. =head3 Accessing HTTP(S) webservices protected by NTLMv2 There are different variants of NTLM, and by default Authen::NTLM uses the v1 variant. NTLM is a connection-based handshake authentication protocol, which requires three or more requests on the same connection: Request POST Response 401 Unauthorized WWW-Authenticate: NTLM Request Authorization: NTLM Response 401 Unauthorized WWW-Authenticate: NTLM Request Authorization: NTLM Response 200 Ok If you try to access a NTLMv2 protected web service and switch on LWP::Debug by saying use LWP::Debug qw(+); you should see at least two lines containing something like Authorization NTLM TlRMTVNTUAABAAAAB7IAAAAAAAAAAAAAAwADACAAAABmb28= ... Authorization NTLM TlRMTVNTUAABAAAAB7IAAAAAAAAAAAAAAw ... much longer ... ADACAAAABmb28= If you're talking to a Server using NTLMv2 exclusively, you will only the first line in the debug output, and then an error. To explicitely enable NTLMv2, do the following in your client: use Authen::NTLM; ntlmv2(1); This globally enables the use of NTLMv2. Note that this is a global setting: All clients running in the same perl interpreter will be affected. This can cause unexpected issues when running under mod_perl. =head3 Accessing webservices protected by HTTP Kerberos Authentication Use the L plugin from CPAN. You need to set up GSSAPI to perform the Kerberos authentication, though. How to do this is implementation specific (MIT or Heimdahl). See your Kerberos/GSSAPI documentation for details. (Newer) Windows Web Services usually allow to use both the Negotiate (Kerberos) and NTLM authentication scheme. =head3 Accessing HTTPS webservices protected by certificate authentication You need Crypt::SSLeay installed to access HTTPS webservices. See L on how to configure client certificate authentication. =head1 XML OUTPUT =head2 Outputting namespaces as prefixes Q: I need to interface with a SOAP server which doesn't accept the following format: 12345 Instead, it requires this: 12345 How do I do this using SOAP::WSDL? A: The following steps are neccessary to achieve this result: First, you would need to write a new serializer, which is quite easy, as it just creates the envelope and calls ->serialize_qualified() on $header and $body to fill them in. The new serializer has to declare all namespace prefixes used, the rest is just the same as the original XSD serializer. Second, you'd need to overwrite the start_tag method in L to use the appropriate prefixes for the body elements. In contrast to the original method, it would probably look up the appropriate prefix from some data set in the serializer class, so this could be the appropriate place to load SOAP::WSDL::XSD::Typelib::Element and override the method. Something like this should do (without the handling of specialties like empty or nil elements): %PREFIX_OF = { 'http://services.company.com/' => 'ns2' }; *SOAP::WSDL::XSD::Typelib::Element::start_tag = sub { # use prefix instead of xmlns attribute and copy the rest from # SOAP::WSDL::XSD::Typelib::Element::start_tag my $prefix = $PREFIX_OF{ $_[0]->get_xmlns() }; my $name = $_[1]->{ name } || $self->__get_name(); return "<$prefix:$name>"; } =head1 Skipping unknown XML elements - "lax" XML processing SOAP::WSDL's default serializer L is a "strict" XML processor in the sense that it throws an exception on encountering unknown XML elements. L allows switching off the stric XML processing by passing the C 0> option. =head2 Disabling strict XML processing in a Client Pass the following as C: { strict => 0 } Example: The generated SOAP client is assumed to be "MyInterface::Test". use MyInterface::Test; my $soap = MyInterface::Test->new({ deserializer_args => { strict => 0 } }); my $result = $soap->SomeMethod(); =head2 Disabling strict XML processing in a CGI based server You have to set the deserializer in the transport class explicitely to a L object with the C option set to 0. Example: The generated SOAP server is assumed to be "MyServer::Test". use strict; use MyServer::Test; use SOAP::WSDL::Deserializer::XSD; my $soap = MyServer::Test->new({ transport_class => 'SOAP::WSDL::Server::CGI', dispatch_to => 'main', }); $soap->get_transport()->set_deserializer( SOAP::WSDL::Deserializer::XSD->new({ strict => 0 }) ); $soap->handle(); =head2 Disabling strict XML processing in a mod_perl based server Sorry, this is not implemented yet - you'll have to write your own handler class based on L. =head1 Changing the encoding of a SOAP request SOAP::WSDL uses utf-8 per default: utf-8 is the de-facto standard for webservice ommunication. However, you can change the encoding the transport layer announces by calling C on a client object. You probably have to write your own serializer class too, because the default serializer has the utf-8 encoding hardcoded in the envelope. Just look into SOAP::WSDL::Serializer on how to do that. Don't forget to register your serializer at the serializer factory SOAP::WSDL::Factory::Serializer. =head1 LICENSE AND COPYRIGHT Copyright 2008, 2009 Martin Kutter. This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself. =head1 AUTHOR Martin Kutter Emartin.kutter fen-net.deE =head1 REPOSITORY INFORMATION $Rev: 583 $ $LastChangedBy: kutterma $ $Id: $ $HeadURL: $ =cut SOAP-WSDL-2.00.10/lib/SOAP/WSDL/Manual/WS_I.pod0000444000175000017500000011042311203370730017327 0ustar martinmartin=pod =head1 NAME SOAP::WSDL::Manual::WS_I - How SOAP::WSDL complies to WS-I Basic Profile 1.0 =head1 DESCRIPTION This document gives an overview about how SOAP::WSDL confirms to the rules of the WS-I Basic Profile 1.0 found at L Errata are not yet worked in. You may find rules mis-categorized, especially in the "not applicable" section. Such mis-categorizations are documentation bugs, please feel free to report them. Rules are categorized into the following sections: =over =item * RULES CONFIRMED This section contains rules SOAP::WSDL follows. Conformance to these rules may be assured by a test. =item * RULES NOT CONFIRMED This section contains rules SOAP::WSDL does not follow yet. These may be considered as bugs. =item * RULES NOT APPLICABLE WS-I Basic Profile contains rules for web services as a whole. SOAP::WSDL only plays the part of one layer in a Web Service CONSUMER / RECEIVER, thus does not implement some parts the WS-I Basic Profile references. This section contains rules not applicable for SOAP::WSDL, because they refer to parts SOAP::WSDL does not implement. =back =head1 RULES CONFIRMED =head2 R1005 A MESSAGE MUST NOT contain soap:encodingStyle attributes on any of the elements whose namespace name is "http://schemas.xmlsoap.org/soap/envelope/". SOAP::WSDL::Serializer::SOAP11 does not add soap:encodingStyle attributes on any element. =head2 R1006 A MESSAGE MUST NOT contain soap:encodingStyle attributes on any element that is a child of soap:Body. SOAP::WSDL::Serializer::SOAP11 does not add soap:encodingStyle attributes on any element. =head2 R1008 A MESSAGE MUST NOT contain a Document Type Declaration. SOAP::WSDL::Serializer::SOAP11 does not add DTDs. =head2 R1009 A MESSAGE MUST NOT contain Processing Instructions. SOAP::WSDL::Serializer::SOAP11 does not add Processing Instructions =head2 R1010 A RECEIVER MUST accept messages that contain an XML Declaration. SOAP::WSDL::Expat::MessageParser allows the use of XML Declarations. =head2 R1011 A MESSAGE MUST NOT have any element children of soap:Envelope following the soap:Body element. SOAP::WSDL::Serializer::SOAP11 does not emit children of soap:Envelope following the soap:Body element. Other serializers may behave different. =head2 R1012 A MESSAGE MUST be serialized as either UTF-8 or UTF-16. SOAP::WSDL::Serializer::SOAP11 serializes messages as UTF-8. =head2 R1018 The media type of a MESSAGE's envelope MUST indicate the correct character encoding, using the charset parameter. SOAP::WSDL::Transport::HTTP sets the Content-type header to "text/xml; charset=utf8". SOAP::Transport does, too. Other transport backends may behave different. =head2 R1014 The children of the soap:Body element in a MESSAGE MUST be namespace qualified. SOAP::WSDL::Serializer::SOAP11 emits namespace-qualified child elements of the soap:Body element. =head2 R1017 A RECEIVER MUST NOT mandate the use of the xsi:type attribute in messages except as required in order to indicate a derived type (see XML Schema Part 1: Structures, Section 2.6.1). SOAP::WSDL::Expat::MessageParser does not require the use of xsi:type attributes, but uses typemaps instead. Other deserializers may not comply to this rule. =head2 R1028 When a Fault is generated by a RECEIVER, further processing SHOULD NOT be performed on the SOAP message aside from that which is necessary to rollback, or compensate for, any effects of processing the message prior to the generation of the Fault. A fault is generated when an error occurs processing the message. SOAP::WSDL::Deserializer::SOAP11 does not perform any additional processing after an error occured. =head2 R1029 Where the normal outcome of processing a SOAP message would have resulted in the transmission of a SOAP response, but rather a SOAP Fault is generated instead, a RECEIVER MUST transmit a SOAP Fault message in place of the response. A fault is generated when an error occurs processing the message. =head2 R1030 A RECEIVER that generates a SOAP Fault SHOULD notify the end user that a SOAP Fault has been generated when practical, by whatever means is deemed appropriate to the circumstance. Via return value. =head2 R1140 A MESSAGE SHOULD be sent using HTTP/1.1. SOAP::WSDL::Transport::HTTP uses HTTP/1.1 =head2 R1141 A MESSAGE MUST be sent using either HTTP/1.1 or HTTP/1.0. SOAP::WSDL::Transport::HTTP uses HTTP/1.1 =head2 R1107 A RECEIVER MUST interpret SOAP messages containing only a soap:Fault element as a Fault. SOAP::WSDL::Deserializer::SOAP11 does this. =head2 R1132 A HTTP request MESSAGE MUST use the HTTP POST method. Both SOAP::WSDL::Transport::HTTP and SOAP::Transport::HTTP use POST. =head2 R1108 A MESSAGE MUST NOT use the HTTP Extension Framework (RFC2774). SOAP::WSDL::Transport::HTTP does not use the HTTP Extension framework, however SOAP::Transport::HTTP use M-POST if POST was not successful. To be sure you comply to this rule, use SOAP::WSDL::Transport::HTTP as transport backend. =head2 R1109 The value of the SOAPAction HTTP header field in a HTTP request MESSAGE MUST be a quoted string. SOAP::WSDL::Client always quotes the SOAPAction header. =head2 R1119 A RECEIVER MAY respond with a Fault if the value of the SOAPAction HTTP header field is not quoted. SOAP::WSDL does not apply any processing on the SOAPAction header field. =head2 R1131 A CONSUMER MAY automatically redirect a request when it encounters a "307 Temporary Redirect" HTTP status code in a response. LWP::UserAgent (used by SOAP::WSDL::Transport::HTTP and SOAP::Transport::HTTP) accepts up to 7 levels of redirect by default. =head2 R2113 A MESSAGE containing serialized arrays MUST NOT include the soapenc:arrayType attribute. SOAP::WSDL does not natively support soapenc::arrayType. =head2 R2114 The target namespace for WSDL definitions and the target namespace for schema definitions in a DESCRIPTION MAY be the same. SOAP::WSDL does not impose any constraints on the target namespace for WSDL definitions or schema definitions. =head2 R2301 The order of the elements in the soap:body of a MESSAGE MUST be the same as that of the wsdl:parts in the wsdl:message that describes it. SOAP::WSDL obeys the part order. =head2 R2712 A document-literal binding MUST be represented on the wire as a MESSAGE with a soap:Body whose child element is an instance of the global element declaration referenced by the corresponding wsdl:message part. If defined accordingly in the DESCRIPTION, SOAP::WSDL issues document-literal binding operation MESSAGES conforming to this rule. =head2 R2748 A CONSUMER MUST NOT interpret the presence of the wsdl:required attribute on a soapbind extension element with a value of "false" to mean the extension element is optional in the messages generated from the WSDL description. SOAP::WSDL does not imterpret the wsdl:required attribute at all. =head2 R5000 An INSTANCE MAY require the use of HTTPS. SOAP::WSDL supports https. =head2 R5010 An INSTANCE MAY require the use of HTTPS with mutual authentication. SOAP::WSDL supports all kinds of authentication known to LWP::UserAgent =head2 R2742 A MESSAGE MAY contain a fault detail entry in a SOAP fault that is not described by a wsdl:fault element in the corresponding WSDL description. SOAP::WSDL does not emit such faults. Such faults can be processed by adding custom maps to the type maps for SOAP::WSDL::Expat::MessageParser. =head2 R2744 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field with a quoted value equal to the value of the soapAction attribute of soapbind:operation, if present in the corresponding WSDL description. SOAP::WSDL uses the soapAction attribute from soapbind:operation as SOAPAction header in generated code. Alternative WSDL parsers / code generator have to assure they pass the correct soap_action to SOAP::WSDL::Client. The interpreting SOAP::WSDL client does not conform to this rule, but "guesses" the SOAPAction header from the operation name and the top node's namespace. =head2 R2745 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field with a quoted empty string value, if in the corresponding WSDL description, the soapAction of soapbind:operation is either not present, or present with an empty string as its value. SOAP::WSDL::Client always assures the SOAPaction header is quoted, thus automatically inserts the empty string if no SOAPAction header is defined. =head2 R1015 A RECEIVER MUST generate a fault if they encounter a message whose document element has a local name of "Envelope" but a namespace name that is not "http://schemas.xmlsoap.org/soap/envelope/". SOAP::WSDL::Expat::MessageParser checks the namespace of the SOAP envelope. SOAP::WSDL::Expat::MessageParser does not check that Envelope is the root element, yet. =head2 R1110 An INSTANCE MAY accept connections on TCP port 80 (HTTP) SOAP::WSDL::Server::CGI may be used in a web server listening at port 80. =head2 R1124 An INSTANCE MUST use a 2xx HTTP status code for responses that indicate a successful outcome of a request. SOAP::WSDL::Server::CGI sends a 2xx HTTP status code for successful requests. =head2 R1111 An INSTANCE SHOULD use a "200 OK" HTTP status code for responses that contain a SOAP message that is not a SOAP fault. SOAP::WSDL::Server::CGI does this. =head2 R1112 An INSTANCE SHOULD use either a "200 OK" or "202 Accepted" HTTP status code for a response that does do not contain a SOAP message but indicates successful HTTP outcome of a request. SOAP::WSDL::Server::CGI does this. =head2 R1130 An INSTANCE MUST use HTTP status code "307 Temporary Redirect" when redirecting a request to a different endpoint. SOAP::WSDL::Server::CGI has no means of redirecting. The web server running a SOAP::WSDL::Server::CGI script is responsible for redirecting with a 307 HTTP status code. =head2 R1125 An INSTANCE MUST use a 4xx HTTP status code for responses that indicate a problem with the format of the request. SOAP::WSDL does this. =head2 R1113 An INSTANCE SHOULD use a "400 Bad Request "HTTP status code, if the request message is a malformed HTTP request, or not well-formed XML. SOAP::WSDL does this. =head2 R1114 An INSTANCE SHOULD use a "405 Method not Allowed" HTTP status code if the request method was not "POST". SOAP::WSDL does this. =head2 R1115 An INSTANCE SHOULD use a "415 Unsupported Media Type" HTTP status code if the Content-Type HTTP request header did not have a value consistent with the value specified for the corresponding binding of the input message. SOAP::WSDL::Server::CGI does not support any content type other than text/xml and application/xml yet. =head1 RULES NOT CONFIRMED =head2 R4001 A RECEIVER MUST accept messages that include the Unicode Byte Order Mark (BOM). May automatically work with XML::Parser::Expat, but is not tested yet. TODO write test. If not confirmed, add encoding support. =head2 R1002 A RECEIVER MUST accept fault messages that have any number of elements, including zero, appearing as children of the detail element. Such children can be qualified or unqualified. Partially confirmed: This only works when the fault detail elements are added to the deserializer's typemap. TODO add processing of arbitrary content of faults to SOAP::WSDL::Expat::MessageParser =head2 R1003 A RECEIVER MUST accept fault messages that have any number of qualified or unqualified attributes, including zero, appearing on the detail element. The namespace of qualified attributes can be anything other than "http://schemas.xmlsoap.org/soap/envelope/". TODO add processing of arbitrary attributes to SOAP::WSDL::SOAP::Typelib::Fault11 =head2 R1016 A RECEIVER MUST accept fault messages that carry an xml:lang attribute on the faultstring element. SOAP::WSDL::Expat::MessageParser currently ignores all attributes. TODO add processing of the xml:lang attribute to SOAP::WSDL::SOAP::Typelib::Fault11 =head2 R1007 A MESSAGE described in an rpc-literal binding MUST NOT contain soap:encodingStyle attribute on any elements are grandchildren of soap:Body. SOAP::WSDL::Serializer::SOAP11 does not add soap:encodingStyle attributes on any element. However, rpc-literal bindings are not supported, yet. TODO support rpc-literal bindings. =head2 R2008 In a DESCRIPTION the value of the location attribute of a wsdl:import element SHOULD be treated as a hint. The wsdl:import element imports the referenced WSDL definition. This is rather hard-wired and does not allow to specify a wsdl:import without a resolvable location in SOAP::WSDL. =head2 R4002 A DESCRIPTION MAY include the Unicode Byte Order Mark (BOM). TODO Test. =head2 R4003 A DESCRIPTION MUST use either UTF-8 or UTF-16 encoding. TODO Test whether UTF-16 works. =head2 R2020 The wsdl:documentation element MAY occur as a child of the wsdl:import element in a DESCRIPTION. Not tested yet. =head2 R2024 The wsdl:documentation element MAY occur as a first child of the wsdl:definitions element in a DESCRIPTION. TODO Test. =head2 R2027 If during the processing of an element in the WSDL namespace in a description, a consumer encounters a WSDL extension element amongst its element children, that has a wsdl:required attribute with a boolean value of "true" that the consumer does not understand or cannot process, the CONSUMER MUST fail processing of that element in the WSDL namespace. TODO Implement support for wsdl:required =head2 R2750 A CONSUMER MUST ignore a SOAP response carried in a response from a one-way operation. SOAP::WSDL does not ignore the SOAP response from a one way operation yet. TODO Define operation type signature, and ignore result from one way operations. =head2 R2747 A CONSUMER MUST understand and process all WSDL 1.1 SOAP Binding extension elements, irrespective of the presence or absence of the wsdl:required attribute on an extension element; and irrespective of the value of the wsdl:required attribute, when present. SOAP::WSDL does not implement all WSDL 1.1 SOAP Binding extension yet. TODO check and implement. =head2 R2800 A DESCRIPTION MAY use any construct from XML Schema 1.0. SOAP::WSDL's WSDL parser doen not allow all contructs from XML Schema 1.0 to be used. TODO become "minimal conformant". =head1 RULES NOT APPLICABLE =head2 R0004 A MESSAGE MAY contain conformance claims, as specified in the conformance claim schema. SOAP::WSDL::Serializer::SOAP11 does not add conformance claims. Other serializers may act different. =head2 R0005 A MESSAGE's conformance claims MUST be carried as SOAP header blocks. SOAP::WSDL::Serializer::SOAP11 does not add conformance claims. Other serializers may act different. =head2 R0006 A MESSAGE MAY contain conformance claims for more than one profile. SOAP::WSDL::Serializer::SOAP11 does not add conformance claims. Other serializers may act different. =head2 R0007 A SENDER MUST NOT use the soap:mustUnderstand attribute when sending a SOAP header block containing a conformance claim. SOAP::WSDL::Serializer::SOAP11 does not add conformance claims. Other serializers may act different. =head2 R3020 REGDATA of type uddi:tModel claiming conformance with a Profile MUST be categorized using the ws-i-org:conformsTo:2002_12 taxonomy. SOAP::WSDL does not publish web services yet. =head2 R3030 REGDATA of type uddi:tModel claiming conformance with a Profile MUST use the ws-i-org:conformsTo:2002_12 categorization value corresponding to the conformance claim URI for that Profile. SOAP::WSDL does not publish web services yet. =head2 R3021 A REGISTRY MUST support the WS-I Conformance category system by adding the ws-i-org:conformsTo:2002_12 tModel definition to its registry content. SOAP::WSDL does not publish web services yet. =head2 R3005 REGDATA other than uddi:tModel elements representing conformant Web service types MUST NOT be categorized using the ws-i-org:conformsTo:2002_12 taxonomy and a categorization of "http://ws-i.org/profiles/basic/1.0". SOAP::WSDL does not publish web services yet. =head2 R3004 REGDATA of type uddi:tModel MUST be constructed so that the conformance claim it makes is consistent with the conformance claim made by the wsdl:binding to which it refers. SOAP::WSDL does not publish web services yet. =head2 R1000 When a MESSAGE contains a soap:Fault element, that element MUST NOT have element children other than faultcode, faultstring, faultactor and detail. SOAP::WSDL does not send fault messages. However, SOAP::WSDL::SOAP::Typelib::Fault11 complies to this rule. =head2 R1001 When a MESSAGE contains a soap:Fault element its element children MUST be unqualified. SOAP::WSDL does not send fault messages. However, SOAP::WSDL::SOAP::Typelib::Fault11 complies to this rule. =head2 R1004 When a MESSAGE contains a faultcode element the content of that element SHOULD be one of the fault codes defined in SOAP 1.1 or a namespace qualified fault code. SOAP::WSDL does not send fault messages. However, the fault issued by SOAP::WSDL::Deserializer comply to this rule. =head2 R1031 When a MESSAGE contains a faultcode element the content of that element SHOULD NOT use of the SOAP 1.1 "dot" notation to refine the meaning of the Fault. SOAP::WSDL does not send fault messages. However, the fault issued by SOAP::WSDL::Deserializer comply to this rule. =head2 R1013 A MESSAGE containing a soap:mustUnderstand attribute MUST only use the lexical forms "0" and "1". SOAP::WSDL does not add soap:mustUnderstand attributes. =head2 R1025 A RECEIVER MUST handle messages in such a way that it appears that all checking of mandatory header blocks is performed before any actual processing. SOAP::WSDL does not check mandatory header blocks yet. =head2 R1027 A RECEIVER MUST generate a "soap:MustUnderstand" fault when a message contains a mandatory header block (i.e., one that has a soap:mustUnderstand attribute with the value "1") targeted at the receiver (via soap:actor) that the receiver does not understand. SOAP::WSDL does not check mandatory header blocks yet. =head2 R1120 An INSTANCE MAY use the HTTP state mechanism ("Cookies"). SOAP::WSDL::Server::CGI does not use cookies. A web server running a SOAP::WSDL::Server::CGI script may use cookies.. =head2 R1122 An INSTANCE using Cookies SHOULD conform to RFC2965. SOAP::WSDL::Server::CGI does not use cookies. A web server running a SOAP::WSDL::Server::CGI script may use cookies.. =head2 R1121 An INSTANCE SHOULD NOT require consumer support for Cookies in order to function correctly SOAP::WSDL::Server::CGI does not use cookies. A web server running a SOAP::WSDL::Server::CGI script may use cookies. =head2 R1123 The value of the cookie MUST be considered to be opaque by the CONSUMER. SOAP::WSDL::Server::CGI does not use cookies. A web server running a SOAP::WSDL::Server::CGI script may use cookies. =head2 R2028 A DESCRIPTION using the WSDL namespace (prefixed "wsdl" in this Profile) MUST be valid according to the XML Schema found at "http://schemas.xmlsoap.org/wsdl/2003-02-11.xsd". See 2029. =head2 R2029 A DESCRIPTION using the WSDL SOAP binding namespace (prefixed "soapbind" in this Profile) MUST be valid according to the XML Schema found at "http://schemas.xmlsoap.org/wsdl/soap/2003-02-11.xsd". Although the Profile requires WSDL descriptions to be Schema valid, it does not require consumers to validate WSDL documents. It is the responsibility of a WSDL document's author to assure that it is Schema valid. =head2 R2001 A DESCRIPTION MUST only use the WSDL "import" statement to import another WSDL description. SOAP::WSDL (partially) supports the wsdl:import statement. The wsdl:include statement is not supported. It's the responsibility of the WSDL author to use only the wsdl:import statement for importing WSDL descriptions. =head2 R2002 To import XML Schema Definitions, a DESCRIPTION MUST use the XML Schema "import" statement. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2003 A DESCRIPTION MUST use the XML Schema "import" statement only within the xsd:schema element of the types section. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2004 A DESCRIPTION MUST NOT use the XML Schema "import" statement to import a Schema from any document whose root element is not "schema" from the namespace "http://www.w3.org/2001/XMLSchema". SOAP::WSDL has no means of generating WSDL definitions. =head2 R2009 An XML Schema directly or indirectly imported by a DESCRIPTION MAY include the Unicode Byte Order Mark (BOM). SOAP::WSDL has no means of generating WSDL definitions. =head2 R2010 An XML Schema directly or indirectly imported by a DESCRIPTION MUST use either UTF-8 or UTF-16 encoding. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2011 An XML Schema directly or indirectly imported by a DESCRIPTION MUST use version 1.0 of the eXtensible Markup Language W3C Recommendation. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2007 A DESCRIPTION MUST specify a non-empty location attribute on the wsdl:import element. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2022 When they appear in a DESCRIPTION, wsdl:import elements MUST precede all other elements from the WSDL namespace except wsdl:documentation. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2023 When they appear in a DESCRIPTION, wsdl:types elements MUST precede all other elements from the WSDL namespace except wsdl:documentation and wsdl:import. SOAP::WSDL has no means of generating WSDL definitions. =head2 R4004 A DESCRIPTION MUST use version 1.0 of the eXtensible Markup Language W3C Recommendation. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2005 The targetNamespace attribute on the wsdl:definitions element of a description that is being imported MUST have same the value as the namespace attribute on the wsdl:import element in the importing DESCRIPTION. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2021 The wsdl:documentation element MAY occur as a child of the wsdl:part element in a DESCRIPTION. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2025 A DESCRIPTION containing WSDL extensions MUST NOT use them to contradict other requirements of the Profile. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2026 A DESCRIPTION SHOULD NOT include extension elements with a wsdl:required attribute value of "true" on any WSDL construct (wsdl:binding, wsdl:portType, wsdl:message, wsdl:types or wsdl:import) that claims conformance to the Profile. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2101 A DESCRIPTION MUST NOT use QName references to elements in namespaces that have been neither imported, nor defined in the referring WSDL document. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2102 A QName reference to a Schema component in a DESCRIPTION MUST use the namespace defined in the targetNamespace attribute on the xsd:schema element, or to a namespace defined in the namespace attribute on an xsd:import element within the xsd:schema element. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2105 All xsd:schema elements contained in a wsdl:types element of a DESCRIPTION MUST have a targetNamespace attribute with a valid and non-null value, UNLESS the xsd:schema element has xsd:import and/or xsd:annotation as its only child element(s). SOAP::WSDL has no means of generating WSDL definitions. =head2 R2110 In a DESCRIPTION, array declarations MUST NOT extend or restrict the soapenc:Array type. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2111 In a DESCRIPTION, array declarations MUST NOT use wsdl:arrayType attribute in the type declaration. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2112 In a DESCRIPTION, array declaration wrapper elements SHOULD NOT be named using the convention ArrayOfXXX. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2201 A document-literal binding in a DESCRIPTION MUST, in each of its soapbind:body element(s), have at most one part listed in the parts attribute, if the parts attribute is specified. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2210 If a document-literal binding in a DESCRIPTION does not specify the parts attribute on a soapbind:body element, the corresponding abstract wsdl:message MUST define zero or one wsdl:parts. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2202 A wsdl:binding in a DESCRIPTION MAY contain soapbind:body element(s) that specify that zero parts form the soap:Body. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2203 An rpc-literal binding in a DESCRIPTION MUST refer, in its soapbind:body element(s), only to wsdl:part element(s) that have been defined using the type attribute. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2211 A MESSAGE described with an rpc-literal binding MUST NOT have the xsi:nil attribute with a value of "1" or "true" on the part accessors. =head2 R2207 A wsdl:message in a DESCRIPTION MAY contain wsdl:parts that use the elements attribute provided those wsdl:parts are not referred to by a soapbind:body in an rpc-literal binding. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2204 A document-literal binding in a DESCRIPTION MUST refer, in each of its soapbind:body element(s), only to wsdl:part element(s) that have been defined using the element attribute. SOAP::WSDL has no means of generating WSDL definitions. Note: SOAP::WSDL requires that a DESCRIPTION confirms to these rules. =head2 R2208 A binding in a DESCRIPTION MAY contain soapbind:header element(s) that refer to wsdl:parts in the same wsdl:message that are referred to by its soapbind:body element(s). =head2 R2205 A wsdl:binding in a DESCRIPTION MUST refer, in each of its soapbind:header, soapbind:headerfault and soapbind:fault elements, only to wsdl:part element(s) that have been defined using the element attribute. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2209 A wsdl:binding in a DESCRIPTION SHOULD bind every wsdl:part of a wsdl:message in the wsdl:portType to which it refers to one of soapbind:body, soapbind:header, soapbind:fault or soapbind:headerfault. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2206 A wsdl:message in a DESCRIPTION containing a wsdl:part that uses the element attribute MUST refer, in that attribute, to a global element declaration. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2302 A DESCRIPTION MAY use the parameterOrder attribute of an wsdl:operation element to indicate the return value and method signatures as a hint to code generators. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2303 A DESCRIPTION MUST NOT use Solicit-Response and Notification type operations in a wsdl:portType definition. =head2 R2304 A wsdl:portType in a DESCRIPTION MUST have operations with distinct values for their name attributes. Note: SOAP::WSDL requires that a DESCRIPTION confirms to these rules. =head2 R2305 A wsdl:portType in a DESCRIPTION MUST be constructed so that the parameterOrder attribute, if present, omits at most 1 wsdl:part from the output message. =head2 R2306 A wsdl:message in a DESCRIPTION MUST NOT specify both type and element attributes on the same wsdl:part. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2401 A wsdl:binding element in a DESCRIPTION MUST use WSDL SOAP Binding as defined in WSDL 1.1 Section 3. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2701 The wsdl:binding element in a DESCRIPTION MUST be constructed so that its soapbind:binding child element specifies the transport attribute. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2702 A wsdl:binding element in a DESCRIPTION MUST specify the HTTP transport protocol with SOAP binding. Specifically, the transport attribute of its soapbind:binding child MUST have the value "http://schemas.xmlsoap.org/soap/http". SOAP::WSDL has no means of generating WSDL definitions. =head2 R2705 A wsdl:binding in a DESCRIPTION MUST use either be a rpc-literal binding or a document-literal binding. SOAP::WSDL has no means of generating WSDL definitions. Note: SOAP::WSDL does not support rpc-literal bindings yet. =head2 R2706 A wsdl:binding in a DESCRIPTION MUST use the value of "literal" for the use attribute in all soapbind:body, soapbind:fault, soapbind:header and soapbind:headerfault elements. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2707 A wsdl:binding in a DESCRIPTION that contains one or more soapbind:body, soapbind:fault, soapbind:header or soapbind:headerfault elements that do not specify the use attribute MUST be interpreted as though the value "literal" had been specified in each case. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2709 A wsdl:portType in a DESCRIPTION MAY have zero or more wsdl:bindings that refer to it, defined in the same or other WSDL documents. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2710 The operations in a wsdl:binding in a DESCRIPTION MUST result in wire signatures that are different from one another. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2711 A DESCRIPTION SHOULD NOT have more than one wsdl:port with the same value for the location attribute of the soapbind:address element. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2714 For one-way operations, an INSTANCE MUST NOT return a HTTP response that contains a SOAP envelope. Specifically, the HTTP response entity-body must be empty. SOAP::WSDL does not act as a server, yet. =head2 R2727 For one-way operations, a CONSUMER MUST NOT interpret a successful HTTP response status code (i.e., 2xx) to mean the message is valid or that the receiver would process it. SOAP::WSDL regards a successful HTTP status code for a one-way operation as an acknowledgement of the RECEIVER having receive (not processed!) the message. SOAP::WSDL makes no assumptions about the processing of SOAP messages, but higher level clients may do. =head2 R2716 A document-literal binding in a DESCRIPTION MUST NOT have the namespace attribute specified on contained soapbind:body, soapbind:header, soapbind:headerfault and soapbind:fault elements. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2717 An rpc-literal binding in a DESCRIPTION MUST have the namespace attribute specified, the value of which MUST be an absolute URI, on contained soapbind:body elements. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2726 An rpc-literal binding in a DESCRIPTION MUST NOT have the namespace attribute specified on contained soapbind:header, soapbind:headerfault and soapbind:fault elements. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2718 A wsdl:binding in a DESCRIPTION MUST have the same set of wsdl:operations as the wsdl:portType to which it refers SOAP::WSDL has no means of generating WSDL definitions. =head2 R2719 A wsdl:binding in a DESCRIPTION MAY contain no soapbind:headerfault elements if there are no known header faults. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2740 A wsdl:binding in a DESCRIPTION SHOULD contain a soapbind:fault describing each known fault. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2741 A wsdl:binding in a DESCRIPTION SHOULD contain a soapbind:headerfault describing each known header fault. SOAP::WSDL has no means of generating WSDL definitions. =head2 R2743 A MESSAGE MAY contain the details of a header processing related fault in a SOAP header block that is not described by a wsdl:headerfault element in the corresponding WSDL description. =head2 R2720 A wsdl:binding in a DESCRIPTION MUST use the attribute named part with a schema type of "NMTOKEN" on all contained soapbind:header and soapbind:headerfault elements. =head2 R2749 A wsdl:binding in a DESCRIPTION MUST NOT use the attribute named parts on contained soapbind:header and soapbind:headerfault elements. =head2 R2721 A wsdl:binding in a DESCRIPTION MUST have the name attribute specified on all contained soapbind:fault elements. =head2 R2754 In a DESCRIPTION, the value of the name attribute on a soapbind:fault element MUST match the value of the name attribute on its parent wsdl:fault element. =head2 R2722 A wsdl:binding in a DESCRIPTION MAY specify the use attribute on contained soapbind:fault elements. =head2 R2723 If in a wsdl:binding in a DESCRIPTION the use attribute on a contained soapbind:fault element is present, its value MUST be "literal". =head2 R2728 A wsdl:binding in a DESCRIPTION that omits the use attribute on a contained soapbind:fault element MUST be interpreted as though use="literal" had been specified. =head2 R2724 If an INSTANCE receives a message that is inconsistent with its WSDL description, it SHOULD generate a soap:Fault with a faultcode of "Client", unless a "MustUnderstand" or "VersionMismatch" fault is generated. =head2 R2725 If an INSTANCE receives a message that is inconsistent with its WSDL description, it MUST check for "VersionMismatch", "MustUnderstand" and "Client" fault conditions in that order. =head2 R2729 A MESSAGE described with an rpc-literal binding that is a response message MUST have a wrapper element whose name is the corresponding wsdl:operation name suffixed with the string "Response". =head2 R2735 A MESSAGE described with an rpc-literal binding MUST place the part accessor elements for parameters and return value in no namespace. =head2 R2737 A MESSAGE described with an rpc-literal binding MUST namespace qualify the children of part accessor elements for the parameters and the return value with the targetNamespace in which their types are defined. =head2 R2738 A MESSAGE MUST include all soapbind:headers specified on a wsdl:input or wsdl:output of a wsdl:operation of a wsdl:binding that describes it. =head2 R2739 A MESSAGE MAY contain SOAP header blocks that are not described in the wsdl:binding that describes it. =head2 R2753 A MESSAGE containing SOAP header blocks that are not described in the appropriate wsdl:binding MAY have the mustUnderstand attribute on such SOAP header blocks set to '1'. =head2 R2751 The order of soapbind:header elements in soapbind:binding sections of a DESCRIPTION MUST be considered independent of the order of SOAP header blocks in the message. =head2 R2752 A MESSAGE MAY contain more than one instance of each SOAP header block for each soapbind:header element in the appropriate child of soapbind:binding in the corresponding description. =head2 R2801 A DESCRIPTION MUST use XML Schema 1.0 Recommendation as the basis of user defined datatypes and structures. =head2 R3100 REGDATA of type uddi:bindingTemplate representing a conformant INSTANCE MUST contain the uddi:accessPoint element. =head2 R3002 REGDATA of type uddi:tModel representing a conformant Web service type MUST use WSDL as the description language. =head2 R3003 REGDATA of type uddi:tModel representing a conformant Web service type MUST be categorized using the uddi:types taxonomy and a categorization of "wsdlSpec". =head2 R3010 REGDATA of type uddi:tModel representing a conformant Web service type MUST follow V1.08 of the UDDI Best Practice for Using WSDL in a UDDI Registry. =head2 R3011 The wsdl:binding that is referenced by REGDATA of type uddi:tModel MUST itself conform to the Profile. =head2 R5001 If an INSTANCE requires the use of HTTPS, the location attribute of the soapbind:address element in its wsdl:port description MUST be a URI whose scheme is "https"; otherwise it MUST be a URI whose scheme is "http". SOAP::WSDL has no means of generating WSDL definitions. =head1 LICENSE AND COPYRIGHT This file contains quotes from L. To these quotes, the legal notice from the document source applies. Rest of this file: Copyright 2007 Martin Kutter. This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself =head1 AUTHOR Martin Kutter Emartin.kutter fen-net.deE =head1 REPOSITORY INFORMATION $Rev: 562 $ $LastChangedBy: kutterma $ $Id: WS_I.pod 562 2008-02-22 20:32:17Z kutterma $ $HeadURL: https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Manual/WS_I.pod $ =cut SOAP-WSDL-2.00.10/lib/SOAP/WSDL/Manual/XSD.pod0000444000175000017500000003402111203370730017163 0ustar martinmartin=pod =head1 NAME SOAP::WSDL::Manual::XSD - SOAP::WSDL's XML Schema implementation =head1 DESCRIPTION SOAP::WSDL's XML Schema implementation translates XML Schema definitions into perl classes. Every top-level type or element in a XML schema is translated into a perl class (usually in it's own file). Atomic types are either directly included in the class of their parent's node, or as sub-package in their parent class' file. While the implementation is still incomplete, it covers the XML schema definitions used by most object mappers. =head1 USAGE You can use SOAP::WSDL::XSD based classes just like any perl class - you may instantiate it, inherit from it etc. You should be aware, that SOAP::WSDL::XSD based classes are inside-out classes using Class::Std::Fast, though - things you would expect from hash-based classes like using the blessed hash ref as data storage won't work. Moreover, most all SOAP::WSDL::XSD::Typelib based classes override Class::Std::Fast's default constructor for speed - you should not expect BUILD or START methods to work, unless you call them yourself (or define a new constructor). All SOAP::WSDL::XSD based complexType classes allow a hash ref matching their data structure as only parameter to new(). You may mix hash and list refs and objects in the structure passed to new - as long as the structure matches, it will work fine. All SOAP::WSDL::XSD based simpleType (and builtin) classes accept a single hash ref with the only key "value" and the value to be set as value. =head2 Conversions =head3 Array dereference All SOAP::WSDL::XSD based classes overload arrayification - that is being accessed as a list ref - with a method returning [ $self ]. This means that you can safely use the results of get_ELEMENT calls on complexTypes as list refs (you'll have to check for definedness, though - see L for details. To iterate over a (potential) list of child elements just do the following: if (defined $obj->get_ELEMENT()) { for (@{ $obj->get_ELEMENT() }) { ... } } This is especially useful in mini-languages like L, where you could say <%IF_DEFINED obj.get_ELEMENT %> <%LOOP obj.get_ELEMENT %> ... <%/LOOP> <%IF%> Note that this does not work in HTML::Template::Compiled yet - the code generated for the template checks UNIVERSAL::isa instead of dereferencing. There's a ticket open in HTC to solve the issue. =head3 as_hash_ref SOAP::WSDL::XSD::Typelib::ComplexType based objects have a method as_hash_ref, which returns the object's content as a hash reference. This can be convenient for cloning: my $class = ref $old; my $clone = $class->new( $old->as_hash_ref() ); To convert from one type to another, you can just say my $new = MyTypes::NewType->new( $old->as_hash_ref() ); Of course this will only work if MyTypes::NewType has a superset of the old object class' elements. Note that XML attribute data is not included in the hash ref output yet. =head1 HOW IT WORKS =head2 Base classes SOAP::WSDL::XSD provides a set of base classes for the construction of XML schema defined type classes. =head3 Builtin types SOAP::WSDL::XSD provides classes for all builtin XML Schema datatypes. For a list and reference on these classes, see SOAP::WSDL::XSD::Typelib::Builtin. =head3 Derivation classes For derivation by list, the list derivation class SOAP::WSDL::XSD::Typelib::Builtin::list exists. Derivation by restriction is handled without the help of additional classes. =head3 Element construction class For the construction of element classes, the element superclass SOAP::WSDL::XSD::Typelib::Element exists. All elements are ultimately derived from this class. Elements may inherit from type classes, too - see L for details. =head3 complexType construction class For the construction of complexType classes, the construction class SOAP::WSDL::XSD::Typelib::ComplexType is provided. It provides a __factory method for placing attributes in generated classes, and generating appropriate setter/getter accessors. The setters are special: They handle complex data structures of any type (meaning hash refs, list refs and objects, and any combination of them), as long as their structure matches the expected structure. =head1 TRANSLATION RULES =head2 element TODO add more elaborate description =head3 element with type attribute Elements defined by referencing a builtin or user defined type inherit from SOAP::WSDL::XSD::Typelib::Element and from the corresponding type class. Element Type base class class ^ ^ | | ------------ | Element type="" class =head3 element with ref attribute Elements defined by referencing another element inherit from the corresponding element class. referenced Element class ^ | Element ref="" class =head3 element with atomic simpleType Elements defined by a atomic simpleType from SOAP::WSDL::XSD::Typelib::Element and from the base type of the atomic type. Element atomic Type base class base class ^ ^ | | -------------- | element simpleType class =head3 element with atomic complexType Elements defined with a atomic complexType inherit from SOAP::WSDL::XSD::Typelib::Element and from SOAP::WSDL::XSD::Typelib::ComplexType. Element complexType base class base class ^ ^ | | -------------- | element complexType class =head2 complexType TODO add more elaborate description Some content models are not implemented yet. The content models implemented are described below. =head3 complexType with "all" variety Complex types with "all" variety inherit from SOAP::WSDL::XSD::Typelib::ComplexType, and call it's factory method for creating fields and accessors/mutators for the complexType's elements. All element's type classes are loaded. Complex type classes have a "has a" relationship to their element fields. Element fields may either be element classes (for element ref="") or type classes (for element type=""). No extra element classes are created for a complexType's elements. complexType base class ^ | complexType all ---------------- has a element name="a" ------------> Element or type class object element name="b" ------------> Element or type class object The implementation for all does enforce the order of elements as described in the WSDL, even though this is not required by the XML Schema specification. =head3 complexType with "sequence" variety The implementation of the "sequence" variety is the same as for all. =head3 complexType with "choice" variety The implementation for choice currently is the same as for all - which means, no check for occurrence are made. =head3 complexType with complexContent content model Note that complexType classes with complexContent content model don't exhibit their type via the xsi:type attribute yet, so they currently cannot be used as a replacement for their base type. SOAP::WSDL's XSD deserializer backend does not recognize the xsi:type="" attribute either yet. =over =item * restriction variety ComplexType classes with restriction variety inherit from their base type. No additional processing or content checking is performed yet. complexType base type class ^ | complexType restriction =item * extension variety ComplexType classes with extension variety inherit from the XSD base complexType class and from their base type. Extension classes are checked for (re-)defining all elements of their parent class. Note that a derived type's elements (=properties) overrides the getter / setter methods for all inherited elements. All object data is stored in the derived type's class, not in the defining class (See L for a discussion on inside out object data storage). No additional processing or content checking is performed yet. complexType complexType base class base type class ^ ^ | | ----------------- | complexType extension =back =head2 SimpleType TODO add more elaborate description Some derivation methods are not implemented yet. The derivation methods implemented are described below. =head3 Derivation by list Derivation by list is implemented by inheriting from both the base type and SOAP::WSDL::XSD::Typelib::XSD::list. =head3 Derivation by restriction Derivation by restriction is implemented by inheriting from a base type and applying the required restrictions. =head1 FACETS XML Schema facets are not implemented yet. They will probably implemented some day by putting constant methods into the correspondent classes. =head2 Attributes The attribute set for a XML element (derived from anySimpleType or complexType) is implemented as a sub-package of the element derived from SOAP::WSDL::XSD::Typelib::AttributeSet. The sub-package is named as the corresponding type or element package, suffixed with C. The suffix "XmlAttr" has carefully been chosen to avoid potential naming clashes: The name XmlAttr cannot be included as element or type name in XML schemas - the XML standard bans the use of names starting with "xml" (case-insensitive). All XML attributes for a XML element are set- and retrievable via the method C. The name is chosen to allow mimicing SOAP::Lite's behaviour, which allows setting a SOAP::Data object's attributes via C. my $attrSet = $obj->attr(); $obj->attr({ whitespace => 'preserve', nillable => 1, }); SOAP::WSDL::XSD::Typelib::AttributeSet is derived from SOAP::WSDL::XSD::Typelib::ComplexType with content model C. The individual attributes can be set and retrieved via the respective set_FOO / get_FOO methods. The C method provides auto-vivification: An xml object's attribute set is instantiated when accessed. Auto-vivification is only triggered if there actually B a set of attributes for the class/object in question, so you may want to test whether the result of ->attr is defined: my $attr = $unknownObject->attr(); if (defined($attr)) { $unknownObject->attr({ some => 'value', }); } =head2 group CAVEAT: Group resolution is not implemented yet. XML Schema Group definitions are just treated as aliases that can be inserted in complexType definitions by referencing them. That is, there's no difference between a complexType with simpleContent and a sequence of three elements, and a complexType with simpleContent referencing a group containing the same sequence of elements. =head1 CAVEATS =over =item * START and BUILD are not being called In contrast to "normal" Class::Std::Fast based objects, the classes of the SOAP::WSDL::XSD::Typelib:: hierarchy (and all type and element classes generated by SOAP::WSDL) override Class::Std's constructor for performance reasons. If you inherit from such a class and place a START or BUILD method in it, it will not get called - at least not unless you place something like this at the top of you code: use Class::Std::Fast::Storable; In this case, Class::Std::Fast::Storable will export a new() method into your class, which in turn calls START and BUILD. The constructors of all SOAP::WSDL::XSD::Typelib:: classes don't ! =back =head1 BUGS AND LIMITATIONS The following XML Schema declaration elements are not supported yet: =head2 XML Schema elements partially supported =head3 Type definition elements =over =item * simpleContent simpleContent is only supported with a restriction or extension with a C attribute. simpleContent declarations deriving from a atomic type are not supported (yet). =back =head3 Inclusion elements =over =item * import The import inclusion element requires the schemaLocation attribute for resolving the XML schema to import. Support for the import element is implemented in L, so alternative parsers may or may not support the import element. L keeps track of included schemas and prevents import loops. =back =head3 Facets The following XML Schema declaration elements are supported, but have no effect yet. =over =item * enumeration =item * fractionDigits =item * lenght =item * maxExclusive =item * maxInclusiove =item * maxLength =item * minExclusive =item * minInclusive =item * minLength =item * pattern =item * totalDigits =item * whitespace =back =head2 XML Schema elements not implemented =head3 Declaration elements =over =item * notation =back =head3 Content model definition elements =over =item * any The horror of each XML schema implementation: Just anything... C declarations are not supported yet. =item * anyAttribute =item * attributeGroup C declarations actually just are macros for XML Schema writers: Including an attributeGroup in a declaration has the same effect as including all attributes in the group. Just not implemented yet. =item * group The group definition element is not supported yet. =back =head3 Identity definition elements These declaration elements don't declare XML elements, but apply identity constraints. They have no effect yet. =over =item * field =item * key =item * keyref =item * selector =item * unique =back =head3 Inclusion elements =over =item * include Use of the include inclusion element is forbidden by the WS-I basic profile. It is not supported (yet). =item * redefine Not supported (yet). =back =head3 * Documentation elements =over =item * appinfo The appinfo documentation element is ignored. =back =head1 LICENSE Copyright 2007,2008 Martin Kutter. This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself =head1 AUTHOR Martin Kutter Emartin.kutter fen-net.deE =head1 REPOSITORY INFORMATION $Rev: 390 $ $LastChangedBy: kutterma $ $Id: Client.pm 390 2007-11-16 22:18:32Z kutterma $ $HeadURL: http://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Client.pm $ =cut SOAP-WSDL-2.00.10/lib/SOAP/WSDL/Manual/CodeFirst.pod0000444000175000017500000000525111203370730020412 0ustar martinmartin=pod =head1 Writing Code-First Web Services with SOAP::WSDL B. =head2 How Data Class definitions could look like =head3 Moose Of course SOAP::WSDL could (and probably should) just use Moose - it provides the full Metaclass Framework needed for generating Schemas from class definitions. However, Moose is way too powerful for building (just) simple Data Transfer Objects which can be expressed in XML. With Moose, a class could look like this: package MyElements::GenerateBarCode; use Moose; has 'xmlns' => is => 'ro', default => 'http://webservicex.net'; has 'xmlname' => is => 'ro', default => 'GenerateBarCode'; has 'BarCodeParam' => is => 'rw', type => 'MyTypes::BarCodeData'; has 'BarCodeText' => is => 'rw', type => 'String'; 1; This is - despite the condensed syntax - a lot of line noise. =head3 Native SOAP::WSDL SOAP::WSDL::XSD::Typelib::ComplexType (should) provide a simple setup method allowing a even shorter description (and offering the additional performance boost SOAP::WSDL has over Moose): package MyElements::GenerateBarCode; use strice; use warnings; use SOAP::WSDL::XSD::Typelib::Element; use SOAP::WSDL::XSD::Typelib::ComplexType; _namespace 'http://webservicex.net'; # might be better in the SOAP server interface _name 'GenerateBarCode'; _elements BarCodeParam => 'MyTypes::BarCodeData', BarCodeText => 'string'; This would result in the following XML Schema (inside a schema with the namespace "http://webservicex.net" - the namespaces could even be declared outside the DTO classes. =head2 Interface definitions Perl does not have the concept of interfaces. However, Moose provides Roles, which can be used for defining interfaces. However, it's not really necessary to define a interface Interface (in the sense of a Jave interface) - a interface class is sufficient. Subroutine attributes could be used for providing additional information - attributes in perl are much like annotations in Java A interface could look like this: package MyServer::BarCode; use strict; use warnings; use SOAP::WSDL::Server::CodeFirst; sub generateBarCode :WebMethod(name= return= body=) { my ($self, $body, $header) = @_; my $result = MyElements::GenerateBarcodeResponse->new(); return $result; }; 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/Manual/FAQ.pod0000444000175000017500000001230411203370730017134 0ustar martinmartin=pod =head1 NAME SOAP::WSDL::Manual::FAQ - Frequently Asked Questions (and answers) =head1 Development status =head2 Can I use SOAP::WSDL in a production environment? Yes. SOAP::WSDL is used in production environments. You should - as always - apply common sense and take appropriate safety measures, especially if running SOAP::WSDL as a server. =head2 Can I throw the WSDL away after generating? Please don't. Future versions of SOAP::WSDL may require you to re-generate interfaces in order to use them. =head1 SOAP/WSDL Version and message styles =head2 Which SOAP / WSDL versions does SOAP::WSDL support? SOAP1.1 and WSDL1.1. SOAP1.2 and WSDL2 are not supported yet. =head2 Which SOAP message Styles are supported? document/literal. The message / encoding styles rpc/encoded and rpc/literal are not supported (rpc/literal is hardly used). rpc/literal is not implemented yet. Unfortunately, SOAP::WSDL can't even parse many rpc/encoded WSDL definitions, and thus cannot inform you about unsupported message styles in some situations. =head1 Aren't rpc variants bad anyway? No. They can be as well-defined and useful as the document/literal variant. The difference between rpc and document is that rpc SOAP messages have an additional container named after the remote procedure called. rpc/literal is RPC with named parameters, whereas rpc/encoded corresponds to positional parameters. rpc/encoded is prohibited by the WS-I Basic Profile. However, rpc/encoded is still popular, especially for scripting languages like perl, python or php. You should probably use L for rpc/encoded web services. All the document/rpc literal/encoded discussion will cede with WSDL2.0: These variants are dropped in favour of an extensible operation style mechanism. =head1 XML Parsing / Generation =head2 Does SOAP::WSDL support namespaces? Well, sort of. SOAP::WSDL can use WSDL definitions containing namespaces, and emits SOAP messages with namespace information. Its SOAP message parser however, is not namespace sensitive but uses the pre-shared information from the WSDL for looking up what each XML node means. SOAP::WSDL can parse SOAP messages including namespace informations up to the point where equally named elements from different namespaces may appear at the same position. This is a long-standing feature request and will eventually be resolved. =head2 Validation =head3 Does SOAP::WSDL perform XML Schema Validation? No, SOAP::WSDL does not perform XML Schema Validation. It does, however, enforce the correct structure on both XML and perl data. Occurrence, ordering, value-spaces, and identity constraints are not checked. =head3 Does SOAP::WSDL perform XML Validation? No, SOAP::WSDL does not perform XML Validation (that is, validation against a DTD). WS-I prohibits the use of DTDs in WSDL definitions. =head3 Isn't validation required for XML? No. The XML Specification does not require validation from XML processors. It states how validating and non-validating parsers must react on errors. Note: Validation in the context of (only) XML actually means DTD validation. =head3 And doesn't XML Schema require validation? The XML Schema specification requires conformant XML Schema processors to be able to validate XML Schema constraints. SOAP::WSDL is not a conformant XML Schema processor in this sense, as it does not validate all XML Schema constraints. =head3 And does SOAP require XML Schema Validation? No. The SOAP1.1 note does not say anything about validation. The SOAP1.2. specification explicitly states that XML Schema validation is not required for the SOAP envelope, and that applications may decide whether they need XML Schema Validation for the SOAP payload or not. The WSDL 1.1. specification does not mandate XML Schema validation. It does actually not even mandate the use of XML Schema for type definitions. =head2 Can SOAP::WSDL parse SOAP message fragments? No. SOAP::WSDL can parse neither well-formed nor not-well-formed SOAP message chunks. =head1 Persistence =head2 Can I use Storable to freeze/thaw SOAP::WSDL's objects? You can freeze almost all of SOAP::WSDL's objects. The only exceptions are the objects used in parsing WSDL definitions itself - they cannot be frozen. Note that freezing/thawing inside-out objects comes with a performance penalty and is at around the speed of XML generation/parsing. =head1 Performance and memory consumption =head2 How fast is SOAP::WSDL? As of this writing, SOAP::WSDL is the fastest SOAP Client toolkit for perl available on CPAN. There are no published server benchmarks yet. If you need extra speed you can try SOAP::WSDL_XS available from SOAP::WSDL's subversion repository at: https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL_XS/trunk Note however that SOAP::WSDL_XS is not very mature yet and only suitable for use in trusted environments - you definitely should not use it on a public internet SOAP server yet. Note further that SOAP::WSDL's inside-out objects come with a big performance penalty when freezing/thawing them with Storable. =head2 There's a lot of perl modules generated. Don't they eat up all my memory? SOAP::WSDL usually uses a bit more memory than SOAP::Lite, but less than XML::Compile. Test if in question. =cut SOAP-WSDL-2.00.10/lib/SOAP/WSDL/Manual/Glossary.pod0000444000175000017500000000557211203370730020341 0ustar martinmartin=head1 NAME SOAP::WSDL::Manual::Glossary - Those acronyms and stuff =head1 Glossary =head2 web service Web services are RPC (Remote Procedure Call) interfaces accessible via some internet protocol, typically via HTTP(S). =head2 SOAP SOAP is (was - since 1.2 the name "SOAP" has no meaning any more) an acronym for Simple Object Access Protocol. SOAP is a W3C recommendation. The latest version of the SOAP specification may be found at L. SOAP defines a protocoll for message exchange between applications. The most popular usage is to use SOAP for remote procedure calls (RPC). While one of the constituting aspects of a web service is its reachability via some internet protocol, you might as well define SOAP services accessible via postcards. Despite it's former name, SOAP has nothing more to do with objects than cars have with pets - SOAP messages may, but not necessarily do carry objects, very much like your car may, but does not need to carry your pet. =head2 WSDL WSDL is an acronym for Web Services Description Language. WSDL is a W3C recommendation. The latest version of the WSDL specification may be found at L. WSDL defines a XML-based language for describing web service interfaces, including SOAP interfaces. =head2 WS-I WS-I (Web Services Interoperability Organization) is an open industry organisation chartered to promote Web service interoperability across platforms, operating systems, and programming languages. WS-I publishes profiles, which provide implementation guidelines for how related Web services specifications should be used together for best interoperability. To date, WS-I has finalized the Basic Profile, Attachments Profile and Simple SOAP Binding Profile. SOAP::WSDL aims at complying to the WS-I Basic Profile (but does not implement full support yet). =head2 SOAP message styles =head3 rpc Meant for transporting a RPC message. All contents of the SOAP body are put into a top-level node named equal to the SOAP operation. WS-I Basic Profile allows the use of rpc message style. SOAP::WSDL does not support rpc message style yet. SOAP::Lite supports rpc message style only. =head3 document Meant for transporting arbitrary content. No additional nodes are inserted between the SOAP body and the actual content. WS-I Basic Profile allows the use of document message style. =head2 SOAP encoding styles =head3 encoded =head3 literal =head1 LICENSE AND COPYRIGHT Copyright 2007 Martin Kutter. This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself. =head1 AUTHOR Martin Kutter Emartin.kutter fen-net.deE =head1 REPOSITORY INFORMATION $Rev: 391 $ $LastChangedBy: kutterma $ $Id: Glossary.pod 391 2007-11-17 21:56:13Z kutterma $ $HeadURL: https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Manual/Glossary.pod $ =cut SOAP-WSDL-2.00.10/lib/SOAP/WSDL/Manual/Parser.pod0000444000175000017500000001601011203370730017757 0ustar martinmartin=pod =head1 NAME SOAP::WSDL::Manual::Parser - How SOAP::WSDL parses XML messages =head1 Which XML message does SOAP::WSDL parse ? Naturally, there are two kinds of XML documents (or messages) SOAP::WSDL has to parse: =over =item * WSDL definitions =item * SOAP messages =back There are different parser implementations available for SOAP messages and WSDL definitions. =head1 WSDL definitions parser =head2 SOAP::WSDL::Expat::WSDLParser A parser for WSDL definitions based on L. my $parser = SOAP::WSDL::Expat::WSDLParser->new(); my $wsdl = $parser->parse_file( $filename ); The WSDL parser creates a tree of perl objects, whose root is a L element. =head1 SOAP messages parser =head2 SOAP::WSDL::Expat::MessageParser L converts SOAP messages to SOAP::WSDL::XSD object trees. It uses a class resolvers for finding out which class a particular XML element should be of, and type libs containing these classes. =head3 Creating a class resolver The easiest way for creating a class resolver is to run SOAP::WSDL's generator. See L. The class resolver must implement a class method "get_class", which is passed a list ref of the current element's XPath (relative to Body), split by /. This method must return a class name appropriate for a XML element. A class resolver package might look like this: package ClassResolver; my %class_list = ( 'EnqueueMessage' => 'Typelib::TEnqueueMessage', 'EnqueueMessage/MMessage' => 'Typelib::TMessage', 'EnqueueMessage/MMessage/MRecipientURI' => 'SOAP::WSDL::XSD::Builtin::anyURI', 'EnqueueMessage/MMessage/MMessageContent' => 'SOAP::WSDL::XSD::Builtin::string', ); sub new { return bless {}, 'ClassResolver' }; sub get_class { my $name = join('/', @{ $_[1] }); return ($class_list{ $name }) ? $class_list{ $name } : warn "no class found for $name"; }; 1; =head3 Skipping unwanted items Sometimes there's unneccessary information transported in SOAP messages. To skip XML nodes (including all child nodes), just edit the type map for the message and set the type map entry to '__SKIP__'. In the example above, EnqueueMessage/StuffIDontNeed and all child elements are skipped. my %class_list = ( 'EnqueueMessage' => 'Typelib::TEnqueueMessage', 'EnqueueMessage/MMessage' => 'Typelib::TMessage', 'EnqueueMessage/MMessage/MRecipientURI' => 'SOAP::WSDL::XSD::Builtin::anyURI', 'EnqueueMessage/MMessage/MMessageContent' => 'SOAP::WSDL::XSD::Builtin::string', 'EnqueueMessage/StuffIDontNeed' => '__SKIP__', 'EnqueueMessage/StuffIDontNeed/Foo' => 'SOAP::WSDL::XSD::Builtin::string', 'EnqueueMessage/StuffIDontNeed/Bar' => 'SOAP::WSDL::XSD::Builtin::string', ); Note that only SOAP::WSDL::Expat::MessageParser implements skipping elements at the time of writing. =head3 Creating type lib classes Every element must have a correspondent one in the type library. Builtin types should be resolved as SOAP::WSDL::XSD::Builtin::* classes Creating a type lib is easy: Just run SOAP::WSDL's generator - it will create both a typemap and the type lib classes for a WSDL file. Sometimes it is nessecary to create type lib classes by hand - not all WSDL definitions are complete. For writing your own lib classes, see L, L and L. =head2 SOAP::WSDL::Expat::Message2Hash Transforms a SOAP message into a perl hash refs. Using this parser is usually triggered by calling the C method of SOAP::WSDL, or by using L. Acts somewhat like XML::Simple, but faster. The following restrictions apply: =over =item * Ignores all namespaces =item * Ignores all attributes =item * Does not handle mixed content =item * The SOAP header is ignored =back =cut =head1 OLD SAX HANDLER Historically, SOAP::WSDL used SAX for parsing XML. The SAX handlers were implemented as L handlers, which also worked with L. Support for SAX and L in SOAP::WSDL is discontinued for the following reasons: =over =item * Speed L is faster than L - at least when optimized for speed. High parsing speed is one of the key requirements for a SOAP toolkit - if XML serializing and (more important) deserializing are not fast enough, the whole toolkit is unusable. =item * Availability L is more popular than L. =item * Stability XML::LibXML is based on the libxml2 library. Several versions of libxml2 are known to have specific bugs. As a workaround, there are often several versions of libxml2 installed on one system. This may lead to problems on operating systems which cannot load more than one version of a shared library simultaneously. XML::LibXML is also still under development, while XML::Parser has had time to stabilize. =item * SOAP::Lite uses XML::Parser L uses L if available. SOAP::WSDL should not require users to install both L and L. =back The old SAX handler historically used in SOAP::WSDL are not included in the SOAP::WSDL package any more. However, they may be obtained from the "attic" directory in SOAP::WSDL's SVN repository at https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/attic =over =item * SOAP::WSDL::SAX::WSDLHandler This is a SAX handler for parsing WSDL files into object trees SOAP::WSDL works with. It's built as a native handler for XML::LibXML, but will also work with XML::SAX::ParserFactory. To parse a WSDL file, use one of the following variants: my $parser = XML::LibXML->new(); my $handler = SOAP::WSDL::SAX::WSDLHandler->new(); $parser->set_handler( $handler ); $parser->parse( $xml ); my $data = $handler->get_data(); my $handler = SOAP::WSDL::SAX::WSDLHandler->new({ base => 'XML::SAX::Base' }); my $parser = XML::SAX::ParserFactor->parser( Handler => $handler ); $parser->parse( $xml ); my $data = $handler->get_data(); =item * SOAP::WSDL::SAX::MessageHandler This is a SAX handler for parsing WSDL files into object trees SOAP::WSDL works with. It's built as a native handler for XML::LibXML, but will also work with XML::SAX::ParserFactory. Can be used for parsing both streams (chunks) and documents. =back =head1 LICENSE AND COPYRIGHT Copyright 2007 Martin Kutter. This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself. =head1 AUTHOR Martin Kutter Emartin.kutter fen-net.deE =head1 REPOSITORY INFORMATION $Rev: 391 $ $LastChangedBy: kutterma $ $Id: Parser.pod 391 2007-11-17 21:56:13Z kutterma $ $HeadURL: https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Manual/Parser.pod $ =cut SOAP-WSDL-2.00.10/lib/SOAP/WSDL/Manual/Serializer.pod0000444000175000017500000000103511203370730020635 0ustar martinmartin=pod =head1 NAME SOAP::WSDL::Manual::Serializer =head1 SERIALIZER CLASSES Serializer classes convert perl data structures to XML. SOAP::WSDL comes with one builtin serializer class: L. =head1 WRITING YOUR OWN SERIALIZER See L. =head1 LICENSE Copyright 2007 Martin Kutter. This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself =head1 AUTHOR Martin Kutter Emartin.kutter fen-net.deE =cut SOAP-WSDL-2.00.10/lib/SOAP/WSDL/Manual/Deserializer.pod0000444000175000017500000000206011203370730021145 0ustar martinmartin=pod =head1 NAME SOAP::WSDL::Manual::Deserializer =head1 DESERIALIZER CLASSES Deserializer classes convert SOAP messages to perl data structures. SOAP::WSDL comes with several builtin serializer classes: =over =item * L Creates SOAP::WSDL::XSD objects from SOAP messages. Default deserializer for generated interfaces and SOAP::WSDL::Client. =item * L Creates perl hash structures from SOAP messages. =item * L Creates SOAP::SOM objects from SOAP messages. Default deserializer for SOAP::WSDL. See L for more information on SOAP::SOM objects. =back =head1 WRITING YOUR OWN DESERIALIZER See L. =head1 LICENSE AND COPYRIGHT Copyright 2007 Martin Kutter. This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself =head1 AUTHOR Martin Kutter Emartin.kutter fen-net.deE =cut SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/0000755000175000017500000000000011203370730015244 5ustar martinmartinSOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/SimpleType.pm0000444000175000017500000000735611203370730017706 0ustar martinmartinpackage SOAP::WSDL::XSD::SimpleType; use strict; use warnings; use Class::Std::Fast::Storable; use base qw(SOAP::WSDL::Base); use version; our $VERSION = qv('2.00.10'); my %length_of :ATTR(:name :default<[]>); my %minLength_of :ATTR(:name :default<[]>); my %maxLength_of :ATTR(:name :default<[]>); my %pattern_of :ATTR(:name :default<[]>); my %enumeration_of :ATTR(:name :default<[]>); my %whiteSpace_of :ATTR(:name :default<[]>); my %totalDigits_of :ATTR(:name :default<[]>); my %fractionDigits_of :ATTR(:name :default<[]>); my %minExclusive :ATTR(:name :default<[]>); my %minInclusive :ATTR(:name :default<[]>); my %maxExclusive :ATTR(:name :default<[]>); my %maxInclusive :ATTR(:name :default<[]>); my %fixed :ATTR(:name :default<[]>); my %annotation_of :ATTR(:name :default<()>); my %base_of :ATTR(:name :default<()>); my %itemType_of :ATTR(:name :default<()>); # TODO rename flavor to variety to be consistent with the XML Schema # specs - though flavor is the cooler name.. # set to restriction|list|union|enumeration my %flavor_of :ATTR(:name :default<()>); # for simpleType containing atomic simple types my %type_of :ATTR(:name :default<()>); sub get_simpleType; *get_simpleType = \&get_type; sub set_simpleType; *set_simpleType = \&set_type; sub get_variety; *get_variety = \&get_flavor; sub set_restriction { my $self = shift; my @attributes = @_; $self->set_flavor( 'restriction' ); for (@attributes) { next if (not $_->{ LocalName } eq 'base'); $self->set_base( $_->{ Value } ); } } sub set_list { my $self = shift; my @attributes = @_; $self->set_flavor( 'list' ); for (@attributes) { next if (not $_->{ LocalName } eq 'itemType'); $self->set_itemType( $_->{ Value } ); } } sub set_union { my $self = shift; my @attributes = @_; $self->set_flavor( 'union' ); for (@attributes) { next if (not $_->{ LocalName } eq 'memberTypes'); $self->set_base( [ split /\s/, $_->{ Value } ] ); } } sub serialize { my $self = shift; my $name = shift; my $value = shift; my $opt = shift; my $ident = ident $self; $opt->{ attributes } ||= []; $opt->{ indent } ||= q{}; return $self->_serialize_single($name, $value , $opt) if ( $flavor_of{ $ident } eq 'restriction' or $flavor_of{ $ident } eq 'union' or $flavor_of{ $ident } eq 'enumeration'); if ($flavor_of{ $ident } eq 'list' ) { $value ||= []; $value = [ $value ] if ( ref( $value) ne 'ARRAY' ); return $self->_serialize_single($name, join( q{ }, @{ $value } ), $opt); } } sub _serialize_single { my ($self, $name, $value, $opt) = @_; my $xml = ''; $xml .= $opt->{ indent } if ($opt->{ readable }); # add indentation $xml .= '<' . join ' ', $name, @{ $opt->{ attributes } }; if ( $opt->{ autotype }) { # reverse namespace by prefix hash my %prefix_of = reverse %{ $opt->{ namespace } }; my $ns = $self->get_targetNamespace(); my $prefix = $prefix_of{ $ns } || die 'No prefix found for namespace '. $ns; $xml .= ' type="' . $prefix . ':' . $self->get_name() .'"'; } # nillabel ? return $xml .'/>' if not defined $value; $xml .= join q{}, '>' , $value , ''; $xml .= "\n" if ($opt->{ readable }); return $xml; } 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Element.pm0000444000175000017500000000724211203370730017176 0ustar martinmartinpackage SOAP::WSDL::XSD::Element; use strict; use warnings; use Class::Std::Fast::Storable; use base qw(SOAP::WSDL::Base); use version; our $VERSION = qv('2.00.10'); # id provided by Base # name provided by Base # annotation provided by Base my %simpleType_of :ATTR(:name :default<()>); my %complexType_of :ATTR(:name :default<()>); my %facet_of :ATTR(:name :default<()>); my %type_of :ATTR(:name :default<()>); my %abstract_of :ATTR(:name :default<()>); my %block_of :ATTR(:name :default<()>); my %default_of :ATTR(:name :default<()>); my %final_of :ATTR(:name :default<()>); my %fixed_of :ATTR(:name :default<()>); my %form_of :ATTR(:name
:default<()>); my %maxOccurs_of :ATTR(:name :default<()>); my %minOccurs_of :ATTR(:name :default<()>); my %nillable_of :ATTR(:name :default<()>); my %ref_of :ATTR(:name :default<()>); my %substitutionGroup_of :ATTR(:name :default<()>); sub first_simpleType { my $result_ref = $simpleType_of{ ident shift }; return if not $result_ref; return $result_ref if (not ref $result_ref eq 'ARRAY'); return $result_ref->[0]; } sub first_complexType { my $result_ref = $complexType_of{ ident shift }; return if not $result_ref; return $result_ref if (not ref $result_ref eq 'ARRAY'); return $result_ref->[0]; } # serialize type instead... sub serialize { my ($self, $name, $value, $opt) = @_; my $type; my $typelib = $opt->{ typelib }; my %ns_map = %{ $opt->{ namespace } }; my $ident = ident $self; # abstract elements may only be serialized via ref - and then we have a # name... die "cannot serialize abstract element" if $abstract_of{ $ident } and not $name; # TODO: implement final and substitutionGroup - maybe never implement # substitutionGroup ? $name = $self->get_name() if not ($name); if ( $opt->{ qualify } ) { $opt->{ attributes } = [ ' xmlns="' . $self->get_targetNamespace .'"' ]; } # set default and fixed - fixed overrides everything, # default only empty (undefined) values if (not defined $value) { $value = $default_of{ ident $self } if $default_of{ ident $self }; } $value = $fixed_of{ ident $self } if $fixed_of{ ident $self }; # TODO check nillable and serialize empty data correctly # return if minOccurs is 0 and we have no value if (defined $minOccurs_of{ ident $self } and $minOccurs_of{ ident $self } == 0) { return q{} if not defined $value; } # handle direct simpleType and complexType here if ($type = $self->first_simpleType() ) { # simpleType return $type->serialize( $name, $value, $opt ); } elsif ($type = $self->first_complexType() ) { # complexType return $type->serialize( $name, $value, $opt ); } elsif (my $ref_name = $ref_of{ $ident }) { # ref my ($prefix, $localname) = split /:/ , $ref_name; my $ns = $ns_map{ $prefix }; $type = $typelib->find_element( $ns, $localname ); die "no element for ref $prefix:$localname" if (not $type); return $type->serialize( $name, $value, $opt ); } # lookup type my ($prefix, $localname) = split /:/ , $self->get_type(); my $ns = $ns_map{ $prefix }; $type = $typelib->find_type( $ns, $localname ); # safety check die "no type for $prefix:$localname $ns_map{$prefix}" if (not $type); return $type->serialize( $name, $value, $opt ); } 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/MinLength.pm0000444000175000017500000000060611203370730017467 0ustar martinmartinpackage SOAP::WSDL::XSD::MinLength; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none'; use base qw(SOAP::WSDL::Base); use version; our $VERSION = qv('2.00.10'); # # id provided by Base # name provided by Base # annotation provided by Base # may be defined as atomic simpleType my %value_of :ATTR(:name :default<()>); 1;SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Schema/0000755000175000017500000000000011203370730016444 5ustar martinmartinSOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Schema/Builtin.pm0000444000175000017500000000560311203370730020412 0ustar martinmartinpackage SOAP::WSDL::XSD::Schema::Builtin; use strict; use warnings; use Class::Std::Fast::Storable; use SOAP::WSDL::XSD::Schema; use SOAP::WSDL::XSD::Builtin; use base qw(SOAP::WSDL::XSD::Schema); use version; our $VERSION = qv('2.00.10'); # all builtin types - add validation (e.g. content restrictions) later... my %BUILTINS = ( 'anyType' => {}, 'anySimpleType' => {}, 'anyURI' => {}, 'boolean' => {}, 'base64Binary' => {}, 'byte' => {}, 'date' => {}, 'dateTime' => {}, 'decimal' => {}, 'double' => {}, 'duration' => {}, 'ENTITY' => {}, 'float' => {}, 'gDay' => {}, 'gMonth' => {}, 'gMonthDay' => {}, 'gYearMonth' => {}, 'gYear' => {}, 'hexBinary' => {}, 'ID' => {}, 'IDREF' => {}, 'IDREFS' => {}, 'int' => {}, 'integer' => {}, 'language' => {}, 'long' => {}, 'negativeInteger' => {}, 'nonPositiveInteger' => {}, 'nonNegativeInteger' => {}, 'normalizedString' => {}, 'Name' => {}, 'NCName' => {}, 'NMTOKEN' => {}, 'NOTATION' => {}, 'positiveInteger' => {}, 'QName' => {}, 'short' => {}, 'string' => {}, 'time' => {}, 'token' => {}, 'unsignedByte' => {}, 'unsignedInt' => {}, 'unsignedLong' => {}, 'unsignedShort' => {}, ); sub START { my $self = shift; my @args = @_; while (my ($name, $value) = each %BUILTINS ) { $self->push_type( SOAP::WSDL::XSD::Builtin->new({ name => $name, targetNamespace => 'http://www.w3.org/2001/XMLSchema', xmlns => { '#default' => 'http://www.w3.org/2001/XMLSchema', } } ) ); } return $self; } 1; =pod =head1 NAME SOAP:WSDL::XSD::Schema::Builtin - Provides builtin XML Schema datatypes for parsing WSDL =head1 DESCRIPTION Used internally by SOAP::WSDL's WSDL parser. See for SOAP::WSDL::XSD's builtin XML Schema datatypes. =head1 LICENSE AND COPYRIGHT Copyright (c) 2007 Martin Kutter. All rights reserved. This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself =head1 AUTHOR Martin Kutter Emartin.kutter fen-net.deE =head1 REPOSITORY INFORMATION $Rev: 851 $ $LastChangedBy: kutterma $ $Id: Builtin.pm 851 2009-05-15 22:45:18Z kutterma $ $HeadURL: https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/XSD/Schema/Builtin.pm $ =cut SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Pattern.pm0000444000175000017500000000057711203370730017226 0ustar martinmartinpackage SOAP::WSDL::XSD::Pattern; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none'; use base qw(SOAP::WSDL::Base); use version; our $VERSION = qv('2.00.10'); # # id provided by Base # name provided by Base # annotation provided by Base # may be defined as atomic simpleType my %value_of :ATTR(:name :default<()>); 1;SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Enumeration.pm0000444000175000017500000000060711203370730020071 0ustar martinmartinpackage SOAP::WSDL::XSD::Enumeration; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none'; use base qw(SOAP::WSDL::Base); use version; our $VERSION = qv('2.00.10'); # # id provided by Base # name provided by Base # annotation provided by Base # may be defined as atomic simpleType my %value_of :ATTR(:name :default<()>); 1;SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/MinExclusive.pm0000444000175000017500000000061111203370730020211 0ustar martinmartinpackage SOAP::WSDL::XSD::MinExclusive; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none'; use base qw(SOAP::WSDL::Base); use version; our $VERSION = qv('2.00.10'); # # id provided by Base # name provided by Base # annotation provided by Base # may be defined as atomic simpleType my %value_of :ATTR(:name :default<()>); 1;SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/WhiteSpace.pm0000444000175000017500000000060211203370730017632 0ustar martinmartinpackage SOAP::WSDL::XSD::WhiteSpace; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none'; use base qw(SOAP::WSDL::Base); use version; our $VERSION = qv('2.00.10'); # # id provided by Base # name provided by Base # annotation provided by Base # may be defined as atomic simpleType my %value_of :ATTR(:name :default<()>); 1;SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Length.pm0000444000175000017500000000060311203370730017020 0ustar martinmartinpackage SOAP::WSDL::XSD::Length; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none'; use base qw(SOAP::WSDL::Base); use version; our $VERSION = qv('2.00.10'); # # id provided by Base # name provided by Base # annotation provided by Base # may be defined as atomic simpleType my %value_of :ATTR(:name :default<()>); 1;SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/MaxExclusive.pm0000444000175000017500000000061111203370730020213 0ustar martinmartinpackage SOAP::WSDL::XSD::MaxExclusive; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none'; use base qw(SOAP::WSDL::Base); use version; our $VERSION = qv('2.00.10'); # # id provided by Base # name provided by Base # annotation provided by Base # may be defined as atomic simpleType my %value_of :ATTR(:name :default<()>); 1;SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/0000755000175000017500000000000011203370730016654 5ustar martinmartinSOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/SimpleType.pm0000444000175000017500000000756511203370730021320 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::SimpleType; use strict; use warnings; use SOAP::WSDL::XSD::Typelib::Builtin; use version; our $VERSION = qv('2.00.10'); package SOAP::WSDL::XSD::Typelib::SimpleType::restriction; use strict; use SOAP::WSDL::XSD::Typelib::Builtin; use base qw(SOAP::WSDL::XSD::Typelib::SimpleType); use version; our $VERSION = qv('2.00.10'); 1; __END__ =pod =head1 NAME SOAP::WSDL::XSD::Typelib::SimpleType - simpleType base class =head1 DESCRIPTION This module implements a base class for designing simple type classes modelling XML Schema simpleType definitions. =head1 SYNOPSIS # example simpleType derived by restriction # XSD would be: # # # package MySimpleType; use Class::Std::Fast::Storable constructor => 'none'; # restriction base implemented via inheritance use SOAP::WSDL::XSD::Typelib::Builtin; use SOAP::WSDL::XSD::Typelib::SimpleType; use base qw( # derive by restriction 'SOAP::WSDL::XSD::Typelib::SimpleType::restriction', # restriction base 'SOAP::WSDL::XSD::Typelib::Builtin::string' ); # example simpleType derived by list. # XSD would be: # # # package MySimpleListType; use Class::Std::Fast::Storable constructor => 'none'; # restriction base implemented via inheritance use SOAP::WSDL::XSD::Typelib::Builtin; use base ('SOAP::WSDL::XSD::Typelib::SimpleType', 'SOAP::WSDL::XSD::Typelib::Builtin::list', # derive by list 'SOAP::WSDL::XSD::Typelib::Builtin::string' # list itemType ); =head1 How to write your own simple type Writing a simple type class is easy - all you have to do is setting up the base classes correctly. The following rules apply: =over =item * simpleType derived via list simpleType classes derived via list must inherit from these classes in exactly this order: SOAP::WSDL::XSD::Typelib::SimpleType SOAP::WSDL::XSD::Typelib::Builtin::list # derive by list The::List::ItemType::Class # list itemType The::List::ItemType::Class can either be a builtin class (see SOAP::WSDL::XSD::Builtin) or another simpleType class (any other class implementing the right methods is supported too, but not for the faint of heart). =item * simpleType derived via restriction simpleType classes derived via restriction must inherit from these classes in exactly this order: SOAP::WSDL::XSD::Typelib::SimpleType # you may leave this out SOAP::WSDL::XSD::Typelib::SimpleType::restriction # derive by restriction The::Restriction::Base::Class # restriction base The::Restriction::Base::Class can either be a builtin class (see SOAP::WSDL::XSD::Builtin) or another simpleType class. The slight inconsistency between the these variants is caused by the restriction element, which has different meanings for simpleType and complexType definitions. =back =head1 BUGS AND LIMITATIONS =over =item * Thread safety SOAP::WSDL::XSD::Typelib::SimpleType uses Class::Std::Fast::Storable which uses Class::Std. Class::Std is not thread safe, so SOAP::WSDL::XSD::Typelib::SimpleType is neither. =item * union union simple types are not supported yet. =item * XML Schema facets No facets are implemented yet. =back =head1 LICENSE AND COPYRIGHT Copyright 2004-2007 Martin Kutter. This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself =head1 AUTHOR Martin Kutter Emartin.kutter fen-net.deE =head1 REPOSITORY INFORMATION $Rev: 851 $ $LastChangedBy: kutterma $ $Id: SimpleType.pm 851 2009-05-15 22:45:18Z kutterma $ $HeadURL: https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/XSD/Typelib/SimpleType.pm $ =cut SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Element.pm0000444000175000017500000001120111203370730020574 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Element; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none'; use version; our $VERSION = qv('2.00.10'); my %NAME; my %NILLABLE; my %REF; my %MIN_OCCURS; my %MAX_OCCURS; # TODO replace by generated methods? # # Class data - remember, we're the base class for a class factory or for # generated code... # use BLOCK: for scoping BLOCK: { my %method_lookup = ( _name => \%NAME, _nillable => \%NILLABLE, _ref => \%REF, _minOccurs => \%MIN_OCCURS, _maxOccurs => \%MAX_OCCURS, ); # create getters / setters for all elements' class data no strict qw(refs); while (my ($name, $value) = each %method_lookup ) { *{ "__set$name" } = sub { @_ or die "Cannot call __set$name without parameter"; my $class = ref $_[0] || $_[0]; $value->{ $class } = $_[1]; }; *{ "__get$name" } = sub { @_ or die "Cannot call __set$name as function"; my $class = ref $_[0] || $_[0]; return $value->{ $class }; }; } }; # use $_[0] and $_[1] for speed. sub start_tag { # my ($self, $opt, $value) = @_; my $ending = ($_[1]->{ empty }) ? '/>' : '>'; my @attr_from = (); if ($_[1]->{ nil }) { return q{} if not $NILLABLE{ ref $_[0] }; push @attr_from, q{ xsi:nil="true"}; $ending = '/>'; } if (delete $_[1]->{qualified}) { push @attr_from, q{ xmlns="} . $_[0]->get_xmlns() . q{"}; } push @attr_from, $_[0]->serialize_attr(); # do we need to check for name ? Element ref="" should have it's own # start_tag. If we don't need to check, we can speed things up return join q{}, "<$_[1]->{ name }" , @attr_from , $ending if $_[1]->{ name }; return join q{}, "<$NAME{ ref $_[0]}" , @attr_from , $ending; } # use $_[0] and $_[1] for speed. # # read it as: # # my ($self, $opt) = @_; # my $class = ref $self; # return "{name}>" if $opt->{name}; # return ""; # # do we need to check for name ? Element ref="" should have it's own # end_tag. If we don't need to check, we can speed things up by defining # end tag with () prototype - perl will inline it for us if we do... sub end_tag { return "{name}>" if $_[1]->{name}; return ""; } 1; =pod =head1 NAME SOAP::WSDL::XSD::Typelib::Element - element base clase =head1 SYNOPSIS This example creates a class for this XML schema definition: package MyElement; use strict; use Class::Std::Fast::Storable constructor => 'none'; use base ( 'SOAP::WSDL::XSD::Typelib::Element', 'SOAP::WSDL::XSD::Typelib::Builtin::string', ); __PACKAGE__->__set_name('MyElementName'); __PACKAGE__->__set_nillable(1); __PACKAGE__->__set_minOccurs(1); __PACKAGE__->__set_maxOccurs(1); __PACKAGE__->__set_ref(0); Now we create this XML schema definition type class: package MyElement2; use strict; use Class::Std::Fast::Storable constructor => 'none'; use base ( 'SOAP::WSDL::XSD::Typelib::Element', 'MyElement' ); __PACKAGE__->__set_name('MyElementName'); __PACKAGE__->__set_nillable(0); __PACKAGE__->__set_ref(1); =head1 NOTES =over =item * type="Foo" Implemented via inheritance. =item * ref="Foo" Implemented via inheritance, too. Calling __PACKAGE__->__set_ref(1) is highly encouraged, though it has no effect yet - it will probably be needed for serialization to XML Schema definitions some day. =back =head1 BUGS AND LIMITATIONS =over =item * minOccurs maxOccurs not implemented These attributes are not yet supported, though they may be set as class properties via __PACKAGE__->__set_FOO methods. =item * 'http://www.w3.org/2001/XMLSchema-instance prefix is hardcoded The prefix for 'http://www.w3.org/2001/XMLSchema-instance (used as namespace for the {http://www.w3.org/2001/XMLSchema-instance}nil="true" attribute is hardcoded as 'xsi'. You should definitly provide your XML envelope generator with the same prefix namespace combination (Default for SOAP::WSDL::Envelope). =back =head1 LICENSE AND COPYRIGHT Copyright 2004-2007 Martin Kutter. This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself =head1 AUTHOR Martin Kutter Emartin.kutter fen-net.deE =head1 REPOSITORY INFORMATION $Rev: 851 $ $LastChangedBy: kutterma $ $Id: Element.pm 851 2009-05-15 22:45:18Z kutterma $ $HeadURL: https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/XSD/Typelib/Element.pm $ =cut SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/AttributeSet.pm0000444000175000017500000000057711203370730021640 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::AttributeSet; use strict; use warnings; use base qw(SOAP::WSDL::XSD::Typelib::ComplexType); use version; our $VERSION = qv('2.00.10'); sub serialize { # we work on @_ for performance. # $_[1] ||= {}; # $option_ref # TODO: What about namespaces? return ${ $_[0]->_serialize({ attr => 1 }) }; } 1;SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/ComplexType.pm0000444000175000017500000005714411203370730021474 0ustar martinmartin#!/usr/bin/perl package SOAP::WSDL::XSD::Typelib::ComplexType; use strict; use warnings; use Carp; use SOAP::WSDL::XSD::Typelib::Builtin; use Scalar::Util qw(blessed); use Data::Dumper; require Class::Std::Fast::Storable; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::anyType); use version; our $VERSION = qv('2.00.10'); # remove in 2.1 our $AS_HASH_REF_WITHOUT_ATTRIBUTES = 0; my %ELEMENT_FORM_QUALIFIED_OF; # denotes whether elements are qualified my %ELEMENTS_FROM; # order of elements in a class my %ATTRIBUTES_OF; # references to value hashes my %CLASSES_OF; # class names of elements in a class my %NAMES_OF; # XML names of elements in a class # XML Attribute handling my %xml_attr_of :ATTR(); # Namespace handling my %xmlns_of :ATTR(); # don't you ever dare to use this ! our $___attributes_of_ref = \%ATTRIBUTES_OF; our $___xml_attribute_of_ref = \%xml_attr_of; # STORABLE_ methods for supporting Class::Std::Fast::Storable. # We could also handle them via AUTOMETHOD, # but AUTOMETHOD should always croak... # Actually, AUTOMETHOD is faster (~1%) if Class::Std::Fast is loaded # properly, and slower (~10%) if not. # Hmmm. Trade 1% for 10? my %STORABLE_METHODS = ( STORABLE_freeze_pre => undef, STORABLE_freeze_post => undef, STORABLE_thaw_pre => undef, STORABLE_thaw_post => undef, ); # for error reporting. Eases working with data objects... sub AUTOMETHOD { # return before unpacking @_ for speed reasons return if exists $STORABLE_METHODS{$_}; my ($self, $ident, @args_from) = @_; my $class = ref $self || $self or die "Cannot call AUTOMETHOD as function"; # Test whether we're called from ->can() my @caller = caller(1); # return if not called by AUTOLOAD - caller must be something like can() # Unfortunately we cannot test for "UNIVERSAL::can", as it gets overwritten # by both Class::Std and Class::Std::Fast, and we don't know the loading # order (Class::Std::Fast should be loaded before for maximum speedup) return if $caller[3] ne 'Class::Std::AUTOLOAD'; confess "Can't locate object method \"$_\" via package \"$class\". \n" . "Valid methods are: " . join(', ', map { ("get_$_" , "set_$_") } keys %{ $ATTRIBUTES_OF{ $class } }) . "\n" } sub attr { # We're working on @_ for speed. # Normally, the first line would look like this: # my $self = shift; my $class = $_[0]->__get_attr_class() or return; # pass arguments to attributes constructor (if any); # lets attr($foo) work as setter if ($_[1]) { return $xml_attr_of{ ${$_[0]} } = $class->new($_[1]); } return $xml_attr_of{ ${$_[0]} } if exists $xml_attr_of{ ${$_[0]} }; return $xml_attr_of{ ${$_[0]} } = $class->new(); } sub serialize_attr { return q{} if not $xml_attr_of{ ${ $_[0] } }; return $xml_attr_of{ ${ $_[0] } }->serialize(); } # TODO: are complextypes are always true ? sub as_bool :BOOLIFY { 1 } sub as_hash_ref { # we're working on $_[0] for speed (as always...) # # Normally the first line would read: # my ($self, $ignore_attributes) = @_; # my $attributes_ref = $ATTRIBUTES_OF{ ref $_[0] }; my $hash_of_ref = {}; if ($_[0]->isa('SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType')) { $hash_of_ref->{ value } = $_[0]->get_value(); } else { foreach my $attribute (keys %{ $attributes_ref }) { next if not defined $attributes_ref->{ $attribute }->{ ${ $_[0] } }; my $value = $attributes_ref->{ $attribute }->{ ${ $_[0] } }; $hash_of_ref->{ $attribute } = blessed $value ? $value->isa('SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType') ? $value->get_value() : $value->as_hash_ref($_[1]) : ref $value eq 'ARRAY' ? [ map { $_->isa('SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType') ? $_->get_value() : $_->as_hash_ref($_[1]) } @{ $value } ] : die "Neither blessed obj nor list ref"; }; } # $AS_HASH_REF_WITHOUT_ATTRIBUTES is deprecated by NOW and will be removed # in 2.1 return $hash_of_ref if $_[1] or $AS_HASH_REF_WITHOUT_ATTRIBUTES; if (exists $xml_attr_of{ ${ $_[0] } }) { $hash_of_ref->{ xmlattr } = $xml_attr_of{ ${ $_[0] } }->as_hash_ref(); } return $hash_of_ref; } # we store per-class elements. # call as __PACKAGE__->_factory sub _factory { my $class = shift; $ELEMENTS_FROM{ $class } = shift; $ATTRIBUTES_OF{ $class } = shift; $CLASSES_OF{ $class } = shift; $NAMES_OF{ $class } = shift; no strict qw(refs); no warnings qw(redefine); while (my ($name, $attribute_ref) = each %{ $ATTRIBUTES_OF{ $class } } ) { my $type = $CLASSES_OF{ $class }->{ $name } or croak "No class given for $name"; # require all types here $type->isa('UNIVERSAL') or eval "require $type" or croak $@; # check now, so we don't need to do it later. # $is_list is used in the methods created. Filling it now means # we don't have to check it every time the method is called, but # can just use $is_list, which will hold the value assigned to # it when the method was created. my $is_list = $type->isa('SOAP::WSDL::XSD::Typelib::Builtin::list'); # The set_$name method below looks rather weird, # but is optimized for performance. # # We could use sub calls for sure, but these are much slower. And # the logic is not that easy: # # we accept: # a) objects # b) scalars # c) list refs # d) hash refs # e) mixed stuff of all of the above, so we have to set our child to # a) value if it's an object # b) New object of expected class with value for simple values # c 1) New object with value for list values and list type # c 2) List ref of new objects with value for list values and # non-list type # c + e 1) List ref of objects for list values (list of objects) # and non-list type # c + e 2) List ref of new objects for list values (list of hashes) # and non-list type where the hash ref is passed to new as # argument # d) New object with values passed to new for HASH references # # We throw an error on # a) list refs of list refs - don't know what to do with this (maybe # use for lists of list types ?) # b) wrong object types # c) non-blessed non-ARRAY/HASH references - if you can define semantics # for GLOB or SCALAR references, feel free to add them. # d) we should also die for non-blessed non-ARRAY/HASH references in # lists but don't do yet - oh my ! # keep in sync with Generator::Template::Plugin::XSD - maybe use # function to allow substituting via symbol table... my $method_name = $name; $method_name =~s{[\.\-]}{_}xmsg; *{ "$class\::set_$method_name" } = sub { if (not $#_) { delete $attribute_ref->{ ${ $_[0] } }; return; }; my $is_ref = ref $_[1]; $attribute_ref->{ ${ $_[0] } } = ($is_ref) ? ($is_ref eq 'ARRAY') ? $is_list # remembered from outside closure ? $type->new({ value => $_[1] }) # it's a list element - can take list ref as value : [ map { # it's not a list element - set value to list of objects ref $_ ? ref $_ eq 'HASH' ? $type->new($_) : ref $_ eq $type ? $_ : croak "cannot use " . ref($_) . " reference as value for $name - $type required" : $type->new({ value => $_ }) } @{ $_[1] } ] : $is_ref eq 'HASH' ? $type->new( $_[1] ) # neither ARRAY nor HASH - probably an object... - # do we need to test for it being blessed? : blessed $_[1] && $_[1]->isa($type) # of required type ? ? $_[1] # use it : die croak "cannot use $is_ref reference as value for $name - $type required" # not $is_ref : defined $_[1] ? $type->new({ value => $_[1] }) : () ; return; }; *{ "$class\::add_$method_name" } = sub { warn "attempting to add empty value to " . ref $_[0] if not defined $_[1]; # first call # test for existance, not for definedness if (not exists $attribute_ref->{ ${ $_[0]} }) { $attribute_ref->{ ${ $_[0]} } = $_[1]; return; } if (not ref $attribute_ref->{ ${ $_[0]} } eq 'ARRAY') { # second call: listify previous value if it's no list and add current $attribute_ref->{ ${ $_[0]} } = [ $attribute_ref->{ ${ $_[0]} }, $_[1] ]; return; } # second and following: add to list push @{ $attribute_ref->{ ${ $_[0]} } }, $_[1]; return; }; } # TODO Could be moved as normal method into base class, e.g. here. # Hmm. let's see... *{ "$class\::new" } = sub { # We're working on @_ for speed. # Normally, the first line would look like this: # my ($class, $args_of) = @_; # # The hanging side comment show you what would be there, then. # Read as: # my $self = bless \(my $o = Class::Std::Fast::ID()), $class; my $self = bless \(my $o = Class::Std::Fast::ID()), $_[0]; # Set attributes if passed via { xmlattr => \%attributes } # # This works just because # a) xmlattr cannot be used as valid XML identifier (it starts # with "xml" which is banned by the XML schema standard) # b) $o->attr($attribute_ref) passes $attribute_ref to the # attribute object's constructor # c) we are in the object's constructor here (which means that) # no attributes object can have been legally constructed # before. if (exists $_[1]->{xmlattr}) { # $args_of->{xmlattr} $self->attr(delete $_[1]->{xmlattr}); } # iterate over keys of arguments # and call set appropriate field in clase map { ($ATTRIBUTES_OF{ $class }->{ $_ }) ? do { my $method = "set_$_"; # keep in sync with Generator::Template::Plugin::XSD - maybe use # function to allow substituting via symbol table... $method =~s{[\.\-]}{_}xmsg; $self->$method( $_[1]->{ $_ } ); # ( $args_of->{ $_ } ); } : $_ =~ m{ \A # beginning of string xmlns # xmlns }xms # get_elements is inlined for performance. ? () : do { croak "unknown field $_ in $class. Valid fields are:\n" . join(', ', @{ $ELEMENTS_FROM{ $class } }) . "\n" . "Structure given:\n" . Dumper @_ }; } keys %{ $_[1] }; # %$args_of; return $self; }; # this _serialize method works fine for and # complextypes, as well as for or # , and attribute sets. # # But what about choice, extension ? # # Triggers XML attribute serialization if the options hash ref contains # a attr element with a true value. *{ "$class\::_serialize" } = sub { my $ident = ${ $_[0] }; my $option_ref = $_[1]; # return concatenated return value of serialize call of all # elements retrieved from get_elements expanding list refs. return \join q{} , map { my $element = $ATTRIBUTES_OF{ $class }->{ $_ }->{ $ident }; # do we have some content if (defined $element) { $element = [ $element ] if not ref $element eq 'ARRAY'; # from 2.00.10 on $NAMES_OF is filled - use || $_; for # backward compatibility my $name = $NAMES_OF{$class}->{$_} || $_; my $target_namespace = $_[0]->get_xmlns(); map { # serialize element elements with their own serializer # but name them like they're named here. # TODO: check. element ref="" has a name??? if ( $_->isa( 'SOAP::WSDL::XSD::Typelib::Element' ) ) { # serialize elements of different namespaces # with namespace declaration ($target_namespace ne $_->get_xmlns()) ? $_->serialize({ name => $name, qualified => 1 }) : $_->serialize({ name => $name }); } # serialize complextype elments (of other types) with their # serializer, but add element tags around. else { # default for undef is true if (! defined $ELEMENT_FORM_QUALIFIED_OF{ $class } or $ELEMENT_FORM_QUALIFIED_OF{ $class } ) { # handle types from different namespaces # # serialize with last namespace put on stack # if the last namespace is a change from the # before-last # if ( exists $option_ref->{ xmlns_stack } && (scalar @{ $option_ref->{ xmlns_stack } } >= 2) && ($option_ref->{ xmlns_stack }->[-1] ne $option_ref->{ xmlns_stack }->[-2])) { # warn "New namespace: ", $option_ref->{ xmlns_stack }->[-1]; join q{}, $_->start_tag({ name => $name , xmlns => $option_ref->{ xmlns_stack }->[-1], %{ $option_ref } }) , $_->serialize($option_ref) , $_->end_tag({ name => $name , %{ $option_ref } }); } else { join q{}, $_->start_tag({ name => $name , %{ $option_ref } }) , $_->serialize($option_ref) , $_->end_tag({ name => $name , %{ $option_ref } }); } } else { # in elementFormDefault="unqualified" mode, # the serialize method has to set # xmnlns="" on all elements inside a ComplexType # # Other serializers usually use prefixes # for "unqualified" and just omit all prefixes # for inner elements # check whether we "had" a xmlns around my $set_xmlns = delete $option_ref->{xmlns}; # serialize start tag with xmlns="" if out parent # did not do that join q{}, $_->start_tag({ name => $name, %{ $option_ref }, (! defined $set_xmlns) ? (xmlns => "") : () }) # add xmlns = "" to child serialize options # to avoid putting xmlns="" everywhere , $_->serialize({ %{$option_ref}, xmlns => "" }) , $_->end_tag({ name => $name , %{ $option_ref } }); } } } @{ $element } } else { q{}; } } (@{ $ELEMENTS_FROM{ $class } }); }; # put hidden complex serializer into class # ... but not for AttributeSet classes if ( ! $class->isa('SOAP::WSDL::XSD::Typelib::AttributeSet')) { *{ "$class\::serialize" } = \&__serialize_complex; }; } sub _set_element_form_qualified { $ELEMENT_FORM_QUALIFIED_OF{ $_[0] } = $_[1]; } # Just as fallback: return no attribute set class as default. # Subclasses may override sub __get_attr_class {}; # hidden complex serializer sub __serialize_complex { # we work on @_ for performance. $_[1] ||= {}; # $option_ref push @{ $_[1]->{ xmlns_stack } }, $_[0]->get_xmlns(); # get content first (pass by reference to avoid copying) my $content_ref = $_[0]->_serialize($_[1]); # option_ref pop @{ $_[1]->{ xmlns_stack } }; # do we have a empty element ? return $_[0]->start_tag({ %{ $_[1] }, empty => 1 }) if not length ${ $content_ref }; return join q{}, $_[0]->start_tag($_[1]), ${ $content_ref }, $_[0]->end_tag(); } sub get_xmlns { return q{} } 1; __END__ =pod =head1 NAME SOAP::WSDL::XSD::Typelib::ComplexType - Base class for complexType node classes =head1 Subclassing To subclass, write a package like this: package MyComplexType; use Class::Std::Fast::Storable constructor => 'none'; use base qw(SOAP::WSDL::XSD::Typelib::ComplexType); # we only need the :get attribute qualifier. # set and init_arg are automatically created by # SOAP::WSDL::XSD::Typelib::ComplexType my %first_attr_of :ATTR(:get :default<()>); my %second_attr_of :ATTR(:get :default<()>); my %third_attr_of :ATTR(:get :default<()>); # the order of elements in a complexType my @elements_from = qw(first_attr second_attr third_attr); # references to the private hashes my %attribute_of = ( first_attr => \%first_attr_of, second_attr => \%second_attr_of, third_attr => \%third_attr_of, ); # classes_of: Classes the child elements should be of my %classes_of = ( first_attr => 'My::FirstElement', second_attr => 'My::SecondElement', third_attr => 'My::ThirdElement', ); # call _factory __PACKAGE__->_factory( \@elements_from, \%attributes_of, \%classes_of, ); 1; When subclassing, the following methods are created in the subclass: =head2 new Constructor. For your convenience, new will accept data for the object's properties in the following forms: hash refs 1) of scalars 2) of list refs 3) of hash refs 4) of objects 5) mixed stuff of all of the above new() will set the data via the set_FOO methods to the object's element properties. Data passed to new must comply to the object's structure or new() will complain. Objects passed must be of the expected type, or new() will complain, too. The special key B may be used to pass XML attributes. This key is chosen, because "xmlattr" cannot legally be used as XML name (it starts with "xml"). Passing a hash ref structure as value to "xmlattr" has the same effect as passing the same structure to a call to C<$obj->attr()> Examples: my $obj = MyClass->new({ MyName => $value }); my $obj = MyClass->new({ MyName => { DeepName => $value, }, MySecondName => $value, }); my $obj = MyClass->new({ MyName => [ { DeepName => $value }, { DeepName => $other_value }, ], MySecondName => $object, MyThirdName => [ $object1, $object2 ], }); my $obj = MyClass->new({ xmlattr => { name => 'foo' }, MyName => { DeepName => $value, }, MySecondName => $value, }); In case your building on Class::Std, please note the following limitations: The new() method from Class::Std will be overridden, so you should not rely on it's behaviour. Your START and BUILD methods are called, but the class' inheritance tree is not traversed. =head2 set_FOO A mutator method for every element property. For your convenience, the set_FOO methods will accept all kind of data you can think of (and all combinations of them) as input - with the exception of GLOBS and filehandles. This means you may set element properties by passing a) objects b) scalars c) list refs d) hash refs e) mixed stuff of all of the above Examples are similar to the examples provided for new() above. Note that you cannot delete a property by setting it to undef - this sets the property to an empty property object (with value undef). To delete a property, say: $obj->set_FOO(); =head2 attr Returns / sets the attribute object associated with the object. XML Attributes are modeled as attribute objects - their classes are usually private (i.e. part of the associated class' file, not in a separate file named after the attribute class). Note that attribute support is still experimental. =head2 as_bool Returns the boolean value of the complexType (always true). =head2 as_hash_ref Returns a hash ref representation of the complexType object Attributes are included under the special key "xmlattr" (if any). The inclusion of attributes can be suppressed by calling $obj->as_has_ref(1); or even globally by setting $SOAP::WSDL::XSD::Typelib::ComplexType::AS_HASH_REF_WITHOUT_ATTRIBUTES = 1; Note that using the $AS_HASH_REF_WITHOUT_ATTRIBUTES global variable is strongly discouraged. Use of this variable is deprecated and will be removed as of version 2.1 as_hash_ref can be used for deep cloning. The following statement creates a deep clone of a SOAP::WSDL::ComplexType-based object my $clone = ref($obj)->new($obj->as_hash_ref()); =head2 serialize_attr Serialize a complexType's attributes =head2 serialize Serialize a ComplexType object to XML. Exported via symbol table into derived classes. =head1 Bugs and limitations =over =item * Incomplete API Not all variants of XML Schema ComplexType definitions are supported yet. Variants known to work are: sequence all complexContent containing sequence/all definitions =item * Thread safety SOAP::WSDL::XSD::Typelib::Builtin::ComplexType uses Class::Std::Fast::Storable which uses Class::Std. Class::Std is not thread safe, so SOAP::WSDL::XSD::Typelib::Builtin::ComplexType is neither. =item * XML Schema facets No facets are implemented yet. =back =head1 LICENSE AND COPYRIGHT Copyright 2007 Martin Kutter. This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself =head1 AUTHOR Martin Kutter Emartin.kutter fen-net.deE =head1 REPOSITORY INFORMATION $Rev: 851 $ $LastChangedBy: kutterma $ $Id: ComplexType.pm 851 2009-05-15 22:45:18Z kutterma $ $HeadURL: https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/XSD/Typelib/ComplexType.pm $ =cut SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Attribute.pm0000444000175000017500000000071311203370730021154 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Attribute; use strict; use warnings; use base qw(SOAP::WSDL::XSD::Typelib::Element); use version; our $VERSION = qv('2.00.10'); sub start_tag { # my ($self, $opt, $value) = @_; return q{} if (@_ < 3); my $ns = $_[0]->get_xmlns(); if ($ns eq 'http://www.w3.org/XML/1998/namespace') { return qq{ xml:$_[1]->{ name }="}; } return qq{ $_[1]->{ name }="}; } sub end_tag { return q{"}; } 1;SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/0000755000175000017500000000000011203370730020262 5ustar martinmartinSOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/dateTime.pm0000444000175000017500000000273411203370730022360 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::dateTime; use strict; use warnings; use Date::Parse; use Date::Format; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType); sub set_value { # use set_value from base class if we have a XML-DateTime format #2037-12-31T00:00:00.0000000+01:00 return $_[0]->SUPER::set_value( $_[1] ) if not defined $_[1]; return $_[0]->SUPER::set_value( $_[1] ) if ( $_[1] =~ m{ ^\d{4} \- \d{2} \- \d{2} T \d{2} \: \d{2} \: \d{2} (:? \. \d{1,7} )? [\+\-] \d{2} \: \d{2} $ }xms ); # strptime sets empty values to undef - and strftime doesn't like that... my @time_from = strptime( $_[1] ); die "Illegal date" if not defined $time_from[5]; # strftime doesn't like undefs @time_from = map { !defined $_ ? 0 : $_ } @time_from; my $time_str; if ( $time_from[-1] ) { $time_str = sprintf( '%04d-%02d-%02dT%02d:%02d:%02d.0000000%+03d:%02d', $time_from[5] + 1900, $time_from[4] + 1, $time_from[3], $time_from[2], $time_from[1], $time_from[0], int( $time_from[6] / 3600 ), int( $time_from[6] % 3600 ) / 60 ); } else { $time_str = strftime( '%Y-%m-%dT%H:%M:%S%z', @time_from ); substr $time_str, -2, 0, ':'; } $_[0]->SUPER::set_value($time_str); } 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/time.pm0000444000175000017500000000272411203370730021561 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::time; use strict; use warnings; use Date::Parse; use Date::Format; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType); use version; our $VERSION = qv('2.00.10'); sub set_value { # use set_value from base class if we have a XML-Time format # 00:00:00.0000000+01:00 if ( $_[1] =~ m{ ^ \d{2} \: \d{2} \: \d{2} (:? \. \d{1,7} )? [\+\-] \d{2} \: \d{2} $ }xms ) { $_[0]->SUPER::set_value($_[1]) } # use a combination of strptime and strftime for converting the date # Unfortunately, strftime outputs the time zone as [+-]0000, whereas XML # whants it as [+-]00:00 # We leave out the optional nanoseconds part, as it would always be empty. else { # strptime sets empty values to undef - and strftime doesn't like that... # we even need to set it to 1 to prevent a "Day '0' out of range 1..31" warning.. # we need to set the current date for correct TZ conversion - # could be daylight savings time my @now = localtime; my @time_from = map { my $alternative = shift @now; ! defined $_ ? $alternative : $_ } strptime($_[1]); undef $time_from[-1]; my $time_str = strftime( '%H:%M:%S%z', @time_from ); substr $time_str, -2, 0, ':'; $_[0]->SUPER::set_value($time_str); } } 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/long.pm0000444000175000017500000000031211203370730021551 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::long; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::integer); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/int.pm0000444000175000017500000000030611203370730021407 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::int; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::long); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/negativeInteger.pm0000444000175000017500000000034011203370730023733 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::negativeInteger; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::nonPositiveInteger); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/IDREF.pm0000444000175000017500000000030611203370730021446 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::IDREF; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::ID); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/float.pm0000444000175000017500000000052211203370730021722 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::float; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType); sub as_num :NUMERIFY { return $_[0]->get_value(); } Class::Std::initialize(); # make :NUMERIFY overloading serializable 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/unsignedInt.pm0000444000175000017500000000032611203370730023106 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::unsignedInt; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::unsignedLong); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/NMTOKENS.pm0000444000175000017500000000043011203370730022051 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::NMTOKENS; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::list SOAP::WSDL::XSD::Typelib::Builtin::NMTOKEN); Class::Std::initialize(); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/language.pm0000444000175000017500000000025211203370730022400 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::language; use strict; use warnings; use Class::Std::Fast::Storable; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::token); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/unsignedByte.pm0000444000175000017500000000033011203370730023252 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::unsignedByte; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::unsignedShort); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/gMonth.pm0000444000175000017500000000044111203370730022051 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::gMonth; use strict; use warnings; # Speed up. Class::Std::new is slow - and we don't need it's functionality... use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/string.pm0000444000175000017500000000154311203370730022127 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::string; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType); my %char2entity = ( q{&} => q{&}, q{<} => q{<}, q{>} => q{>}, q{"} => q{"}, q{'} => q{'}, ); sub serialize { $_[1] ||= {}; my $value = $_[0]->get_value(); return $_[0]->start_tag({ %{ $_[1] }, nil => 1}) if not defined $value; # HTML::Entities does the same - and more, thus it's around 1/3 slower... $value =~ s{([&<>"'])}{$char2entity{$1}}xgmso; return join q{}, $_[0]->start_tag($_[1], $value) #, encode_entities( $value, q{&<>"'} ) , $value , $_[0]->end_tag($_[1]); } sub as_bool :BOOLIFY { return $_[0]->get_value(); } Class::Std::initialize(); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/IDREFS.pm0000444000175000017500000000037311203370730021575 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::IDREFS; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw( SOAP::WSDL::XSD::Typelib::Builtin::list SOAP::WSDL::XSD::Typelib::Builtin::IDREF); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/anyType.pm0000444000175000017500000000411711203370730022252 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::anyType; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none'; use version; our $VERSION = qv('2.00.10'); sub get_xmlns { 'http://www.w3.org/2001/XMLSchema' }; # start_tag creates a XML start tag either for a XML element or a attribute. # The method is highly optimized for performance: # - operates on @_ # - uses no private variables # - uses no blocks sub start_tag { # return empty string if no second argument ($opt) or no name return q{} if (! $#_); return q{} if (! exists $_[1]->{ name }); # return attribute start if it's an attribute return qq{ $_[1]->{name}="} if $_[1]->{ attr }; # return with xsi:nil="true" if it is nil return join q{} , "<$_[1]->{ name }" , (defined $_[1]->{ xmlns }) ? qq{ xmlns="$_[1]->{ xmlns }"} : (), $_[0]->serialize_attr($_[1]) , q{ xsi:nil="true"/>} if ($_[1]->{ nil }); # return "empty" start tag if it's empty return join q{}, "<$_[1]->{ name }", (defined $_[1]->{ xmlns }) ? qq{ xmlns="$_[1]->{ xmlns }"} : (), $_[0]->serialize_attr($_[1]) , '/>' if ($_[1]->{ empty }); # return XML element start tag return join q{}, "<$_[1]->{ name }", (defined $_[1]->{ xmlns }) ? qq{ xmlns="$_[1]->{ xmlns }"} : (), , $_[0]->serialize_attr($_[1]) , '>'; } # start_tag creates a XML end tag either for a XML element or a attribute. # The method is highly optimized for performance: # - operates on @_ # - uses no private variables # - uses no blocks sub end_tag { # return empty string if no second argument ($opt) or no name return q{} if (! $#_); return q{} if (! exists $_[1]->{ name }); return q{"} if $_[1]->{ attr }; return "{name}>"; }; sub serialize_attr {}; # sub serialize { q{} }; sub serialize_qualified :STRINGIFY { return $_[0]->serialize( { qualified => 1 } ); } sub as_list :ARRAYIFY { return [ $_[0] ]; } Class::Std::initialize(); # make :STRINGIFY overloading work 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/nonNegativeInteger.pm0000444000175000017500000000033011203370730024405 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::nonNegativeInteger; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::integer); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/date.pm0000444000175000017500000000432711203370730021541 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::date; use strict; use warnings; use Date::Parse; use Date::Format; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType); sub set_value { # use set_value from base class if we have a XML-DateTime format #2037-12-31+01:00 if ( $_[1] =~ m{ ^\d{4} \- \d{2} \- \d{2} (:? [\+\-] \d{2} \: \d{2} )$ }xms ) { $_[0]->SUPER::set_value($_[1]) } # converting a date is hard work: It needs a timezone, because # 2007-12-30+12:00 and 2007-12-31-12:00 mean the same day - just in # different locations. # strftime actually prints out the correct date, but always prints the # local timezone with %z. # So, if our timezone is not 0, we strftime it without timezone and # append it by hand by the following formula: # The timezone hours are the int (timesone seconds / 3600) # The timezone minutes (if someone ever specifies something like that) # are int( (seconds % 3600) / 60 ) # say, int( (seconds modulo 3600) / 60 ) # # If we have no timezone (meaning the timezone is else { # strptime sets empty values to undef - and strftime doesn't like that... my @time_from = strptime($_[1]); my $time_zone_seconds = $time_from[6]; @time_from = map { (! defined $_) ? 0 : $_ } @time_from; # use Data::Dumper; # warn Dumper \@time_from, sprintf('%+03d%02d', $time_from[6] / 3600, $time_from[6] % 60 ); my $time_str; if (defined $time_zone_seconds) { $time_str = sprintf('%04d-%02d-%02d%+03d:%02d', $time_from[5]+1900, $time_from[4]+1, $time_from[3], int($time_from[6] / 3600), int($time_from[6] % 3600) / 60); } else { $time_str = strftime( '%Y-%m-%d%z', @time_from ); substr $time_str, -2, 0, ':'; } # ? strftime( '%Y-%m-%d', @time_from ) # . sprintf('%+03d%02d', int($time_from[6] / 3600), int ( ($time_from[6] % 3600) / 60 ) ) # : do { # strftime( '%Y-%m-%d%z', @time_from ); # }; # substr $time_str, -2, 0, ':'; $_[0]->SUPER::set_value($time_str); } } 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/gYear.pm0000444000175000017500000000032111203370730021661 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::gYear; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/double.pm0000444000175000017500000000052211203370730022067 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::double; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType); sub as_num :NUMERIFY { return $_[0]->get_value(); } Class::Std::initialize(); # make :NUMERIFY overloading serializable 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/anySimpleType.pm0000444000175000017500000000340111203370730023417 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use SOAP::WSDL::XSD::Typelib::Builtin::anyType; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::anyType); my %value_of :ATTR(:get :init_arg :default<()>); # don't you never dare to play with this ! our $___value = \%value_of; ## use $_[n] for speed - we get called zillions of times... # and we don't need to return the last value... sub set_value { $value_of{ ${ $_[0] } } = $_[1] } # Default attribute handling # TODO add something for handling default attributes sub attr { } # use $_[n] for speed. # This is less readable, but notably faster. # # use postfix-if for speed. This is slightly faster, as it saves # perl from creating a pad (variable context). # # The methods below may get called zillions of times, so # every little statement matters... sub serialize { $_[1] ||= {}; if (not defined $value_of{ ${$_[0]} }) { return $_[0]->start_tag({ %{ $_[1] }, nil => 1 }, undef); } return join q{} , $_[0]->start_tag($_[1], $value_of{ ${$_[0]} }) , $value_of{ ${$_[0]} } , $_[0]->end_tag($_[1]); } sub as_string :STRINGIFY { return defined($value_of { ${ $_[0] } }) ? $value_of { ${ $_[0] } } : q{}; } sub as_bool :BOOLIFY { return $value_of { ${ $_[0] } }; } my $OBJECT_CACHE_REF = Class::Std::Fast::OBJECT_CACHE_REF(); sub new { my $self = pop @{ $OBJECT_CACHE_REF->{ $_[0] } }; $self = bless \(my $o = Class::Std::Fast::ID()), $_[0] if not defined $self; $value_of{ $$self } = $_[1]->{ value } if (($#_) && exists $_[1]->{ value }); return $self; } Class::Std::initialize(); # make :BOOLIFY overloading serializable 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/Name.pm0000444000175000017500000000034111203370730021474 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::Name; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::token); Class::Std::initialize(); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/positiveInteger.pm0000444000175000017500000000034011203370730023773 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::positiveInteger; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::nonNegativeInteger); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/gDay.pm0000444000175000017500000000032011203370730021475 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::gDay; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/gYearMonth.pm0000444000175000017500000000032611203370730022674 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::gYearMonth; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/short.pm0000444000175000017500000000030711203370730021755 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::short; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::int); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/ENTITY.pm0000444000175000017500000000034411203370730021633 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::ENTITY; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::NCName); Class::Std::initialize(); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/gMonthDay.pm0000444000175000017500000000032511203370730022510 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::gMonthDay; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/token.pm0000444000175000017500000000035511203370730021741 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::token; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::normalizedString); Class::Std::initialize(); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/ID.pm0000444000175000017500000000030711203370730021112 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::ID; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::NCName); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/normalizedString.pm0000444000175000017500000000062411203370730024153 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::normalizedString; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::string); # replace all \t, \r, \n by \s sub set_value { my $value = $_[1]; $value =~ s{ [\r\n\t]+ }{ }xmsg if defined($value); $_[0]->SUPER::set_value($value); } Class::Std::initialize(); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/duration.pm0000444000175000017500000000032411203370730022442 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::duration; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/nonPositiveInteger.pm0000444000175000017500000000033011203370730024445 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::nonPositiveInteger; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::integer); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/NCName.pm0000444000175000017500000000034211203370730021716 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::NCName; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::Name); Class::Std::initialize(); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/NOTATION.pm0000444000175000017500000000032411203370730022050 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::NOTATION; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/boolean.pm0000444000175000017500000000211311203370730022232 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::boolean; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use version; our $VERSION = qv('2.00.10'); use base qw(SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType); sub serialize { $_[1] ||= {}; my $value =$_[0]->get_value(); return $_[0]->start_tag({ %{$_[1]}, nil => 1}) if not defined $value; return join q{} , $_[0]->start_tag($_[1]) , $value && $value ne 'false' ? 'true' : 'false' , $_[0]->end_tag($_[1]); } sub as_string :STRINGIFY { my $value = $_[0]->get_value(); return q{} if not defined $value; return ($value && $value ne 'false') ? 1 : 0; } sub as_num :NUMERIFY :BOOLIFY { my $value = $_[0]->get_value(); return ($value && $value ne 'false') ? 1 : 0; } sub set_value { $_[0]->SUPER::set_value( defined $_[1] ? ($_[1] ne 'false' && ($_[1]) ) ? 1 : 0 : 0); } sub delete_value { $_[0]->SUPER::set_value(undef) } Class::Std::Fast::initialize(); # make :BOOLIFY overloading serializable 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/integer.pm0000444000175000017500000000031511203370730022252 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::integer; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::decimal); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/hexBinary.pm0000444000175000017500000000032511203370730022547 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::hexBinary; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/anyURI.pm0000444000175000017500000000032311203370730021763 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::anyURI; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/decimal.pm0000444000175000017500000000055311203370730022217 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::decimal; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType); sub as_num :NUMERIFY :BOOLIFY { return $_[0]->get_value(); } Class::Std::Fast::initialize(); # make :NUMERIFY :BOOLIFY overloading serializable 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/QName.pm0000444000175000017500000000032211203370730021614 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::QName; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/unsignedLong.pm0000444000175000017500000000033511203370730023253 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::unsignedLong; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::nonNegativeInteger); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/NMTOKEN.pm0000444000175000017500000000034411203370730021732 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::NMTOKEN; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::token); Class::Std::initialize(); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/unsignedShort.pm0000444000175000017500000000032711203370730023454 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::unsignedShort; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::unsignedInt); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/byte.pm0000444000175000017500000000034111203370730021557 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::byte; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::short); Class::Std::initialize(); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/list.pm0000444000175000017500000000170511203370730021574 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::list; use strict; use warnings; sub serialize { my ($self, $opt) = @_; $opt = {} if not $opt; my $value = $self->get_value(); return $self->start_tag({ %$opt, nil => 1 }) if not defined $value; $value = [ $value ] if not ref $value; return join q{}, $self->start_tag($opt, $value) , join( q{ }, @{ $value } ) , $self->end_tag($opt, $value); } 1; __END__ =pod =head1 NAME SOAP::WSDL::XSD::Typelib::Builtin::list - list derivation base class =head1 DESCRIPTION To derive from some class by list, just inherit from list. Make sure SOAP::WSDL::XSD::Typelib::Builtin::list is before the type to derive from in the @ISA list. =head1 LICENSE AND COPYRIGHT Copyright (c) 2007 Martin Kutter. All rights reserved. This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself =head1 AUTHOR Martin Kutter Emartin.kutter fen-net.deE =cutSOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin/base64Binary.pm0000444000175000017500000000033211203370730023045 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin::base64Binary; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none', cache => 1; use base qw(SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Typelib/Builtin.pm0000444000175000017500000002661011203370730020623 0ustar martinmartinpackage SOAP::WSDL::XSD::Typelib::Builtin; use strict; use warnings; use Class::Std::Fast::Storable; use version; our $VERSION = qv('2.00.10'); use SOAP::WSDL::XSD::Typelib::Builtin::anyType; use SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType; use SOAP::WSDL::XSD::Typelib::Builtin::anyURI; use SOAP::WSDL::XSD::Typelib::Builtin::base64Binary; use SOAP::WSDL::XSD::Typelib::Builtin::boolean; use SOAP::WSDL::XSD::Typelib::Builtin::byte; use SOAP::WSDL::XSD::Typelib::Builtin::date; use SOAP::WSDL::XSD::Typelib::Builtin::dateTime; use SOAP::WSDL::XSD::Typelib::Builtin::decimal; use SOAP::WSDL::XSD::Typelib::Builtin::double; use SOAP::WSDL::XSD::Typelib::Builtin::duration; use SOAP::WSDL::XSD::Typelib::Builtin::ENTITY; use SOAP::WSDL::XSD::Typelib::Builtin::float; use SOAP::WSDL::XSD::Typelib::Builtin::gDay; use SOAP::WSDL::XSD::Typelib::Builtin::gMonth; use SOAP::WSDL::XSD::Typelib::Builtin::gMonthDay; use SOAP::WSDL::XSD::Typelib::Builtin::gYear; use SOAP::WSDL::XSD::Typelib::Builtin::gYearMonth; use SOAP::WSDL::XSD::Typelib::Builtin::hexBinary; use SOAP::WSDL::XSD::Typelib::Builtin::ID; use SOAP::WSDL::XSD::Typelib::Builtin::IDREF; use SOAP::WSDL::XSD::Typelib::Builtin::IDREFS; use SOAP::WSDL::XSD::Typelib::Builtin::int; use SOAP::WSDL::XSD::Typelib::Builtin::integer; use SOAP::WSDL::XSD::Typelib::Builtin::language; use SOAP::WSDL::XSD::Typelib::Builtin::list; use SOAP::WSDL::XSD::Typelib::Builtin::long; use SOAP::WSDL::XSD::Typelib::Builtin::Name; use SOAP::WSDL::XSD::Typelib::Builtin::NCName; use SOAP::WSDL::XSD::Typelib::Builtin::negativeInteger; use SOAP::WSDL::XSD::Typelib::Builtin::NMTOKEN; use SOAP::WSDL::XSD::Typelib::Builtin::NMTOKENS; use SOAP::WSDL::XSD::Typelib::Builtin::nonNegativeInteger; use SOAP::WSDL::XSD::Typelib::Builtin::nonPositiveInteger; use SOAP::WSDL::XSD::Typelib::Builtin::normalizedString; use SOAP::WSDL::XSD::Typelib::Builtin::NOTATION; use SOAP::WSDL::XSD::Typelib::Builtin::positiveInteger; use SOAP::WSDL::XSD::Typelib::Builtin::QName; use SOAP::WSDL::XSD::Typelib::Builtin::short; use SOAP::WSDL::XSD::Typelib::Builtin::string; use SOAP::WSDL::XSD::Typelib::Builtin::time; use SOAP::WSDL::XSD::Typelib::Builtin::token; use SOAP::WSDL::XSD::Typelib::Builtin::unsignedByte; use SOAP::WSDL::XSD::Typelib::Builtin::unsignedInt; use SOAP::WSDL::XSD::Typelib::Builtin::unsignedLong; use SOAP::WSDL::XSD::Typelib::Builtin::unsignedShort; 1; __END__ =pod =head1 NAME SOAP::WSDL::XSD::Typelib::Builtin - Built-in XML Schema datatypes =head1 DESCRIPTION The SOAP::WSDL::XSD::Typelib::Builtin hierarchy implements all builtin types from the XML schema specification. All XML schema derived types inherit from SOAP::WSDL::XSD::Typelib::Builtin::anyType. These basic type classes are most useful when used as element or simpleType base classes. Using SOAP::WSDL::XSD::Typelib::Builtin uses all of the builtin datatype classes. All builtin types feature common behaviour described below in L =head1 EXAMPLES my $bool = SOAP::WSDL::XSD::Typelib::Builtin::bool->new({ value => 0} ); print $bool; # prints "true" # implements # # package MySimpleType; use SOAP::WSDL::XSD::Typelib::Builtin; use SOAP::WSDL::XSD::Typelib::SimpleType; use base qw(SOAP::WSDL::XSD::Typelib::SimpleType SOAP::WSDL::XSD::Typelib::Builtin::list SOAP::WSDL::XSD::Typelib::Builtin::string ); 1; # somewhere else my $list = MySimpleType->new({ value => [ 'You', 'shall', 'overcome' ] }); print $list; # prints "You shall overcome" =head1 CLASS HIERARCHY This is the inheritance graph for builtin types. Types with [] marker describe types derived via the item in [] in the XML Schema specs. Derivation is implemented via multiple inheritance with the derivation method as first item in the base class list. anyType - anySimpleType - duration - dateTime - date - time - gYearMonth - gYear - gMonthDay - gDay - gMonth - boolean - base64Binary - hexBinary - float - decimal - integer - nonPositiveInteger - negativeInteger - nonNegativeInteger - positiveInteger - unsignedLong - unsignedInt - unsignedShort - unsignedByte - long - int - short - byte - double - anyURI - NOTATION - string - normalizedString - language - Name - NCName - ID - IDREF - IDREFS [list] - ENTITY - token - NMTOKEN - NMTOKENS [list] =head1 OVERLOADED OPERATORS Overloading is implemented via Class::Std's trait mechanism. The following behaviours apply: =over =item * string context All classes use the C method for stringification. =item * bool context All classes derived from anySimpleType return their value in bool context =item * numeric context The boolean class returns 0 or 1 in numeric context. decimal, float and double (and derived classes) return their value in numeric context. =item * arrayification (@{}) When accessed as a list ref, objects of all classes return a list ref with the object itself as single element. This is most useful for writing loops without additional conversions, especially in mini-languages found in templating systems or the like, which may not natively support converting to list refs. Instead of writing something like my $value = $complexType->get_ELEMENT; $value = ref $value eq 'ARRAY' ? $value : [ $value ]; for (@{ $value }) { ... } you can just write for (@{ $complexType->get_ELEMENT }) {...} Note that complexTypes with undef elements still return undef when accessing an undefined element, so when an element may be empty you still have to write something like: my $value = $complexType->get_ELEMENT(); if (defined $value) { for (@{ $value }) { ... } } =back =head1 Subclasses =head2 SOAP::WSDL::XSD::Typelib::Builtin::anyType Base class for all types =head2 SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType Base class for all simple types =head2 SOAP::WSDL::XSD::Typelib::Builtin::anyURI Type representing URIs =head2 SOAP::WSDL::XSD::Typelib::Builtin::boolean Represents boolean data. Serializes to "true" or "false". Everything true in perl and not "false" is deserialized as true. Returns true/false in boolean context. Returns 1 / 0 in numeric context. boolean objects have a special method for deleting their value, because calling C results in the value being set to false. $obj->delete_value(); =head2 SOAP::WSDL::XSD::Typelib::Builtin::byte byte integer objects. =head2 SOAP::WSDL::XSD::Typelib::Builtin::date date values are automatically converted into XML date strings during setting: YYYY-MM-DD+zz:zz The time zone is set to the local time zone if not included. All input variants supported by Date::Parse are supported. You may even pass in dateTime strings - the time part will be ignored. Note that set_value is around 100 times slower when setting non-XML-time strings When setting dates before the beginning of the epoch (negative UNIX timestamp), you should use the XML date string format for setting dates. The behaviour of Date::Parse for dates before the epoch is system dependent. =head2 SOAP::WSDL::XSD::Typelib::Builtin::dateTime dateTime values are automatically converted into XML dateTime strings during setting: YYYY-MM-DDThh:mm:ss.nnnnnnn+zz:zz The fraction of seconds (nnnnnnn) part is optional. Fractions of seconds may be given with arbitrary precision The fraction of seconds part is excluded in converted values, as it would always be 0. All input variants supported by Date::Parse are supported. Note that set_value is around 100 times slower when setting non-XML-time strings =head2 SOAP::WSDL::XSD::Typelib::Builtin::decimal decimal is the base of all non-float numbers =head2 SOAP::WSDL::XSD::Typelib::Builtin::double =head2 SOAP::WSDL::XSD::Typelib::Builtin::duration =head2 SOAP::WSDL::XSD::Typelib::Builtin::ENTITY =head2 SOAP::WSDL::XSD::Typelib::Builtin::float =head2 SOAP::WSDL::XSD::Typelib::Builtin::gDay =head2 SOAP::WSDL::XSD::Typelib::Builtin::gMonth =head2 SOAP::WSDL::XSD::Typelib::Builtin::gMonthDay =head2 SOAP::WSDL::XSD::Typelib::Builtin::gYear =head2 SOAP::WSDL::XSD::Typelib::Builtin::gYearMonth =head2 SOAP::WSDL::XSD::Typelib::Builtin::hexBinary =head2 SOAP::WSDL::XSD::Typelib::Builtin::ID =head2 SOAP::WSDL::XSD::Typelib::Builtin::IDREF =head2 SOAP::WSDL::XSD::Typelib::Builtin::IDREFS List of SOAP::WSDL::XSD::Typelib::Builtin::IDREF objects. Derived by SOAP::WSDL::XSD::Typelib::Builtin::list. =head2 SOAP::WSDL::XSD::Typelib::Builtin::int =head2 SOAP::WSDL::XSD::Typelib::Builtin::integer =head2 SOAP::WSDL::XSD::Typelib::Builtin::language =head2 SOAP::WSDL::XSD::Typelib::Builtin::list =head2 SOAP::WSDL::XSD::Typelib::Builtin::long =head2 SOAP::WSDL::XSD::Typelib::Builtin::Name =head2 SOAP::WSDL::XSD::Typelib::Builtin::NCName =head2 SOAP::WSDL::XSD::Typelib::Builtin::negativeInteger =head2 SOAP::WSDL::XSD::Typelib::Builtin::nonNegativeInteger =head2 SOAP::WSDL::XSD::Typelib::Builtin::nonPositiveInteger =head2 SOAP::WSDL::XSD::Typelib::Builtin::normalizedString Tab, newline and carriage return characters are replaced by whitespace in set_value. =head2 SOAP::WSDL::XSD::Typelib::Builtin::NOTATION =head2 SOAP::WSDL::XSD::Typelib::Builtin::positiveInteger =head2 SOAP::WSDL::XSD::Typelib::Builtin::QName =head2 SOAP::WSDL::XSD::Typelib::Builtin::short =head2 SOAP::WSDL::XSD::Typelib::Builtin::string String values are XML-escaped on serialization. The following characters are escaped: <, >, & =head2 SOAP::WSDL::XSD::Typelib::Builtin::time time values are automatically converted into XML time strings during setting: hh:mm:ss.nnnnnnn+zz:zz hh:mm:ss+zz:zz The time zone is set to the local time zone if not included. The optional nanoseconds part is not included in converted values, as it would always be 0. All input variants supported by Date::Parse are supported. You may even pass in dateTime strings - the date part will be ignored. Note that set_value is around 100 times slower when setting non-XML-time strings. =head2 SOAP::WSDL::XSD::Typelib::Builtin::token =head2 SOAP::WSDL::XSD::Typelib::Builtin::unsignedByte =head2 SOAP::WSDL::XSD::Typelib::Builtin::unsignedInt =head2 SOAP::WSDL::XSD::Typelib::Builtin::unsignedLong =head2 SOAP::WSDL::XSD::Typelib::Builtin::unsignedShort =head1 CAVEATS =over =item * set_value In contrast to Class::Std-generated mutators (setters), set_value does not return the last value. This is for speed reasons: SOAP::WSDL never needs to know the last value when calling set_calue, but calls it over and over again... =back =head1 BUGS AND LIMITATIONS =over =item * Thread safety SOAP::WSDL::XSD::Typelib::Builtin uses Class::Std::Fast::Storable which uses Class::Std. Class::Std is not thread safe, so SOAP::WSDL::XSD::Typelib::Builtin is neither. =item * XML Schema facets No facets are implemented yet. =back =head1 AUTHOR Replace whitespace by @ in e-mail address. Martin Kutter Emartin.kutter fen-net.deE =head1 LICENSE AND COPYRIGHT Copyright 2004-2007 Martin Kutter. This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself =cut SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/TotalDigits.pm0000444000175000017500000000067411203370730020036 0ustar martinmartinpackage SOAP::WSDL::XSD::TotalDigits; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none'; use base qw(SOAP::WSDL::Base); use version; our $VERSION = qv('2.00.10'); # # id provided by Base # name provided by Base # annotation provided by Base # may be defined as atomic simpleType my %value_of :ATTR(:name :default<()>); my %fixed_of :ATTR(:name :default<()>); 1;SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Annotation.pm0000444000175000017500000000065411203370730017717 0ustar martinmartinpackage SOAP::WSDL::XSD::Annotation; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none'; use base qw(SOAP::WSDL::Base); use version; our $VERSION = qv('2.00.10'); # # id provided by Base # name provided by Base # annotation provided by Base # may be defined as atomic simpleType my %appinfo_of :ATTR(:name :default<()>); # documentation provided by Base 1;SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Group.pm0000444000175000017500000000175711203370730016706 0ustar martinmartinpackage SOAP::WSDL::XSD::Group; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none'; use base qw(SOAP::WSDL::Base); use version; our $VERSION = qv('2.00.10'); # # # # . . . # # # # # # # # # # # # # # # my %ref_of :ATTR(:name :default<()>); my %maxOccurs_of :ATTR(:name :default<()>); my %minOccurs_of :ATTR(:name :default<()>); my %annotation_of :ATTR(:name :default<()>); my %element_of :ATTR(:name :default<()>); my %group_of :ATTR(:name :default<()>); my %variety_of :ATTR(:name :default<()>); 1;SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/AttributeGroup.pm0000444000175000017500000000130711203370730020561 0ustar martinmartinpackage SOAP::WSDL::XSD::AttributeGroup; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none'; use base qw(SOAP::WSDL::Base); use version; our $VERSION = qv('2.00.10'); # # Content: (annotation?, ((attribute | attributeGroup)*, anyAttribute?)) # # id provided by Base # name provided by Base # annotation provided by Base my %ref_of :ATTR(:name :default<()>); # may be defined as atomic simpleType my %attribute_of :ATTR(:name :default<()>); my %attributeGroup_of :ATTR(:name :default<()>); 1;SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/ComplexType.pm0000444000175000017500000001347011203370730020056 0ustar martinmartinpackage SOAP::WSDL::XSD::ComplexType; use strict; use warnings; use Class::Std::Fast::Storable; use Scalar::Util qw(blessed); use base qw(SOAP::WSDL::Base); use version; our $VERSION = qv('2.00.10'); # id provided by Base # name provided by Base # annotation provided by Base my %length_of :ATTR(:name :default<[]>); my %minLength_of :ATTR(:name :default<[]>); my %maxLength_of :ATTR(:name :default<[]>); my %pattern_of :ATTR(:name :default<[]>); my %enumeration_of :ATTR(:name :default<[]>); my %whiteSpace_of :ATTR(:name :default<[]>); my %totalDigits_of :ATTR(:name :default<[]>); my %fractionDigits_of :ATTR(:name :default<[]>); my %minExclusive :ATTR(:name :default<[]>); my %minInclusive :ATTR(:name :default<[]>); my %maxExclusive :ATTR(:name :default<[]>); my %maxInclusive :ATTR(:name :default<[]>); my %attribute_of :ATTR(:name :default<()>); my %element_of :ATTR(:name :default<[]>); my %group_of :ATTR(:name :default<()>); my %variety_of :ATTR(:name :default<()>); my %base_of :ATTR(:name :default<()>); my %itemType_of :ATTR(:name :default<()>); my %abstract_of :ATTR(:name :default<()>); my %final_of :ATTR(:name :default<()>); my %mixed_of :ATTR(:name :default<()>); # default is false my %derivation_of :ATTR(:name :default<()>); # is set to simpleContent/complexContent my %content_model_of :ATTR(:name :default); sub get_flavor; *get_flavor = \&get_variety; sub push_element { my $self = shift; my $element = shift; if ($variety_of{ ident $self } eq 'all') { $element->set_minOccurs(0) if not defined ($element->get_minOccurs); $element->set_maxOccurs(1) if not defined ($element->get_maxOccurs); } elsif ($variety_of{ ident $self } eq 'sequence') { $element->set_minOccurs(1) if not defined ($element->get_minOccurs); $element->set_maxOccurs(1) if not defined ($element->get_maxOccurs); } push @{ $element_of{ ident $self } }, $element; } sub set_restriction { my $self = shift; my $element = shift; $variety_of{ ident $self } = 'restriction'; $derivation_of{ ident $self } = 'restriction'; $base_of{ ident $self } = $element->{ Value }; } sub set_extension { my $self = shift; my $element = shift; $variety_of{ ident $self } = 'extension'; $derivation_of{ ident $self } = 'extension'; $base_of{ ident $self } = $element->{ Value }; } sub init { my $self = shift; my @args = @_; $self->SUPER::init( @args ); } sub serialize { my ($self, $name, $value, $opt) = @_; $opt->{ indent } ||= q{}; $opt->{ attributes } ||= []; my $variety = $self->get_variety(); my $xml = ($opt->{ readable }) ? $opt->{ indent } : q{}; # add indentation if ( $opt->{ qualify } ) { $opt->{ attributes } = [ ' xmlns="' . $self->get_targetNamespace .'"' ]; delete $opt->{ qualify }; } $xml .= join q{ } , "<$name" , @{ $opt->{ attributes } }; delete $opt->{ attributes }; # don't propagate... if ( $opt->{ autotype }) { my $ns = $self->get_targetNamespace(); # reverse namespace by prefix hash my %prefix_of = reverse %{ $opt->{ namespace } }; my $prefix = $prefix_of{ $ns } || die 'No prefix found for namespace '. $ns; $xml .= join q{}, " type=\"$prefix:", $self->get_name(), '" ' if ($self->get_name() ); } $xml .= '>'; $xml .= "\n" if ( $opt->{ readable } ); # add linebreak if ($self->schema) { if ($self->schema()->get_elementFormDefault() ne "qualified") { push @{$opt->{ attributes } }, q{xmlns=""} if ($self->get_targetNamespace() ne ""); } } if ( ($variety eq "sequence") or ($variety eq "all") ) { $opt->{ indent } .= "\t"; for my $element (@{ $self->get_element() }) { # resolve element ref # # Basic algorithm is like this: # If on serialization, we meet a element whose get_ref method # returns a true value, lookup the element from the # definitions instead, and serialize this element. # if (my $ref = $element->get_ref()) { $element = $opt->{ typelib }->find_element( $element->expand($ref) ); } # might be list - listify $value = [ $value ] if not ref $value eq 'ARRAY'; for my $single_value (@{ $value }) { my $element_value; if (blessed $single_value) { my $method = 'get_' . $element->get_name(); $element_value = $single_value->$method(); } else { $element_value = $single_value->{ $element->get_name() }; } $element_value = [ $element_value ] if not ref $element_value eq 'ARRAY'; $xml .= join q{} , map { $element->serialize( undef, $_, $opt ) } @{ $element_value }; } } $opt->{ indent } =~s/\t$//; } else { die "sorry, we just handle all and sequence types yet..."; } $xml .= $opt->{ indent } if ( $opt->{ readable } ); # add indentation $xml .= ''; $xml .= "\n" if ($opt->{ readable } ); # add linebreak return $xml; } 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/FractionDigits.pm0000444000175000017500000000060611203370730020513 0ustar martinmartinpackage SOAP::WSDL::XSD::FractionDigits; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none'; use base qw(SOAP::WSDL::Base); use version; our $VERSION = qv('2.00.10'); # # id provided by Base # name provided by Base # annotation provided by Base # may be defined as atomic simpleType my %value_of :ATTR(:name :default<()>); 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Attribute.pm0000444000175000017500000000201211203370730017536 0ustar martinmartinpackage SOAP::WSDL::XSD::Attribute; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none'; use base qw(SOAP::WSDL::Base); use version; our $VERSION = qv('2.00.10'); # # Content: (annotation?, (simpleType?)) # # id provided by Base # name provided by Base # annotation provided by Base my %default_of :ATTR(:name :default<()>); my %fixed_of :ATTR(:name :default<()>); my %form_of :ATTR(:name :default<()>); my %type_of :ATTR(:name :default<()>); my %use_of :ATTR(:name :default<()>); my %ref_of :ATTR(:name :default<()>); # may be defined as atomic simpleType my %simpleType_of :ATTR(:name :default<()>); 1;SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/MinInclusive.pm0000444000175000017500000000061111203370730020203 0ustar martinmartinpackage SOAP::WSDL::XSD::MinInclusive; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none'; use base qw(SOAP::WSDL::Base); use version; our $VERSION = qv('2.00.10'); # # id provided by Base # name provided by Base # annotation provided by Base # may be defined as atomic simpleType my %value_of :ATTR(:name :default<()>); 1;SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/MaxInclusive.pm0000444000175000017500000000061111203370730020205 0ustar martinmartinpackage SOAP::WSDL::XSD::MaxInclusive; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none'; use base qw(SOAP::WSDL::Base); use version; our $VERSION = qv('2.00.10'); # # id provided by Base # name provided by Base # annotation provided by Base # may be defined as atomic simpleType my %value_of :ATTR(:name :default<()>); 1;SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/MaxLength.pm0000444000175000017500000000067111203370730017473 0ustar martinmartinpackage SOAP::WSDL::XSD::MaxLength; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none'; use base qw(SOAP::WSDL::Base); use version; our $VERSION = qv('2.00.10'); # # id provided by Base # name provided by Base # annotation provided by Base # may be defined as atomic simpleType my %value_of :ATTR(:name :default<()>); my %fixed_of :ATTR(:name :default<()>); 1;SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Builtin.pm0000444000175000017500000000203711203370730017210 0ustar martinmartinpackage SOAP::WSDL::XSD::Builtin; use strict; use warnings; use Class::Std::Fast::Storable; use base qw(SOAP::WSDL::Base); use version; our $VERSION = qv('2.00.10'); # only used in SOAP::WSDL - will be obsolete once SOAP::WSDL uses the # generative approach, too sub serialize { my ($self, $name, $value, $opt) = @_; my $xml; $opt->{ indent } ||= ""; $opt->{ attributes } ||= []; $xml .= $opt->{ indent } if ($opt->{ readable }); $xml .= '<' . join ' ', $name, @{ $opt->{ attributes } }; if ( $opt->{ autotype }) { my $ns = $self->get_targetNamespace(); my %prefix_of = reverse %{ $opt->{ namespace } }; my $prefix = $prefix_of{ $ns } || die 'No prefix found for namespace '. $ns; $xml .= ' type="' . $prefix . ':' . $self->get_name() . '"'; } if (defined $value) { $xml .= '>'; $xml .= "$value"; $xml .= '' ; } else { $xml .= '/>'; } $xml .= "\n" if ($opt->{ readable }); return $xml; } 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/XSD/Schema.pm0000444000175000017500000000465311203370730017010 0ustar martinmartinpackage SOAP::WSDL::XSD::Schema; use strict; use warnings; use Class::Std::Fast::Storable; use base qw(SOAP::WSDL::Base); use version; our $VERSION = qv('2.00.10'); # child elements my %attributeGroup_of :ATTR(:name :default<[]>); my %attribute_of :ATTR(:name :default<[]>); my %element_of :ATTR(:name :default<[]>); my %group_of :ATTR(:name :default<[]>); my %type_of :ATTR(:name :default<[]>); # attributes my %attributeFormDefault_of :ATTR(:name :default); my %blockDefault_of :ATTR(:name :default<()>); my %elementFormDefault_of :ATTR(:name :default); my %finalDefault_of :ATTR(:name :default<()>); my %version_of :ATTR(:name :default<()>); # id # name # targetNamespace inherited from Base # xmlns # # attributeFormDefault = (qualified | unqualified) : unqualified # blockDefault = (#all | List of (extension | restriction | substitution)) : '' # elementFormDefault = (qualified | unqualified) : unqualified # finalDefault = (#all | List of (extension | restriction | list | union)) : '' # id = ID # targetNamespace = anyURI # version = token # xml:lang = language # # # alias type with all variants # AUTOMETHOD is WAY too slow.. { no strict qw/refs/; for my $name (qw(simpleType complexType) ) { *{ "set_$name" } = \&set_type; *{ "get_$name" } = \&get_type; *{ "push_$name" } = \&push_type; *{ "find_$name" } = \&find_type; } } sub push_type { # use $_[n] for performance - # we're called on each and every type inside WSDL push @{ $type_of{ ident $_[0]} }, $_[1]; } sub find_element { my ($self, @args) = @_; my @found_at = grep { $_->get_targetNamespace() eq $args[0] && # warn $_->get_name() . " default NS:" . $_->get_xmlns()->{'#default'} . "\n"; # $_->get_xmlns()->{'#default'} eq $args[0] && $_->get_name() eq $args[1] } @{ $element_of{ ident $self } }; return $found_at[0]; } sub find_type { my ($self, @args) = @_; my @found_at = grep { $_->get_targetNamespace() eq $args[0] && # $_->get_xmlns()->{'#default'} eq $args[0] && $_->get_name() eq $args[1] } @{ $type_of{ ident $self } }; return $found_at[0]; } 1; SOAP-WSDL-2.00.10/lib/SOAP/WSDL/Expat/0000755000175000017500000000000011203370730015667 5ustar martinmartinSOAP-WSDL-2.00.10/lib/SOAP/WSDL/Expat/WSDLParser.pm0000444000175000017500000002623211203370730020156 0ustar martinmartinpackage SOAP::WSDL::Expat::WSDLParser; use strict; use warnings; use Carp; use SOAP::WSDL::TypeLookup; use base qw(SOAP::WSDL::Expat::Base); use version; our $VERSION = qv('2.00.10'); # # Import child elements of a WSDL / XML Schema tree into the current tree # # Set the targetNamespace of the imported nodes to $import_namespace # # SYNOPSIS # # $self->_import_children($name, $imported, $imported, $import_namespace) # sub _import_children { my ( $self, $name, $imported, $importer, $import_namespace ) = @_; my $targetNamespace = $importer->get_targetNamespace(); my $push_method = "push_$name"; my $get_method = "get_$name"; my $default_namespace = $imported->get_xmlns()->{'#default'}; no strict qw(refs); my $value_ref = $imported->$get_method(); if ($value_ref) { $value_ref = [$value_ref] if ( not ref $value_ref eq 'ARRAY' ); for ( @{$value_ref} ) { # fixup namespace - new parent may be from different namespace if ( defined($default_namespace) ) { my $xmlns = $_->get_xmlns(); # it's a hash ref, so we can just update values if ( !defined $xmlns->{'#default'} ) { $xmlns->{'#default'} = $default_namespace; } } # fixup targetNamespace, but don't override $_->set_targetNamespace($import_namespace) if ( ( $import_namespace ne $targetNamespace ) && !$_->get_targetNamespace ); # update parent... $_->set_parent($importer); # push elements into importing WSDL $importer->$push_method($_); } } } sub _import_namespace_definitions { my $self = shift; my $arg_ref = shift; my $importer = $arg_ref->{importer}; my $imported = $arg_ref->{imported}; # import namespace definitions, too my $importer_ns_of = $importer->get_xmlns(); my %xmlns_of = %{$imported->get_xmlns()}; # it's a hash ref, we can just add to. # TODO: check whether URI is the better key. while ( my ( $prefix, $url ) = each %xmlns_of ) { if ( exists( $importer_ns_of->{$prefix} ) ) { # warn "$prefix already exists"; next; } $importer_ns_of->{$prefix} = $url; } } sub xml_schema_import { my $self = shift; my $schema = shift; my $parser = $self->clone(); my %attr_of = @_; my $import_namespace = $attr_of{namespace}; if ( not $attr_of{schemaLocation} ) { warn "cannot import document for namespace >$import_namespace< without location"; return; } if ( not $self->get_uri ) { die "cannot import document from namespace >$import_namespace< without base uri. Use >parse_uri< or >set_uri< to set one."; } my $uri = URI->new_abs( $attr_of{schemaLocation}, $self->get_uri() ); my $imported = $parser->parse_uri($uri); # might already be imported - parse_uri just returns in this case return if not defined $imported; $self->_import_namespace_definitions( { importer => $schema, imported => $imported, } ); for my $name (qw(type element group attribute attributeGroup)) { $self->_import_children( $name, $imported, $schema, $import_namespace ); } } sub wsdl_import { my $self = shift; my $definitions = shift; my $parser = $self->clone(); my %attr_of = @_; my $import_namespace = $attr_of{namespace}; if ( not $attr_of{location} ) { warn "cannot import document for namespace >$import_namespace< without location"; return; } if ( not $self->get_uri ) { die "cannot import document from namespace >$import_namespace< without base uri. Use >parse_uri< or >set_uri< to set one."; } my $uri = URI->new_abs( $attr_of{location}, $self->get_uri() ); my $imported = $parser->parse_uri($uri); # might already be imported - parse_uri just returns in this case return if not defined $imported; $self->_import_namespace_definitions( { importer => $definitions, imported => $imported, } ); for my $name (qw(types message binding portType service)) { $self->_import_children( $name, $imported, $definitions, $import_namespace ); } } sub _initialize { my ( $self, $parser ) = @_; # init object data $self->{parser} = $parser; delete $self->{data}; # setup local variables for keeping temp data my $characters = undef; my $current = undef; my $list = []; # node list my $elementFormQualified = 1; # default for WSDLs, schema may override # TODO skip non-XML Schema namespace tags $parser->setHandlers( Start => sub { # handle attrs as list - expat uses dual-vars for looking # up namespace information, and hash keys don't allow dual vars... my ( $parser, $localname, @attrs ) = @_; $characters = q{}; my $action = SOAP::WSDL::TypeLookup->lookup( $parser->namespace($localname), $localname ); return if not $action; if ( $action->{type} eq 'CLASS' ) { eval "require $action->{ class }"; croak $@ if ($@); my $obj = $action->{class}->new( { parent => $current, namespace => $parser->namespace($localname), defined($current) ? ( xmlns => $current->get_xmlns() ) : ()} )->init( _fixup_attrs( $parser, @attrs ) ); if ($current) { if ( defined $list->[-1] && $list->[-1]->isa('SOAP::WSDL::XSD::Schema') ) { $elementFormQualified = $list->[-1]->get_elementFormDefault() eq 'qualified'; } # inherit namespace, but don't override if ($elementFormQualified) { $obj->set_targetNamespace( $current->get_targetNamespace() ) if not $obj->get_targetNamespace(); } # push on parent's element/type list my $method = "push_$localname"; no strict qw(refs); $current->$method($obj); # remember element for stepping back push @{$list}, $current; } # set new element (step down) $current = $obj; } elsif ( $action->{type} eq 'PARENT' ) { $current->init( _fixup_attrs( $parser, @attrs ) ); } elsif ( $action->{type} eq 'METHOD' ) { my $method = $action->{method}; no strict qw(refs); # call method with # - default value ($action->{ value } if defined, # dereferencing lists # - the values of the elements Attributes hash # TODO: add namespaces declared to attributes. # Expat consumes them, so we have to re-add them here. $current->$method( defined $action->{value} ? ref $action->{value} ? @{$action->{value}} : ( $action->{value} ) : _fixup_attrs( $parser, @attrs ) ); } elsif ( $action->{type} eq 'HANDLER' ) { my $method = $self->can( $action->{method} ); $method->( $self, $current, @attrs ); } else { # TODO replace by hash lookup of known namespaces. my $namespace = $parser->namespace($localname) || q{}; my $part = $namespace eq 'http://schemas.xmlsoap.org/wsdl/' ? 'WSDL 1.1' : 'XML Schema'; warn "$part element <$localname> is not implemented yet" if ( $localname !~ m{ \A (:? annotation | documentation ) \z }xms ); } return; }, Char => sub { $characters .= $_[1]; return; }, End => sub { my ( $parser, $localname ) = @_; my $action = SOAP::WSDL::TypeLookup->lookup( $parser->namespace($localname), $localname ) || {}; if ( !defined $list->[-1] ) { $self->{data} = $current; return; } return if not( $action->{type} ); if ( $action->{type} eq 'CLASS' ) { $current = pop @{$list}; if ( defined $list->[-1] && $list->[-1]->isa('SOAP::WSDL::XSD::Schema') ) { $elementFormQualified = 1; } } elsif ( $action->{type} eq 'CONTENT' ) { my $method = $action->{method}; # normalize whitespace $characters =~ s{ ^ \s+ (.+) \s+ $ }{$1}xms; $characters =~ s{ \s+ }{ }xmsg; no strict qw(refs); $current->$method($characters); } return; } ); return $parser; } # make attrs SAX style sub _fixup_attrs { my ( $parser, @attrs ) = @_; my @attr_key_from = (); my @attr_value_from = (); while (@attrs) { push @attr_key_from, shift @attrs; push @attr_value_from, shift @attrs; } my @attrs_from; # add xmlns: attrs. expat eats them. # # add namespaces before attributes: Attributes may be namespace-qualified # push @attrs_from, map { { Name => "xmlns:$_", Value => $parser->expand_ns_prefix($_), LocalName => $_ } } $parser->new_ns_prefixes(); push @attrs_from, map { { Name => defined $parser->namespace($_) ? $parser->namespace($_) . '|' . $_ : '|' . $_, Value => shift @attr_value_from, # $attrs_of{ $_ }, LocalName => $_ } } @attr_key_from; return @attrs_from; } 1; =pod =head1 NAME SOAP::WSDL::Expat::WSDLParser - Parse WSDL files into object trees =head1 SYNOPSIS my $parser = SOAP::WSDL::Expat::WSDLParser->new(); $parser->parse( $xml ); my $obj = $parser->get_data(); =head1 DESCRIPTION WSDL parser used by SOAP::WSDL. =head1 AUTHOR Replace the whitespace by @ for E-Mail Address. Martin Kutter Emartin.kutter fen-net.deE =head1 LICENSE AND COPYRIGHT Copyright 2004-2007 Martin Kutter. This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself =head1 Repository information $Id: WSDLParser.pm 851 2009-05-15 22:45:18Z kutterma $ $LastChangedDate: 2009-05-16 00:45:18 +0200 (Sa, 16. Mai 2009) $ $LastChangedRevision: 851 $ $LastChangedBy: kutterma $ $HeadURL: https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Expat/WSDLParser.pm $ SOAP-WSDL-2.00.10/lib/SOAP/WSDL/Expat/MessageStreamParser.pm0000444000175000017500000000332611203370730022144 0ustar martinmartin#!/usr/bin/perl package SOAP::WSDL::Expat::MessageStreamParser; use strict; use warnings; use XML::Parser::Expat; use SOAP::WSDL::Expat::MessageParser; use base qw(SOAP::WSDL::Expat::MessageParser); use version; our $VERSION = qv('2.00.10'); sub parse_start { my $self = shift; $self->{ parser } = $_[0]->_initialize( XML::Parser::ExpatNB->new( Namespaces => 1 ) ); } sub init; *init = \&parse_start; sub parse_more { $_[0]->{ parser }->parse_more( $_[1] ); } sub parse_done { $_[0]->{ parser }->parse_done(); $_[0]->{ parser }->release(); } 1; =pod =head1 NAME SOAP::WSDL::Expat::MessageStreamParser - Convert SOAP messages to custom object trees =head1 SYNOPSIS my $lwp = LWP::UserAgent->new(); my $parser = SOAP::WSDL::Expat::MessageParser->new({ class_resolver => 'My::Resolver' }); my $chunk_parser = $parser->init(); # process response while it comes in, trying to read 32k chunks. $lwp->request( $request, sub { $chunk_parser->parse_more($_[0]) } , 32468 ); $chunk_parser->parse_done(); my $obj = $parser->get_data(); =head1 DESCRIPTION ExpatNB based parser for parsing huge documents. See L for details. =head1 Bugs and Limitations See SOAP::WSDL::Expat::MessageParser =head1 AUTHOR Martin Kutter Emartin.kutter fen-net.deE =head1 LICENSE AND COPYRIGHT Copyright 2007 Martin Kutter. This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself =head1 REPOSITORY INFORMATION $Rev: 851 $ $LastChangedBy: kutterma $ $Id: MessageStreamParser.pm 851 2009-05-15 22:45:18Z kutterma $ $HeadURL: https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Expat/MessageStreamParser.pm $ =cut SOAP-WSDL-2.00.10/lib/SOAP/WSDL/Expat/MessageParser.pm0000444000175000017500000002403611203370730020771 0ustar martinmartin#!/usr/bin/perl package SOAP::WSDL::Expat::MessageParser; use strict; use warnings; use SOAP::WSDL::XSD::Typelib::Builtin; use SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType; use base qw(SOAP::WSDL::Expat::Base); BEGIN { require Class::Std::Fast }; use version; our $VERSION = qv('2.00.10'); # GLOBALS my $OBJECT_CACHE_REF = Class::Std::Fast::OBJECT_CACHE_REF(); # keep track of classes loaded my %LOADED_OF = (); sub new { my ($class, $args) = @_; my $self = { class_resolver => $args->{ class_resolver }, strict => exists $args->{ strict } ? $args->{ strict } : 1, }; bless $self, $class; # could be written as && - but Devel::Cover doesn't like that if ($args->{ class_resolver }) { $self->load_classes() if ! exists $LOADED_OF{ $self->{ class_resolver } }; } return $self; } sub class_resolver { my $self = shift; if (@_) { $self->{ class_resolver } = shift; $self->load_classes() if ! exists $LOADED_OF{ $self->{ class_resolver } }; } return $self->{ class_resolver }; } sub load_classes { my $self = shift; return if $LOADED_OF{ $self->{ class_resolver } }; # requires sorting to make sub-packages load after their parent for (sort values %{ $self->{ class_resolver }->get_typemap }) { no strict qw(refs); my $class = $_; # a bad test - do you know a better one? next if $class eq '__SKIP__'; next if defined *{ "$class\::" }; # check if namespace exists # Require takes a bareword or a file name - we have to take # the filname road here... $class =~s{ :: }{/}xmsg; require "$class.pm"; ## no critic (RequireBarewordIncludes) } $LOADED_OF{ $self->{ class_resolver } } = 1; } sub _initialize { my ($self, $parser) = @_; $self->{ parser } = $parser; delete $self->{ data }; # remove potential old results delete $self->{ header }; my $characters; # Note: $current MUST be undef - it is used as sentinel # on the object stack via if (! defined $list->[-1]) # DON'T set it to anything else ! my $current = undef; my $list = []; # node list (object stack) my $path = []; # current path my $skip = 0; # skip elements my $depth = 0; my %content_check = $self->{strict} ? ( 0 => sub { die "Bad top node $_[1]" if $_[1] ne 'Envelope'; die "Bad namespace for SOAP envelope: " . $_[0]->recognized_string() if $_[0]->namespace($_[1]) ne 'http://schemas.xmlsoap.org/soap/envelope/'; $depth++; return; }, 1 => sub { $depth++; if ($_[1] eq 'Body') { if (exists $self->{ data }) { # there was header data $self->{ header } = $self->{ data }; delete $self->{ data }; $list = []; $path = []; undef $current; } } return; } ) : ( 0 => sub { $depth++ }, 1 => sub { $depth++ }, ); # use "globals" for speed my ($_prefix, $_method, $_class, $_leaf) = (); my $char_handler = sub { return if (!$_leaf); # we only want characters in leaf nodes $characters .= $_[1]; # add to characters return; # return void }; no strict qw(refs); $parser->setHandlers( Start => sub { # my ($parser, $element, %attrs) = @_; $_leaf = 1; # believe we're a leaf node until we see an end # call methods without using their parameter stack # That's slightly faster than $content_check{ $depth }->() # and we don't have to pass $_[1] to the method. # Yup, that's dirty. return &{$content_check{ $depth }} if exists $content_check{ $depth }; push @{ $path }, $_[1]; # step down in path return if $skip; # skip inside __SKIP__ # resolve class of this element $_class = $self->{ class_resolver }->get_class( $path ); if (! defined($_class) and $self->{ strict }) { die "Cannot resolve class for " . join('/', @{ $path }) . " via " . $self->{ class_resolver }; } if (! defined($_class) or ($_class eq '__SKIP__') ) { $skip = join('/', @{ $path }); $_[0]->setHandlers( Char => undef ); return; } # step down in tree (remember current) # # on the first object (after skipping Envelope/Body), $current # is undef. # We put it on the stack, anyway, and use it as sentinel when # going through the closing tags in the End handler # push @$list, $current; # cleanup. Mainly here to help profilers find the real hot spots undef $current; # cleanup $characters = q{}; # Create and set new objects using Class::Std::Fast's object cache # if possible, or blessing directly into the class in question # (circumventing constructor) here. # That's dirty, but fast. # # TODO: check whether this is faster under all perls - there's # strange benchmark results... # # The alternative would read: # $current = $_class->new({ @_[2..$#_] }); # $current = pop @{ $OBJECT_CACHE_REF->{ $_class } }; if (not defined $current) { my $o = Class::Std::Fast::ID(); $current = bless \$o, $_class; } # set attributes if there are any ATTR: { if (@_ > 2) { # die Data::Dumper::Dumper(@_[2..$#_]); my %attr = @_[2..$#_]; if (my $nil = delete $attr{nil}) { # TODO: check namespace if ($nil && $nil ne 'false') { undef $characters; last ATTR if not (%attr); } } $current->attr(\%attr); } } $depth++; # TODO: Skip content of anyType / any stuff return; }, Char => $char_handler, End => sub { pop @{ $path }; # step up in path # check __SKIP__ if ($skip) { return if $skip ne join '/', @{ $path }, $_[1]; $skip = 0; $_[0]->setHandlers( Char => $char_handler ); return; } $depth--; # we only set character values in leaf nodes if ($_leaf) { # Use dirty but fast access via global variables. # # The normal way (via method) would be this: # # $current->set_value( $characters ) if (length($characters)); # $SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType::___value ->{ $$current } = $characters if defined $characters && defined $current; # =~m{ [^\s] }xms; } # empty characters $characters = q{}; # stop believing we're a leaf node $_leaf = 0; # return if there's only one elment - can't set it in parent ;-) # but set as root element if we don't have one already. if (not defined $list->[-1]) { $self->{ data } = $current if (not exists $self->{ data }); return; }; # set appropriate attribute in last element # multiple values must be implemented in base class # TODO check if hash access is faster # $_method = "add_$_localname"; $_method = "add_$_[1]"; # # fixup XML names for perl names # $_method =~s{\.}{__}xg; $_method =~s{\-}{_}xg; $list->[-1]->$_method( $current ); $current = pop @$list; # step up in object hierarchy return; } ); return $parser; } sub get_header { return $_[0]->{ header }; } 1; =pod =head1 NAME SOAP::WSDL::Expat::MessageParser - Convert SOAP messages to custom object trees =head1 SYNOPSIS my $parser = SOAP::WSDL::Expat::MessageParser->new({ class_resolver => 'My::Resolver' }); $parser->parse( $xml ); my $obj = $parser->get_data(); =head1 DESCRIPTION Real fast expat based SOAP message parser. See L for details. =head2 Skipping unwanted items Sometimes there's unneccessary information transported in SOAP messages. To skip XML nodes (including all child nodes), just edit the type map for the message, set the type map entry to '__SKIP__', and comment out all child elements you want to skip. =head1 Bugs and Limitations =over =item * Ignores all namespaces =item * Does not handle mixed content =item * The SOAP header is ignored =back =head1 AUTHOR Replace the whitespace by @ for E-Mail Address. Martin Kutter Emartin.kutter fen-net.deE =head1 LICENSE AND COPYRIGHT Copyright 2004-2007 Martin Kutter. This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself =head1 Repository information $Id: MessageParser.pm 851 2009-05-15 22:45:18Z kutterma $ $LastChangedDate: 2009-05-16 00:45:18 +0200 (Sa, 16. Mai 2009) $ $LastChangedRevision: 851 $ $LastChangedBy: kutterma $ $HeadURL: https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Expat/MessageParser.pm $ SOAP-WSDL-2.00.10/lib/SOAP/WSDL/Expat/Base.pm0000444000175000017500000000626011203370730017101 0ustar martinmartinpackage SOAP::WSDL::Expat::Base; use strict; use warnings; use URI; use XML::Parser::Expat; # TODO: convert to Class::Std::Fast based class - hash based classes suck. use version; our $VERSION = qv('2.00.10'); sub new { my ($class, $arg_ref) = @_; my $self = { data => undef, }; bless $self, $class; $self->set_user_agent($arg_ref->{ user_agent }) if $arg_ref->{ user_agent }; $self->{ parsed } = $arg_ref->{ parsed } if $arg_ref->{ parsed }; return $self; } sub clone { my $self = shift; my $class = ref $self; my $clone = $class->new($self); return $clone; } sub set_uri { $_[0]->{ uri } = $_[1]; } sub get_uri { return $_[0]->{ uri }; } sub set_user_agent { $_[0]->{ user_agent } = $_[1]; } sub get_user_agent { return $_[0]->{ user_agent }; } # Mark a URI as "already parsed" sub set_parsed { my ($self, $uri) = @_; $self->{ parsed }->{ $uri } = 1; return; } # returns true if a specific URI has already been parsed sub is_parsed { my ($self, $uri) = @_; return exists $self->{ parsed }->{ $uri }; } # parse a URI. This is the preferred parsing method for WSDL files, as it's # the only one allowing automatic import resolution sub parse_uri { my $self = shift; my $uri = shift; if ($self->is_parsed($uri)){ warn "$uri already imported; ignoring it.\n"; return; } $self->set_parsed($uri); $self->set_uri( $uri ); if (not $self->{ user_agent }) { require LWP::UserAgent; $self->{ user_agent } = LWP::UserAgent->new(); } my $response = $self->{ user_agent }->get($uri); die $response->message() if $response->code() ne '200'; return $self->parse( $response->content() ); } sub parse { eval { $_[0]->_initialize( XML::Parser::Expat->new( Namespaces => 1 ) )->parse( $_[1] ); $_[0]->{ parser }->release(); }; $_[0]->{ parser }->xpcroak( $@ ) if $@; delete $_[0]->{ parser }; return $_[0]->{ data }; } sub parsefile { eval { $_[0]->_initialize( XML::Parser::Expat->new(Namespaces => 1) )->parsefile( $_[1] ); $_[0]->{ parser }->release(); }; $_[0]->{ parser }->xpcroak( $@ ) if $@; delete $_[0]->{ parser }; return $_[0]->{ data }; } # SAX-like aliases sub parse_string; *parse_string = \&parse; sub parse_file; *parse_file = \&parsefile; sub get_data { return $_[0]->{ data }; } 1; =pod =head1 NAME SOAP::WSDL::Expat::Base - Base class for XML::Parser::Expat based XML parsers =head1 DESCRIPTION Base class for XML::Parser::Expat based XML parsers. All XML::SAX::Expat based parsers in SOAP::WSDL inherit from this class. =head1 AUTHOR Replace the whitespace by @ for E-Mail Address. Martin Kutter Emartin.kutter fen-net.deE =head1 LICENSE AND COPYRIGHT Copyright 2004-2007 Martin Kutter. This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself =head1 Repository information $Id: $ $LastChangedDate: 2007-09-10 18:19:23 +0200 (Mo, 10 Sep 2007) $ $LastChangedRevision: 218 $ $LastChangedBy: kutterma $ $HeadURL: https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Expat/MessageParser.pm $ SOAP-WSDL-2.00.10/lib/SOAP/WSDL/Expat/Message2Hash.pm0000444000175000017500000000627311203370730020505 0ustar martinmartin#!/usr/bin/perl package SOAP::WSDL::Expat::Message2Hash; use strict; use warnings; use base qw(SOAP::WSDL::Expat::Base); use version; our $VERSION = qv('2.00.10'); sub _initialize { my ($self, $parser) = @_; $self->{ parser } = $parser; delete $self->{ data }; # remove potential old results my $characters; my $current = {}; my $list = []; # node list my $current_part = q{}; # are we in header or body ? $self->{ data } = $current; # use "globals" for speed my ($_element, $_method, $_class, $_parser, %_attrs) = (); # no strict qw(refs); $parser->setHandlers( Start => sub { push @$list, $current; #If our element exists and is a list ref, add to it if ( exists $current->{ $_[1] } && ( ref ($current->{ $_[1] }) eq 'ARRAY') ) { push @{ $current->{ $_[1] } }, {}; $current = $current->{ $_[1] }->[-1]; } elsif ( exists $current->{ $_[1] } ) { $current->{ $_[1] } = [ $current->{ $_[1] }, {} ]; $current = $current->{ $_[1] }->[-1]; } else { $current->{ $_[1] } = {}; $current = $current->{ $_[1] }; } return; }, Char => sub { $characters .= $_[1] if $_[1] !~m{ \A \s* \z}xms; return; }, End => sub { $_element = $_[1]; # This one easily handles ignores for us, too... # return if not ref $$list[-1]; if (length $characters) { if (ref $list->[-1]->{ $_element } eq 'ARRAY') { $list->[-1]->{ $_element }->[-1] = $characters ; } else { $list->[-1]->{ $_element } = $characters; } } $characters = q{}; $current = pop @$list; # step up in object hierarchy... return; } ); return $parser; } 1; =pod =head1 NAME SOAP::WSDL::Expat::Message2Hash - Convert SOAP messages to perl hash refs =head1 SYNOPSIS my $parser = SOAP::WSDL::Expat::MessageParser->new({ class_resolver => 'My::Resolver' }); $parser->parse( $xml ); my $obj = $parser->get_data(); =head1 DESCRIPTION Real fast expat based SOAP message parser. See L for details. =head1 Bugs and Limitations =over =item * Ignores all namespaces =item * Ignores all attributes =item * Does not handle mixed content =item * The SOAP header is ignored =back =head1 AUTHOR Replace the whitespace by @ for E-Mail Address. Martin Kutter Emartin.kutter fen-net.deE =head1 LICENSE AND COPYRIGHT Copyright 2004-2007 Martin Kutter. This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself =head1 Repository information $Id: $ $LastChangedDate: 2007-09-10 18:19:23 +0200 (Mo, 10 Sep 2007) $ $LastChangedRevision: 218 $ $LastChangedBy: kutterma $ $HeadURL: https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Expat/MessageParser.pm $ SOAP-WSDL-2.00.10/lib/SOAP/WSDL/Factory/0000755000175000017500000000000011203370730016215 5ustar martinmartinSOAP-WSDL-2.00.10/lib/SOAP/WSDL/Factory/Serializer.pm0000444000175000017500000000710711203370730020667 0ustar martinmartinpackage SOAP::WSDL::Factory::Serializer; use strict; use warnings; use version; our $VERSION = qv('2.00.10'); my %SERIALIZER = ( '1.1' => 'SOAP::WSDL::Serializer::XSD', ); # class method sub register { my ($class, $ref_type, $package) = @_; $SERIALIZER{ $ref_type } = $package; } sub get_serializer { my ($self, $args_of_ref) = @_; $args_of_ref->{ soap_version } ||= '1.1'; # sanity check die "no serializer registered for SOAP version $args_of_ref->{ soap_version }" if not exists ($SERIALIZER{ $args_of_ref->{ soap_version } }); # load module eval "require $SERIALIZER{ $args_of_ref->{ soap_version } }" or die "Cannot load serializer $SERIALIZER{ $args_of_ref->{ soap_version } }", $@; return $SERIALIZER{ $args_of_ref->{ soap_version } }->new(); } 1; =pod =head1 NAME SOAP::WSDL::Factory::Serializer - Factory for retrieving serializer objects =head1 SYNOPSIS # from SOAP::WSDL::Client: $serializer = SOAP::WSDL::Factory::Serializer->get_serializer({ soap_version => $soap_version, }); # in serializer class: package MyWickedSerializer; use SOAP::WSDL::Factory::Serializer; # register as serializer for SOAP1.2 messages SOAP::WSDL::Factory::Serializer->register( '1.2' , __PACKAGE__ ); =head1 DESCRIPTION SOAP::WSDL::Factory::Serializer serves as factory for retrieving serializer objects for SOAP::WSDL. The actual work is done by specific serializer classes. SOAP::WSDL::Serializer tries to load one of the following classes: =over =item * the class registered for the scheme via register() =back =head1 METHODS =head2 register SOAP::WSDL::Serializer->register('1.1', 'MyWickedSerializer'); Globally registers a class for use as serializer class. =head2 get_serializer Returns an object of the serializer class for this endpoint. =head1 WRITING YOUR OWN SERIALIZER CLASS =head2 Registering a deserializer Serializer classes may register with SOAP::WSDL::Factory::Serializer. Serializer objects may also be passed directly to SOAP::WSDL::Client by using the set_serializer method. Note that serializers objects set via SOAP::WSDL::Client's set_serializer method are discarded when the SOAP version is changed via set_soap_version. Registering a serializer class with SOAP::WSDL::Factory::Serializer is done by executing the following code where $version is the SOAP version the class should be used for, and $class is the class name. SOAP::WSDL::Factory::Serializer->register( $version, $class); To auto-register your transport class on loading, execute register() in your tranport class (see L above). =head2 Serializer package layout Serializer modules must be named equal to the serializer class they contain. There can only be one serializer class per serializer module. =head2 Methods to implement Serializer classes must implement the following methods: =over =item * new Constructor. =item * serialize Serializes data to XML. The following named parameters are passed to the serialize method in a anonymous hash ref: { method => $operation_name, header => $header_data, body => $body_data, } =back =head1 LICENSE AND COPYRIGHT Copyright 2004-2007 Martin Kutter. All rights reserved. This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself. =head1 AUTHOR Martin Kutter Emartin.kutter fen-net.deE =head1 REPOSITORY INFORMATION $Rev: 851 $ $LastChangedBy: kutterma $ $Id: Serializer.pm 851 2009-05-15 22:45:18Z kutterma $ $HeadURL: https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Factory/Serializer.pm $ =cut SOAP-WSDL-2.00.10/lib/SOAP/WSDL/Factory/Generator.pm0000444000175000017500000000732611203370730020507 0ustar martinmartinpackage SOAP::WSDL::Factory::Generator; use strict; use warnings; use version; our $VERSION = qv('2.00.10'); my %GENERATOR = ( 'XSD' => 'SOAP::WSDL::Generator::Template::XSD', ); # class method sub register { my ($class, $ref_type, $package) = @_; $GENERATOR{ $ref_type } = $package; } sub get_generator { my ($self, $args_of_ref) = @_; # sanity check # die "no generator registered for generation method $args_of_ref->{ type }" # my $generator_class = (exists ($GENERATOR{ $args_of_ref->{ type } })) ? $GENERATOR{ $args_of_ref->{ type } } : $args_of_ref->{ type }; # load module eval "require $generator_class" or die "Cannot load generator $generator_class", $@; return $generator_class->new(); } 1; =pod =head1 NAME SOAP::WSDL::Factory:Generator - Factory for retrieving generator objects =head1 SYNOPSIS # from SOAP::WSDL::Client: $generator = SOAP::WSDL::Factory::Generator->get_generator({ soap_version => $soap_version, }); # in generator class: package MyWickedGenerator; use SOAP::WSDL::Factory::Generator; # register as generator for SOAP1.2 messages SOAP::WSDL::Factory::Generator->register( '1.2' , __PACKAGE__ ); =head1 DESCRIPTION SOAP::WSDL::Factory::Generator serves as factory for retrieving generator objects for SOAP::WSDL. The actual work is done by specific generator classes. SOAP::WSDL::Generator tries to load one of the following classes: =over =item * the class registered for the scheme via register() =back =head1 METHODS =head2 register SOAP::WSDL::Generator->register('Lite', 'MyWickedGenerator'); Globally registers a class for use as generator class. =head2 get_generator Returns an object of the generator class for this endpoint. =head1 WRITING YOUR OWN GENERATOR CLASS =head2 Registering a generator Generator classes may register with SOAP::WSDL::Factory::Generator. Registering a generator class with SOAP::WSDL::Factory::Generator is done by executing the following code where $version is the SOAP version the class should be used for, and $class is the class name. SOAP::WSDL::Factory::Generator->register( $version, $class); To auto-register your transport class on loading, execute register() in your generator class (see L above). =head2 Generator package layout Generator modules must be named equal to the generator class they contain. There can only be one generator class per generator module. =head2 Methods to implement Generator classes must implement the following methods: =over =item * new Constructor. =item * generate Generate SOAP interface =back Generators may implements one or more of the following configuration methods. All of them are tried via can() by wsdl2perl. =over =item * set_wsdl Set the raw WSDL XML. Implement if you have your own WSDL parser. =item * set_definitions Sets the (parsed) SOAP::WSDL::Definitions object. =item * set_type_prefix Sets the prefix for XML Schema type classes =item * set_element_prefix Sets the prefix for XML Schema element classes =item * set_typemap_prefix Sets the prefix for typemap classes (class resolvers). =item * set_interface_prefix Sets the prefix for interface classes =item * set_typemap Set user-defined typemap snippet =back =head1 LICENSE AND COPYRIGHT Copyright 2007 Martin Kutter. All rights reserved. This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself =head1 AUTHOR Martin Kutter Emartin.kutter fen-net.deE =head1 REPOSITORY INFORMATION $Rev: 176 $ $LastChangedBy: kutterma $ $Id: Serializer.pm 176 2007-08-31 15:28:29Z kutterma $ $HeadURL: https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Factory/Serializer.pm $ =cut SOAP-WSDL-2.00.10/lib/SOAP/WSDL/Factory/Transport.pm0000444000175000017500000001570611203370730020556 0ustar martinmartinpackage SOAP::WSDL::Factory::Transport; use strict; use warnings; use version; our $VERSION = qv('2.00.10'); my %registered_transport_of = (); # Local constants # Could be made readonly, but that's just for the paranoid... my %SOAP_LITE_TRANSPORT_OF = ( ftp => 'SOAP::Transport::FTP', http => 'SOAP::Transport::HTTP', https => 'SOAP::Transport::HTTP', mailto => 'SOAP::Transport::MAILTO', 'local' => 'SOAP::Transport::LOCAL', jabber => 'SOAP::Transport::JABBER', mq => 'SOAP::Transport::MQ', ); my %SOAP_WSDL_TRANSPORT_OF = ( http => 'SOAP::WSDL::Transport::HTTP', https => 'SOAP::WSDL::Transport::HTTP', ); # class methods only sub register { my ($class, $scheme, $package) = @_; die "Cannot use reference as scheme" if ref $scheme; $registered_transport_of{ $scheme } = $package; } sub get_transport { my ($class, $url, %attrs) = @_; my $scheme = $url; $scheme =~s{ \:.+$ }{}xm; if (defined $registered_transport_of{ $scheme }) { no strict qw(refs); $registered_transport_of{ $scheme }->can('new') or eval "require $registered_transport_of{ $scheme }" or die "Cannot load transport class $registered_transport_of{ $scheme } : $@"; # try "foo::Client" class first - SOAP::Tranport always requires # a package withoug the ::Client appended, and then # instantiates a ::Client object... # ... pretty weird ... # ... must be from some time when the max number of files was a # sparse resource ... # ... but we've decided to mimic SOAP::Lite... return $registered_transport_of{ $scheme }->new( %attrs ); } # try SOAP::Lite's Transport module - just skip if not require'able SOAP_Lite: { if (exists $SOAP_LITE_TRANSPORT_OF{ $scheme }) { no strict qw(refs); # behaves interestingly different under different versions of perl # maybe true even if it's not available my $protocol_class = $SOAP_LITE_TRANSPORT_OF{ $scheme } . '::Client'; $protocol_class->can('new') or eval "require $SOAP_LITE_TRANSPORT_OF{ $scheme }" or last SOAP_Lite; # may fail if it's not available my $transport = eval { $protocol_class->new( %attrs ) } or last SOAP_Lite; return $transport; } } if (exists $SOAP_WSDL_TRANSPORT_OF{ $scheme }) { no strict qw(refs); $SOAP_WSDL_TRANSPORT_OF{ $scheme }->can('new') or eval "require $SOAP_WSDL_TRANSPORT_OF{ $scheme }" or die "Cannot load transport class $SOAP_WSDL_TRANSPORT_OF{ $scheme } : $@"; return $SOAP_WSDL_TRANSPORT_OF{ $scheme }->new( %attrs ); } die "no transport class found for scheme <$scheme>"; } 1; =pod =head1 NAME SOAP::WSDL::Factory::Transport - Factory for retrieving transport objects =head1 SYNOPSIS # from SOAP::WSDL::Client: $transport = SOAP::WSDL::Factory::Transport->get_transport( $url, @opt ); # in transport class: package MyWickedTransport; use SOAP::WSDL::Factory::Transport; # register class as transport module for httpr and https # (httpr is "reliable http", a protocol developed by IBM). SOAP::WSDL::Factory::Transport->register( 'httpr' , __PACKAGE__ ); SOAP::WSDL::Factory::Transport->register( 'https' , __PACKAGE__ ); =head1 DESCRIPTION SOAP::WSDL::Transport serves as factory for retrieving transport objects for SOAP::WSDL. The actual work is done by specific transport classes. SOAP::WSDL::Transport tries to load one of the following classes: =over =item * the class registered for the scheme via register() =item * the SOAP::Lite class matching the scheme =item * the SOAP::WSDL class matching the scheme =back =head1 METHODS =head2 register SOAP::WSDL::Transport->register('https', 'MyWickedTransport'); Globally registers a class for use as transport class. =head2 proxy $trans->proxy('http://soap-wsdl.sourceforge.net'); Sets the proxy (endpoint). Returns the transport for this protocol. =head2 set_transport Sets the current transport object. =head2 get_transport Gets the current transport object. =head1 WRITING YOUR OWN TRANSPORT CLASS =head2 Registering a transport class Transport classes must be registered with SOAP::WSDL::Factory::Transport. This is done by executing the following code where $scheme is the URL scheme the class should be used for, and $module is the class' module name. SOAP::WSDL::Factory::Transport->register( $scheme, $module); To auto-register your transport class on loading, execute register() in your tranport class (see L above). Multiple protocols or multiple classes are registered by multiple calls to register(). =head2 Transport plugin package layout You may only use transport classes whose name is either the module name or the module name with '::Client' appended. =head2 Methods to implement Transport classes must implement the interface required for SOAP::Lite transport classes (see L for details, L for an example). To provide this interface, transport modules must implement the following methods: =over =item * new =item * send_receive Dispatches a request and returns the content of the response. =item * code Returns the status code of the last send_receive call (if any). =item * message Returns the status message of the last send_receive call (if any). =item * status Returns the status of the last send_receive call (if any). =item * is_success Returns true after a send_receive was successful, false if it was not. =back SOAP::Lite requires transport modules to pack client and server classes in one file, and to follow this naming scheme: Module name: "SOAP::Transport::" . uc($scheme) Client class (additional package in module): "SOAP::Transport::" . uc($scheme) . "::Client" Server class (additional package in module): "SOAP::Transport::" . uc($scheme) . "::Client" SOAP::WSDL does not require you to follow these restrictions. There is only one restriction in SOAP::WSDL: You may only use transport classes whose name is either the module name or the module name with '::Client' appended. SOAP::WSDL will try to instantiate an object of your transport class with '::Client' appended to allow using transport classes written for SOAP::Lite. This may lead to errors when a different module with the name of your transport module suffixed with ::Client is also loaded. =head1 LICENSE AND COPYRIGHT Copyright 2004-2007 Martin Kutter. All rights reserved. This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself =head1 AUTHOR Martin Kutter Emartin.kutter fen-net.deE =head1 REPOSITORY INFORMATION $Rev: 851 $ $LastChangedBy: kutterma $ $Id: Transport.pm 851 2009-05-15 22:45:18Z kutterma $ $HeadURL: https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Factory/Transport.pm $ =cut SOAP-WSDL-2.00.10/lib/SOAP/WSDL/Factory/Deserializer.pm0000444000175000017500000000773211203370730021204 0ustar martinmartinpackage SOAP::WSDL::Factory::Deserializer; use strict; use warnings; use version; our $VERSION = qv('2.00.10'); my %DESERIALIZER = ( '1.1' => 'SOAP::WSDL::Deserializer::XSD', ); # class method sub register { my ($class, $ref_type, $package) = @_; $DESERIALIZER{ $ref_type } = $package; } sub get_deserializer { my ($self, $args_of_ref) = @_; $args_of_ref->{ soap_version } ||= '1.1'; # sanity check die "no deserializer registered for SOAP version $args_of_ref->{ soap_version }" if not exists ($DESERIALIZER{ $args_of_ref->{ soap_version } }); # load module eval "require $DESERIALIZER{ $args_of_ref->{ soap_version } }" or die "Cannot load serializer $DESERIALIZER{ $args_of_ref->{ soap_version } }", $@; return $DESERIALIZER{ $args_of_ref->{ soap_version } }->new($args_of_ref); } 1; =pod =head1 NAME SOAP::WSDL::Factory::Deserializer - Factory for retrieving Deserializer objects =head1 SYNOPSIS # from SOAP::WSDL::Client: $deserializer = SOAP::WSDL::Factory::Deserializer->get_deserializer({ soap_version => $soap_version, class_resolver => $class_resolver, }); # in deserializer class: package MyWickedDeserializer; use SOAP::WSDL::Factory::Deserializer; # register class as deserializer for SOAP1.2 messages SOAP::WSDL::Factory::Deserializer->register( '1.2' , __PACKAGE__ ); =head1 DESCRIPTION SOAP::WSDL::Factory::Deserializer serves as factory for retrieving deserializer objects for SOAP::WSDL. The actual work is done by specific deserializer classes. SOAP::WSDL::Deserializer tries to load one of the following classes: =over =item * The class registered for the scheme via register() =back By default, L is registered for SOAP1.1 messages. =head1 METHODS =head2 register SOAP::WSDL::Deserializer->register('1.1', 'MyWickedDeserializer'); Globally registers a class for use as deserializer class. =head2 get_deserializer Returns an object of the deserializer class for this endpoint. =head1 WRITING YOUR OWN DESERIALIZER CLASS Deserializer classes may register with SOAP::WSDL::Factory::Deserializer. =head2 Registering a deserializer Registering a deserializer class with SOAP::WSDL::Factory::Deserializer is done by executing the following code where $version is the SOAP version the class should be used for, and $class is the class name. SOAP::WSDL::Factory::Deserializer->register( $version, $class); To auto-register your transport class on loading, execute register() in your tranport class (see L above). =head2 Deserializer package layout Deserializer modules must be named equal to the deserializer class they contain. There can only be one deserializer class per deserializer module. =head2 Methods to implement Deserializer classes must implement the following methods: =over =item * new Constructor. =item * deserialize Deserialize data from XML to arbitrary formats. deserialize() must return a fault indicating that deserializing failed if any error is encountered during the process of deserializing the XML message. The following positional parameters are passed to the deserialize method: $content - the xml message =item * generate_fault Generate a fault in the supported format. The following named parameters are passed as a single hash ref: code - The fault code, e.g. 'soap:Server' or the like role - The fault role (actor in SOAP1.1) message - The fault message (faultstring in SOAP1.1) =back =head1 LICENSE AND COPYRIGHT Copyright 2007 Martin Kutter. All rights reserved. This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself =head1 AUTHOR Martin Kutter Emartin.kutter fen-net.deE =head1 REPOSITORY INFORMATION $Rev: 176 $ $LastChangedBy: kutterma $ $Id: Serializer.pm 176 2007-08-31 15:28:29Z kutterma $ $HeadURL: https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Factory/Serializer.pm $ =cut SOAP-WSDL-2.00.10/lib/SOAP/WSDL/SOAP/0000755000175000017500000000000011203370730015350 5ustar martinmartinSOAP-WSDL-2.00.10/lib/SOAP/WSDL/SOAP/Address.pm0000444000175000017500000000033711203370730017274 0ustar martinmartinpackage SOAP::WSDL::SOAP::Address; use strict; use warnings; use base qw(SOAP::WSDL::Base); use Class::Std::Fast::Storable; use version; our $VERSION = qv('2.00.10'); my %location :ATTR(:name :default<()>); 1;SOAP-WSDL-2.00.10/lib/SOAP/WSDL/SOAP/Body.pm0000444000175000017500000000067111203370730016605 0ustar martinmartinpackage SOAP::WSDL::SOAP::Body; use strict; use warnings; use base qw(SOAP::WSDL::Base); use Class::Std::Fast::Storable; use version; our $VERSION = qv('2.00.10'); my %use_of :ATTR(:name :default); my %namespace_of :ATTR(:name :default); my %encodingStyle_of :ATTR(:name :default); my %parts_of :ATTR(:name :default); 1;SOAP-WSDL-2.00.10/lib/SOAP/WSDL/SOAP/Typelib/0000755000175000017500000000000011203370730016760 5ustar martinmartinSOAP-WSDL-2.00.10/lib/SOAP/WSDL/SOAP/Typelib/Fault.pm0000444000175000017500000000025111203370730020365 0ustar martinmartinpackage SOAP::WSDL::SOAP::Typelib::Fault; use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none'; use version; our $VERSION = qv('2.00.10'); 1;SOAP-WSDL-2.00.10/lib/SOAP/WSDL/SOAP/Typelib/Fault11.pm0000444000175000017500000001116511203370730020535 0ustar martinmartinpackage SOAP::WSDL::SOAP::Typelib::Fault11; { use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none'; use version; our $VERSION = qv('2.00.10'); use Scalar::Util qw(blessed); use SOAP::WSDL::XSD::Typelib::ComplexType; use SOAP::WSDL::XSD::Typelib::Element; use base qw( SOAP::WSDL::SOAP::Typelib::Fault SOAP::WSDL::XSD::Typelib::Element SOAP::WSDL::XSD::Typelib::ComplexType ); my %faultcode_of : ATTR(:get); my %faultstring_of : ATTR(:get); my %faultactor_of : ATTR(:get); my %detail_of : ATTR(:get); __PACKAGE__->_factory( [qw(faultcode faultstring faultactor detail)], { faultcode => \%faultcode_of, faultstring => \%faultstring_of, faultactor => \%faultactor_of, detail => \%detail_of, }, { faultcode => 'SOAP::WSDL::XSD::Typelib::Builtin::QName', faultstring => 'SOAP::WSDL::XSD::Typelib::Builtin::string', faultactor => 'SOAP::WSDL::XSD::Typelib::Builtin::anyURI', detail => 'SOAP::WSDL::SOAP::Typelib::Fault11Detail', } ); sub get_xmlns { return 'http://schemas.xmlsoap.org/soap/envelope/' } __PACKAGE__->__set_name('Fault'); __PACKAGE__->__set_nillable(0); __PACKAGE__->__set_minOccurs(); __PACKAGE__->__set_maxOccurs(); __PACKAGE__->__set_ref(''); # always return false in boolean context - a fault is never true... sub as_bool : BOOLIFY { return; } # override set_detail to allow "auto-vivification" of a details object # must be implemented via symbol table operation - _factory adds # methods via symbol table, too. # BLOCK to scope warnings { no warnings qw(redefine); my $set_detail_sub = \&set_detail; *set_detail = sub { my ( $self, $detail ) = @_; # create SOAP::WSDL::SOAP::Typelib::Fault11Detail wrapper if there # is none if ( not blessed $detail or not $detail->isa('SOAP::WSDL::SOAP::Typelib::Fault11Detail') ) { $detail = SOAP::WSDL::SOAP::Typelib::Fault11Detail->new( {value => $detail} ); } # call original method $set_detail_sub->( $self, $detail ); }; } Class::Std::initialize(); } package SOAP::WSDL::SOAP::Typelib::Fault11Detail; { use strict; use warnings; use Class::Std::Fast::Storable constructor => 'none'; use base qw( SOAP::WSDL::XSD::Typelib::Element SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType ); sub get_xmlns { return 'http://schemas.xmlsoap.org/soap/envelope/' } __PACKAGE__->__set_name('Fault'); __PACKAGE__->__set_nillable(0); __PACKAGE__->__set_minOccurs(); __PACKAGE__->__set_maxOccurs(); Class::Std::initialize(); } 1; =pod =head1 NAME SOAP::WSDL::SOAP::Typelib::Fault11 - SOAP 1.1 Fault class =head1 DESCRIPTION Models a SOAP 1.1 Fault. SOAP::WSDL::SOAP::Typelib::Fault11 objects are false in boolean context and serialize to XML on stringification. This means you can do something like: my $soap = SOAP::WSDL::Client->new(); # ... my $result = $soap->call($method, $data); if (not $result) { die "Error calling SOAP method: ", $result->get_faultstring(); } =head1 METHODS =head2 get_faultcode / set_faultcode Getter/setter for object's faultcode property. =head2 get_faultstring / set_faultstring Getter/setter for object's faultstring property. =head2 get_faultactor / set_faultactor Getter/setter for object's faultactor property. =head2 get_detail / set_detail Getter/setter for detail object's detail property. The detail element is a SOAP::WSDL::SOAP::Typelib::Fault11Detail object. This class is automatically loaded when using SOAP::WSDL::SOAP::Typelib::Fault11, so you can't B it separately. Any string or object not of this class will be automatically wrapped into a detail object. Note that passing a list of detail object is currently not supported (though the SOAP1.1 note allows this). =head1 LICENSE AND COPYRIGHT Copyright 2007 Martin Kutter. All rights reserved. This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself =head1 AUTHOR Martin Kutter Emartin.kutter fen-net.deE =head1 REPOSITORY INFORMATION $Rev: 851 $ $LastChangedBy: kutterma $ $Id: Fault11.pm 851 2009-05-15 22:45:18Z kutterma $ $HeadURL: https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/SOAP/Typelib/Fault11.pm $ =cut SOAP-WSDL-2.00.10/lib/SOAP/WSDL/SOAP/Operation.pm0000444000175000017500000000042711203370730017647 0ustar martinmartinpackage SOAP::WSDL::SOAP::Operation; use strict; use warnings; use Class::Std::Fast::Storable; use base qw(SOAP::WSDL::Base); use version; our $VERSION = qv('2.00.10'); my %style_of :ATTR(:name