diff --git a/Build.PL b/Build.PL index e344043..5c84976 100644 --- a/Build.PL +++ b/Build.PL @@ -5,7 +5,7 @@ $build = Module::Build->new( create_makefile_pl => 'small', dist_abstract => 'SOAP with WSDL support', dist_name => 'SOAP-WSDL', - dist_version => '2.00_33', + dist_version => '2.00.01', module_name => 'SOAP::WSDL', license => 'artistic', requires => { diff --git a/Changes b/Changes index 5d29f66..f8c3b68 100644 --- a/Changes +++ b/Changes @@ -1,7 +1,7 @@ -Release notes for SOAP::WSDL 2.00_33 +Release notes for SOAP::WSDL 2.00.01 ------- -I'm proud to present a new pre-release version of SOAP::WSDL. +I'm proud to present a new release of SOAP::WSDL. SOAP::WSDL is a toolkit for creating WSDL-based SOAP client interfaces in perl. @@ -15,6 +15,8 @@ Features: * Easy-to use API o Automatically encodes perl data structures as message data o Automatically sets HTTP headers right + o Datatypes provide hints on method names on calls to non-existant + methods * Efficient documentation o SOAP::WSDL::Manual guides you at getting your work done, not at the module's internals @@ -23,17 +25,58 @@ Features: over 95% (excluding documentation - you wouldn't want to read through it all). * SOAP::Lite like look and feel - o Where possible, SOAP::WSDL mimics SOAP::Lite's API to allow easy migrations + o Where possible, SOAP::WSDL mimics SOAP::Lite's API to allow easy migration * XML schema based class library for creating data objects * High-performance XML parser * Plugin support. SOAP::WSDL can be extended through plugins in various aspects. The following plugins are supported: o Transport plugins via SOAP::WSDL::Factory::Transport o Serializer plugins via SOAP::WSDL::Factory::Serializer - o Deserializer plugins via SOAP::WSDL::Factory::Serializer + o Deserializer plugins via SOAP::WSDL::Factory::Deserializer The following changes have been made: +2.00.01 + +The following features were added (the numbers in square brackets are the +tracker IDs from https://sourceforge.net/tracker/?group_id=111978&atid=660924): + + * [ 1941134 ] Server for mod_perl2. Thanks to Noah Robin for contributing. + +The following bugs have been fixed (the numbers in square brackets are the +tracker IDs from https://sourceforge.net/tracker/?group_id=111978&atid=660921): +The numbers with # are CPAN RT IDs (http://rt.cpan.org/). + + * [ 1944368 ] SOAP/WSDL/XSD/Typelib/SimpleType.pm spelling + * [ 1944367 ] SOAP/WSDL/XSD/Typelib/ComplexType.pm spelling + * [ 1944364 ] SOAP/WSDL/XSD/Typelib/Builtin.pm spelling + * [ 1944362 ] SOAP/WSDL/SOAP/Typelib/Fault11.pm spelling + * [ 1944361 ] SOAP/WSDL/Generator/Visitor.pm spelling + * [ 1944360 ] SOAP/WSDL/Generator/Iterator/WSDL11.pm spelling + * [ 1944359 ] SOAP::WSDL::Factory::Transport spelling + * [ 1944355 ] SOAP::WSDL::Deserializer::XSD.pm spelling + Thanks to "nobody" for correcting these errors. + + * [ 1942576 ] SOAP/WSDL/Deserializer/SOM.pm spelling. + * [ 1942568 ] SOAP/WSDL/Client.pm minor spelling/grammar/style cleanup. + * [ 1942562 ] WSDL.pm spelling corrections. + Thanks to Noah Robin for providing patches for these errors. + + * #34642 booleans in WSDL attributes don't get converted to perl's + representation (for now - not all attributes covered yet) + * #34714: MessageParser misses character data in elements just below SOAP-ENV:Body + * #34688: wsdl2perl.pl croaks when WSDL operation uses a header + +The following uncategorized improvements have been made: + + * Storable freeze/thaw speedup in conjunction with upcoming version of + Class::Std::Fast + * improved server doc generation + * improved xsi:nil handling + * serializing an attribute from http://www.w3.org/XML/1998/namespace now + serializes it with xml: prefix. This should probably be moved into the + generator, to avoid testing every attribute + 2.00_33 - Mar 30 2008 The following features were added (the numbers in square brackets are the diff --git a/META.yml b/META.yml index 9580def..f27aa1f 100644 --- a/META.yml +++ b/META.yml @@ -1,6 +1,6 @@ --- name: SOAP-WSDL -version: 2.00_33 +version: 2.00.01 author: - 'Martin Kutter ' abstract: SOAP with WSDL support @@ -41,191 +41,214 @@ build_requires: provides: SOAP::WSDL: file: lib/SOAP/WSDL.pm - version: 2.00_33 + version: 2.00.01 SOAP::WSDL::Base: file: lib/SOAP/WSDL/Base.pm - version: 2.00_27 + version: 2.00.01 SOAP::WSDL::Binding: file: lib/SOAP/WSDL/Binding.pm + version: 2.00.01 SOAP::WSDL::Client: file: lib/SOAP/WSDL/Client.pm - version: 2.00_27 + version: 2.00.01 SOAP::WSDL::Client::Base: file: lib/SOAP/WSDL/Client/Base.pm - version: 2.00_33 + version: 2.00.01 SOAP::WSDL::Definitions: file: lib/SOAP/WSDL/Definitions.pm - version: 2.00_33 + version: 2.00.01 SOAP::WSDL::Deserializer::Hash: file: lib/SOAP/WSDL/Deserializer/Hash.pm - version: 2.00_25 + version: 2.00.01 SOAP::WSDL::Deserializer::SOM: file: lib/SOAP/WSDL/Deserializer/SOM.pm - version: 2.00_24 + version: 2.00.01 SOAP::WSDL::Deserializer::XSD: file: lib/SOAP/WSDL/Deserializer/XSD.pm - version: 2.00_25 + version: 2.00.01 SOAP::WSDL::Expat::Base: file: lib/SOAP/WSDL/Expat/Base.pm - version: 2.00_32 + version: 2.00.01 SOAP::WSDL::Expat::Message2Hash: file: lib/SOAP/WSDL/Expat/Message2Hash.pm - version: 2.00_27 + version: 2.00.01 SOAP::WSDL::Expat::MessageParser: file: lib/SOAP/WSDL/Expat/MessageParser.pm - version: 2.00_27 + version: 2.00.01 SOAP::WSDL::Expat::MessageStreamParser: file: lib/SOAP/WSDL/Expat/MessageStreamParser.pm - version: 2.00_24 + version: 2.00.01 SOAP::WSDL::Factory::Deserializer: file: lib/SOAP/WSDL/Factory/Deserializer.pm - version: 2.00_24 + version: 2.00.01 SOAP::WSDL::Factory::Generator: file: lib/SOAP/WSDL/Factory/Generator.pm - version: 2.00_24 + version: 2.00.01 SOAP::WSDL::Factory::Serializer: file: lib/SOAP/WSDL/Factory/Serializer.pm - version: 2.00_24 + version: 2.00.01 SOAP::WSDL::Factory::Transport: file: lib/SOAP/WSDL/Factory/Transport.pm - version: 2.00_33 + version: 2.00.01 SOAP::WSDL::Generator::Iterator::WSDL11: file: lib/SOAP/WSDL/Generator/Iterator/WSDL11.pm + version: 2.00.01 SOAP::WSDL::Generator::PrefixResolver: file: lib/SOAP/WSDL/Generator/PrefixResolver.pm + version: 2.00.01 SOAP::WSDL::Generator::Template: file: lib/SOAP/WSDL/Generator/Template.pm - version: v2.0033 + version: 2.00.01 SOAP::WSDL::Generator::Template::Plugin::XSD: file: lib/SOAP/WSDL/Generator/Template/Plugin/XSD.pm + version: 2.00.01 SOAP::WSDL::Generator::Template::XSD: file: lib/SOAP/WSDL/Generator/Template/XSD.pm - version: 2.00_27 + version: 2.00.01 SOAP::WSDL::Generator::Visitor: file: lib/SOAP/WSDL/Generator/Visitor.pm - version: 2.00_25 + version: 2.00.01 SOAP::WSDL::Generator::Visitor::Typelib: file: lib/SOAP/WSDL/Generator/Visitor/Typelib.pm + version: 2.00.01 SOAP::WSDL::Generator::Visitor::Typemap: file: lib/SOAP/WSDL/Generator/Visitor/Typemap.pm - version: 2.00_25 + version: 2.00.01 SOAP::WSDL::Message: file: lib/SOAP/WSDL/Message.pm + version: 2.00.01 SOAP::WSDL::OpMessage: file: lib/SOAP/WSDL/OpMessage.pm + version: 2.00.01 SOAP::WSDL::Operation: file: lib/SOAP/WSDL/Operation.pm + version: 2.00.01 SOAP::WSDL::Part: file: lib/SOAP/WSDL/Part.pm + version: 2.00.01 SOAP::WSDL::Port: file: lib/SOAP/WSDL/Port.pm + version: 2.00.01 SOAP::WSDL::PortType: file: lib/SOAP/WSDL/PortType.pm + version: 2.00.01 SOAP::WSDL::SOAP::Address: file: lib/SOAP/WSDL/SOAP/Address.pm + version: 2.00.01 SOAP::WSDL::SOAP::Body: file: lib/SOAP/WSDL/SOAP/Body.pm + version: 2.00.01 SOAP::WSDL::SOAP::Header: file: lib/SOAP/WSDL/SOAP/Header.pm + version: 2.00.01 SOAP::WSDL::SOAP::HeaderFault: file: lib/SOAP/WSDL/SOAP/HeaderFault.pm + version: 2.00.01 SOAP::WSDL::SOAP::Operation: file: lib/SOAP/WSDL/SOAP/Operation.pm - version: 2.00_25 + version: 2.00.01 SOAP::WSDL::SOAP::Typelib::Fault11: file: lib/SOAP/WSDL/SOAP/Typelib/Fault11.pm - version: 2.00_25 + version: 2.00.01 SOAP::WSDL::Serializer::XSD: file: lib/SOAP/WSDL/Serializer/XSD.pm - version: 2.00_27 + version: 2.00.01 SOAP::WSDL::Server: file: lib/SOAP/WSDL/Server.pm - version: 2.00_27 + version: 2.00.01 SOAP::WSDL::Server::CGI: file: lib/SOAP/WSDL/Server/CGI.pm - version: 2.00_33 + version: 2.00.01 SOAP::WSDL::Service: file: lib/SOAP/WSDL/Service.pm + version: 2.00.01 SOAP::WSDL::Transport::HTTP: file: lib/SOAP/WSDL/Transport/HTTP.pm + version: 2.00.01 SOAP::WSDL::Transport::Loopback: file: lib/SOAP/WSDL/Transport/Loopback.pm - version: 2.00_25 + version: 2.00.01 SOAP::WSDL::Transport::Test: file: lib/SOAP/WSDL/Transport/Test.pm - version: 2.00_25 + version: 2.00.01 SOAP::WSDL::TypeLookup: file: lib/SOAP/WSDL/TypeLookup.pm - version: 2.00_31 + version: 2.00.01 SOAP::WSDL::Types: file: lib/SOAP/WSDL/Types.pm + version: 2.00.01 SOAP::WSDL::XSD::Annotation: file: lib/SOAP/WSDL/XSD/Annotation.pm - version: 2.00_33 + version: 2.00.01 SOAP::WSDL::XSD::Attribute: file: lib/SOAP/WSDL/XSD/Attribute.pm - version: 2.00_29 + version: 2.00.01 SOAP::WSDL::XSD::AttributeGroup: file: lib/SOAP/WSDL/XSD/AttributeGroup.pm - version: 2.00_29 + version: 2.00.01 SOAP::WSDL::XSD::Builtin: file: lib/SOAP/WSDL/XSD/Builtin.pm + version: 2.00.01 SOAP::WSDL::XSD::ComplexType: file: lib/SOAP/WSDL/XSD/ComplexType.pm - version: 2.00_33 + version: 2.00.01 SOAP::WSDL::XSD::Element: file: lib/SOAP/WSDL/XSD/Element.pm - version: 2.00_25 + version: 2.00.01 SOAP::WSDL::XSD::Enumeration: file: lib/SOAP/WSDL/XSD/Enumeration.pm - version: 2.00_33 + version: 2.00.01 + SOAP::WSDL::XSD::FractionDigits: + file: lib/SOAP/WSDL/XSD/FractionDigits.pm + version: 2.00.01 SOAP::WSDL::XSD::Group: file: lib/SOAP/WSDL/XSD/Group.pm - version: 2.00_33 + version: 2.00.01 SOAP::WSDL::XSD::Length: file: lib/SOAP/WSDL/XSD/Length.pm - version: 2.00_33 + version: 2.00.01 SOAP::WSDL::XSD::MaxExclusive: file: lib/SOAP/WSDL/XSD/MaxExclusive.pm - version: 2.00_33 + version: 2.00.01 SOAP::WSDL::XSD::MaxInclusive: file: lib/SOAP/WSDL/XSD/MaxInclusive.pm - version: 2.00_33 + version: 2.00.01 SOAP::WSDL::XSD::MaxLength: file: lib/SOAP/WSDL/XSD/MaxLength.pm - version: 2.00_33 + version: 2.00.01 SOAP::WSDL::XSD::MinExclusive: file: lib/SOAP/WSDL/XSD/MinExclusive.pm - version: 2.00_33 + version: 2.00.01 SOAP::WSDL::XSD::MinInclusive: file: lib/SOAP/WSDL/XSD/MinInclusive.pm - version: 2.00_33 + version: 2.00.01 SOAP::WSDL::XSD::MinLength: file: lib/SOAP/WSDL/XSD/MinLength.pm - version: 2.00_33 + version: 2.00.01 SOAP::WSDL::XSD::Pattern: file: lib/SOAP/WSDL/XSD/Pattern.pm - version: 2.00_33 + version: 2.00.01 SOAP::WSDL::XSD::Schema: file: lib/SOAP/WSDL/XSD/Schema.pm - version: 2.00_33 + version: 2.00.01 SOAP::WSDL::XSD::Schema::Builtin: file: lib/SOAP/WSDL/XSD/Schema/Builtin.pm + version: 2.00.01 SOAP::WSDL::XSD::SimpleType: file: lib/SOAP/WSDL/XSD/SimpleType.pm - version: 2.00_25 + version: 2.00.01 SOAP::WSDL::XSD::TotalDigits: file: lib/SOAP/WSDL/XSD/TotalDigits.pm - version: 2.00_33 + version: 2.00.01 SOAP::WSDL::XSD::Typelib::Attribute: file: lib/SOAP/WSDL/XSD/Typelib/Attribute.pm - version: 2.00_29 + version: 2.00.01 SOAP::WSDL::XSD::Typelib::AttributeSet: file: lib/SOAP/WSDL/XSD/Typelib/AttributeSet.pm - version: 2.00_29 + version: 2.00.01 SOAP::WSDL::XSD::Typelib::Builtin: file: lib/SOAP/WSDL/XSD/Typelib/Builtin.pm - version: 2.00_25 + version: 2.00.01 SOAP::WSDL::XSD::Typelib::Builtin::ENTITY: file: lib/SOAP/WSDL/XSD/Typelib/Builtin/ENTITY.pm SOAP::WSDL::XSD::Typelib::Builtin::ID: @@ -323,17 +346,19 @@ provides: 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_33 + version: 2.00.01 SOAP::WSDL::XSD::Typelib::Element: file: lib/SOAP/WSDL/XSD/Typelib/Element.pm - version: 2.00_29 + version: 2.00.01 SOAP::WSDL::XSD::Typelib::SimpleType: file: lib/SOAP/WSDL/XSD/Typelib/SimpleType.pm + version: 2.00.01 SOAP::WSDL::XSD::Typelib::SimpleType::restriction: file: lib/SOAP/WSDL/XSD/Typelib/SimpleType.pm + version: 2.00.01 SOAP::WSDL::XSD::WhiteSpace: file: lib/SOAP/WSDL/XSD/WhiteSpace.pm - version: 2.00_33 + version: 2.00.01 generated_by: Module::Build version 0.2808 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.2.html diff --git a/TEST_COVERAGE b/TEST_COVERAGE index 4e6bf73..a909342 100644 --- a/TEST_COVERAGE +++ b/TEST_COVERAGE @@ -1,11 +1,17 @@ # Unfortunately, Build testcover reports test coverage wrong. # -# To get a complete coverage report, just run this file as a shell script +# 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 +# cd t/ - +cover -delete find . -type f -name '*.t' | xargs -n 1 /usr/bin/perl -MDevel::Cover=-silent,1,-summary,0 -I../lib +# Devel::CoverX::Covered +covered runs + cover -ignore_re \.t$ -ignore_re ^lib -coverage="statement" -coverage=condition -coverage=subroutine -coverage="branch" diff --git a/TODO b/TODO index 2b94376..30ecf49 100644 --- a/TODO +++ b/TODO @@ -1,10 +1,5 @@ TODO list for SOAP::WSDL -2.00 Pre-releases --------- - -* Act as SOAP Server [ 1842436 ] - 2.1 release -------- * Support namespaces in SOAP message payload [ 1809057 ] diff --git a/benchmark/01_expat.t b/benchmark/01_expat.t index 5b833de..c5f2a41 100644 --- a/benchmark/01_expat.t +++ b/benchmark/01_expat.t @@ -1,15 +1,17 @@ #!/usr/bin/perl -w -%DB::packages=(SOAP::WSDL::Expat::MessageParser => 1); 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; @@ -17,24 +19,50 @@ use MyComplexType; use MyElement; use MySimpleType; -my $xml = q{ - Test2 - Test2 - Test2 - Test2 - Test2 - Test2 - Test2 - Test2 - Test2 - Test2 - Test2 - Test2 - Test55 + 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 }; @@ -57,13 +85,17 @@ my @data; my $deserializer = SOAP::Deserializer->new(); -sub libxml_test { +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) { + for ($_[0]->childNodes) { if (exists $_[1]->{ $_->nodeName }) { if (ref $_[1]->{ $_->nodeName } eq 'ARRAY') { if ($_->nodeName eq '#text') { @@ -78,7 +110,7 @@ sub dom2hash { $_[1] = [ $_[1], $_->textContent() ]; } else { - $_[1]->{ $_->nodeName } = [ $_[1]->{ $_->nodeName } , + $_[1]->{ $_->nodeName } = [ $_[1]->{ $_->nodeName } , dom2hash( $_, {} ) ]; } } @@ -94,11 +126,11 @@ sub dom2hash { } return $_[1]; } - -cmpthese 5000, +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, @@ -128,3 +160,18 @@ BEGIN { }; }; }; + + +__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% -- diff --git a/benchmark/XSD/02_anySimpleType.t b/benchmark/XSD/02_anySimpleType.t index 011b708..a16ba0c 100644 --- a/benchmark/XSD/02_anySimpleType.t +++ b/benchmark/XSD/02_anySimpleType.t @@ -11,7 +11,7 @@ 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' + value => 'Teststring', }) }, 'set_FOO' => sub { $obj->set_value('Test') }, }; diff --git a/benchmark/XSD/03_string.t b/benchmark/XSD/03_string.t index 6f85b7b..98f2f81 100644 --- a/benchmark/XSD/03_string.t +++ b/benchmark/XSD/03_string.t @@ -11,8 +11,9 @@ 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' - }) }, + value => 'Teststring', + }) + }, }; $obj->set_value('Foobar'); @@ -36,7 +37,7 @@ new + params: 1 wallclock secs ( 0.53 usr + 0.01 sys = 0.54 CPU) @ 37037.04/s 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 --- @@ -47,7 +48,7 @@ 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 +::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) diff --git a/benchmark/hello.pl b/benchmark/hello.pl index 328a904..8117be6 100644 --- a/benchmark/hello.pl +++ b/benchmark/hello.pl @@ -1,29 +1,43 @@ #!/usr/bin/perl -w use strict; use warnings; +use diagnostics; use lib '../example/lib'; -use lib '/home/martin/workspace/SOAP-WSDL-Fast_XS/blib/lib'; -use lib '/home/martin/workspace/SOAP-WSDL-Fast_XS/blib/arch'; +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::WSDL11; use XML::Compile::Transport::SOAPHTTP; use MyInterfaces::HelloWorld::HelloWorldSoap; use SOAP::WSDL::Deserializer::XSD_XS; -use Benchmark qw(cmpthese); +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 => 'http://localhost:81/soap-wsdl-test/helloworld.pl' + proxy => $proxy ); $lite->on_action( sub { "urn:HelloWorld#sayHello" }); $lite->autotype(0); -my $soap = MyInterfaces::HelloWorld::HelloWorldSoap->new(); +my $soap = MyInterfaces::HelloWorld::HelloWorldSoap->new({ + proxy => $proxy, +}); -my $soap_xs = MyInterfaces::HelloWorld::HelloWorldSoap->new(); +my $soap_xs = MyInterfaces::HelloWorld::HelloWorldSoap->new({ + proxy => $proxy, +}); $soap_xs->set_deserializer( SOAP::WSDL::Deserializer::XSD_XS->new() ); -my @result; +my @result = ();; sub wsdl_bench { push @result, $soap->sayHello({ @@ -40,7 +54,12 @@ sub wsdl_xs_bench { } my $wsdl = XML::Compile::WSDL11->new('../example/wsdl/11_helloworld.wsdl'); -my $call = $wsdl->compileClient('sayHello'); +my $call = $wsdl->compileClient('sayHello', + sloppy_integers => 1, + check_values => 0, + check_values => 0, + validation => 0, +); sub compile_bench { push @result, $call->( @@ -58,12 +77,16 @@ sub lite_bench { ); } +# give all a chance to perform first-run initializations +compile_bench(); +lite_bench(); wsdl_bench(); wsdl_xs_bench(); -cmpthese 150, { +timethese 150, { 'SOAP::WSDL' => \&wsdl_bench, 'SOAP::WSDL_XS' => \&wsdl_xs_bench, 'XML::Compile' => \&compile_bench, - # 'SOAP::Lite' => \&lite_bench, -} + 'SOAP::Lite' => \&lite_bench, +}; + diff --git a/benchmark/person.pl b/benchmark/person.pl index 6742af3..231e3f3 100644 --- a/benchmark/person.pl +++ b/benchmark/person.pl @@ -1,5 +1,7 @@ use 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; @@ -11,15 +13,80 @@ 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'; -use SOAP::Lite; -use MyInterfaces::TestService::TestPort; +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, + check_values => 0, + validation => 0, + ignore_facets => 1, +); -my $compile = XML::Compile::WSDL11->new('../example/wsdl/Person.wsdl'); my $call = $compile->compileClient('ListPerson'); $call->({ in => undef}); @@ -52,34 +119,45 @@ Benchmark $n: Store result in private variable and destroy it "; $n++; cmpthese $count, { -# 'XML::Simple' => sub { my $result = XMLin( MyData::xml() )}, -# 'SOAP::WSDL' => sub { my $result = $soap->ListPerson({}) }, -# 'XML::Compile' => sub { my $result = $call->() }, + 'SOAP::WSDL' => sub { my $result = $soap->ListPerson({}) }, + 'XML::Compile' => sub { my $result = $call->() }, 'SOAP::WSDL_XS' => sub { my $result = $wsdl_xs->ListPerson({}) }, -# 'SOAP::Lite' => sub { my $result = $deserializer->deserialize( MyData::xml() )}, -# 'SOAP::Lite' => sub { my $som = $lite->call('ListPerson') }, + 'SOAP::Lite' => sub { my $som = $lite->call('ListPerson') }, }; print "\nBenchmark $n: Push result on list\n"; $n++; cmpthese $count, { -# 'XML::Simple' => sub { push @data, XMLin( MyData::xml() )}, -# 'SOAP::WSDL' => sub { push @data, $soap->ListPerson({}) }, -# 'XML::Compile' => sub { push @data, $call->() }, + 'SOAP::WSDL' => sub { push @data, $soap->ListPerson({}) }, + 'XML::Compile' => sub { push @data, $call->() }, 'SOAP::WSDL_XS' => sub { push @data, $wsdl_xs->ListPerson({}) }, -# 'SOAP::Lite' => sub { push @data, $deserializer->deserialize( MyData::xml() )} -# 'SOAP::Lite' => sub { push @data, $lite->call('ListPerson') }, + 'SOAP::Lite' => sub { push @data, $lite->call('ListPerson') }, }; @data = (); print "\nBenchmark $n: Play it again, Sam\n"; - +$n++; cmpthese $count, { -# 'XML::Simple' => sub { push @data, XMLin( MyData::xml() )}, -# 'SOAP::WSDL' => sub { push @data, $soap->ListPerson({}) }, + + '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, $deserializer->deserialize( MyData::xml() )} -# 'SOAP::Lite' => sub { push @data, $lite->call('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 }) }, }; diff --git a/benchmark/person_single.pl b/benchmark/person_single.pl index 1b4e7cb..3da98fc 100644 --- a/benchmark/person_single.pl +++ b/benchmark/person_single.pl @@ -4,6 +4,7 @@ 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 @@ -15,13 +16,21 @@ my @data = (); my $soap = MyInterfaces::TestService::TestPort->new(); # Load all classes - XML::Compile has created everything before, too -timethis 100, sub { $soap->ListPerson({}) }; +#timethis 100, sub { $soap->ListPerson({}) }; #timethis 50, sub { push @data, $soap->ListPerson({}) }; #@data = (); # timethis 50, 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; diff --git a/example/cgi-bin/helloworld.pl b/example/cgi-bin/helloworld.pl index 50323f5..71c6c9a 100755 --- a/example/cgi-bin/helloworld.pl +++ b/example/cgi-bin/helloworld.pl @@ -1,4 +1,5 @@ #!/usr/bin/perl -w +package main; use strict; use warnings; use lib '../../lib'; @@ -33,7 +34,7 @@ in examples/wsdl/helloworld.wsdl Before using this script, you should secure your webserver. The easiest way to do so is to let it listen to 127.0.0.1 only. -Then make a ScriptAlias named /soap-wsdl-test/ pointing at the directory +Then make a ScriptAlias named /soap-wsdl-test/ pointing at the directory this file lies in. For my apache, it looks like this: diff --git a/example/lib/MyServer/HelloWorld/HelloWorldSoap.pm b/example/lib/MyServer/HelloWorld/HelloWorldSoap.pm index fdf839b..10099e9 100644 --- a/example/lib/MyServer/HelloWorld/HelloWorldSoap.pm +++ b/example/lib/MyServer/HelloWorld/HelloWorldSoap.pm @@ -15,12 +15,11 @@ my %dispatch_to :ATTR(:name); my $action_map_ref = { 'urn:HelloWorld#sayHello' => 'sayHello', - }; sub START { my ($self, $ident, $arg_ref) = @_; - eval "require $transport_class_of{ $ident }" + eval "require $transport_class_of{ $ident }" or die "Cannot load transport class $transport_class_of{ $ident }: $@"; $transport_of{ $ident } = $transport_class_of{ $ident }->new({ action_map_ref => $action_map_ref, @@ -30,7 +29,7 @@ sub START { } sub handle { - $transport_of{ ${ $_[0] } }->handle(); + $transport_of{ ${ $_[0] } }->handle(@_[1..$#_]); } 1; @@ -76,7 +75,7 @@ located at http://localhost:81/soap-wsdl-test/helloworld.pl. Constructor. -The C argument is mandatory. It must be a class or object +The C argument is mandatory. It must be a class or object implementing the SOAP Service methods listed below. =head2 SOAP Service methods @@ -94,9 +93,9 @@ class. my ($self, $body, $header) = @_; # body is a ??? object - sorry, POD not implemented yet # header is a ??? object - sorry, POD not implemented yet - + # do something with body and header... - + return MyElements::sayHelloResponse->new( { sayHelloResult => $some_value, # string }, diff --git a/lib/SOAP/WSDL.pm b/lib/SOAP/WSDL.pm index 370ea37..767935d 100644 --- a/lib/SOAP/WSDL.pm +++ b/lib/SOAP/WSDL.pm @@ -14,7 +14,7 @@ use Class::Std::Fast; use SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType; use LWP::UserAgent; -our $VERSION= '2.00_33'; +use version; our $VERSION= qv('2.00.01'); my %no_dispatch_of :ATTR(:name); my %wsdl_of :ATTR(:name); @@ -512,7 +512,7 @@ it's content. The object tree has two main functions: It knows how to serialize data passed as hash ref, and how to render the WSDL elements found into perl classes. -Yup your're right, there's a builting code generation facility. Read +Yup you're right; there's a builtin code generation facility. Read L for using it. =item * no_dispatch @@ -595,7 +595,7 @@ See L above. =item * Hash refs -This is for convnience: A single hash ref containing the content of the +This is for convenience: A single hash ref containing the content of the SOAP body. =item * xml @@ -675,13 +675,13 @@ interpreting mod: simpleContent The following XML Schema definition content model is only partially -supported: +supported in interpreting mode: complexContent - only restriction variety supported See L for details. -=item * Serialization of hash refs dos not work for ambiguos values +=item * Serialization of hash refs does not work for ambiguous values If you have list elements with multiple occurences allowed, SOAP::WSDL has no means of finding out which variant you meant. @@ -691,17 +691,17 @@ Passing in item => [1,2,3] could serialize to 1 23 12 3 -Ambiguos data can be avoided by providing data as objects. +Ambiguous data can be avoided by providing data as objects. =item * XML Schema facets -Almost no XML schema facets are implemented yet. The only facets +Almost no XML schema facets are implemented. The only facets currently implemented are: fixed default -The following facets have no influence yet: +The following facets have no influence: minLength maxLength @@ -725,10 +725,10 @@ The following facets have no influence yet: Full featured SOAP-library, little WSDL support. Supports rpc-encoded style only. Many protocols supported. -=item * L / L +=item * L Creates parser/generator functions for SOAP messages. Includes SOAP Client -and Server implementatios. +and Server implementations. Can validate XML messages. You might want to give it a try, especially if you need to adhere very closely to the XML Schema / WSDL specs. @@ -762,7 +762,7 @@ Peter Orvos, Mark Overmeer, Jon Robens, Isidro Vila Verde and Glenn Wood (in alphabetical order) spotted bugs and/or suggested improvements in the 1.2x releases. -Andreas 'ac0v' Specht constantly asked for better performance. +Noah Robin contirbuted lots of documentation fixes, and the mod_perl server. JT Justman and Noah Robin provided early feedback and bug reports for the 2.xx pre-releases. @@ -770,7 +770,11 @@ the 2.xx pre-releases. Adam Kennedy checked and suggested improvements on metadata and dependencies in the 2.xx pre-releases. -CPAN Testers have provided most valuable (automated) feedback. Thanks. +Andreas 'ac0v' Specht constantly asked for better performance. + +Matt S. Trout encouraged me "to get a non-dev-release out." + +CPAN Testers provided most valuable (automated) feedback. Thanks a lot. Numerous people sent me their real-world WSDL files for testing. Thank you. @@ -792,9 +796,9 @@ Martin Kutter Emartin.kutter fen-net.deE =head1 REPOSITORY INFORMATION - $Rev: 583 $ + $Rev: 616 $ $LastChangedBy: kutterma $ - $Id: WSDL.pm 583 2008-03-24 07:44:06Z kutterma $ + $Id: WSDL.pm 616 2008-04-22 21:51:49Z kutterma $ $HeadURL: http://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL.pm $ =cut diff --git a/lib/SOAP/WSDL/Base.pm b/lib/SOAP/WSDL/Base.pm index 2ff5726..53be628 100644 --- a/lib/SOAP/WSDL/Base.pm +++ b/lib/SOAP/WSDL/Base.pm @@ -5,7 +5,7 @@ use Class::Std::Fast::Storable; use List::Util qw(first); use Carp qw(croak carp confess); -our $VERSION='2.00_27'; +use version; our $VERSION = qv('2.00.01'); my %id_of :ATTR(:name :default<()>); my %lang_of :ATTR(:name :default<()>); diff --git a/lib/SOAP/WSDL/Binding.pm b/lib/SOAP/WSDL/Binding.pm index 059456e..26e510f 100644 --- a/lib/SOAP/WSDL/Binding.pm +++ b/lib/SOAP/WSDL/Binding.pm @@ -5,6 +5,8 @@ use Class::Std::Fast::Storable; use List::Util qw(first); use base qw(SOAP::WSDL::Base); +use version; our $VERSION = qv('2.00.01'); + my %operation_of :ATTR(:name :default<()>); my %type_of :ATTR(:name :default<()>); my %transport_of :ATTR(:name :default<()>); diff --git a/lib/SOAP/WSDL/Client.pm b/lib/SOAP/WSDL/Client.pm index f8a32b2..dd0bf51 100644 --- a/lib/SOAP/WSDL/Client.pm +++ b/lib/SOAP/WSDL/Client.pm @@ -11,7 +11,7 @@ use SOAP::WSDL::Factory::Serializer; use SOAP::WSDL::Factory::Transport; use SOAP::WSDL::Expat::MessageParser; -our $VERSION = '2.00_27'; +use version; our $VERSION = qv('2.00.01'); my %class_resolver_of :ATTR(:name :default<()>); my %no_dispatch_of :ATTR(:name :default<()>); @@ -259,10 +259,10 @@ You probably should not use a character encoding different from utf8: SOAP::WSDL::Client will not convert the request into a different encoding (yet). -To leave out the encoding, just set the content type without appendet charset -like in +To leave out the encoding, just set the content type without appending charset +like this: - text/xml + $soap->set_content_type('text/xml'); Default: @@ -271,7 +271,7 @@ Default: =head2 Features different from SOAP::Lite SOAP::WSDL does not aim to be a complete replacement for SOAP::Lite - the -SOAP::Lite module has it's strengths and weaknesses and SOAP::WSDL is +SOAP::Lite module has its strengths and weaknesses and SOAP::WSDL is designed as a cure for the weakness of little WSDL support - nothing more, nothing less. @@ -283,7 +283,7 @@ A few things are quite different from SOAP::Lite, though: =head3 SOAP request data -SOAP request data may either be given as message object, or as hash ref (in +SOAP request data may either be given as message object, or as a hash ref (in which case it will automatically be encoded into a message object). =head3 Return values @@ -303,7 +303,7 @@ The fault object is a SOAP1.1 fault object of the following C. SOAP::WSDL::SOAP::Typelib::Fault11 objects are false in boolean context, so -you can just do something like +you can just do something like: my $result = $soap->call($method, $data); @@ -360,9 +360,9 @@ Martin Kutter Emartin.kutter fen-net.deE =head1 REPOSITORY INFORMATION - $Rev: 455 $ + $Rev: 616 $ $LastChangedBy: kutterma $ - $Id: Client.pm 455 2007-12-14 15:50:16Z kutterma $ + $Id: Client.pm 616 2008-04-22 21:51:49Z kutterma $ $HeadURL: http://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Client.pm $ =cut diff --git a/lib/SOAP/WSDL/Client/Base.pm b/lib/SOAP/WSDL/Client/Base.pm index 8e1f201..440afa4 100644 --- a/lib/SOAP/WSDL/Client/Base.pm +++ b/lib/SOAP/WSDL/Client/Base.pm @@ -4,7 +4,7 @@ use warnings; use base 'SOAP::WSDL::Client'; use Scalar::Util qw(blessed); -our $VERSION = '2.00_33'; +use version; our $VERSION = qv('2.00.01'); sub call { my ($self, $method, $body, $header) = @_; @@ -78,9 +78,9 @@ Martin Kutter Emartin.kutter fen-net.deE =head1 REPOSITORY INFORMATION - $Rev: 542 $ + $Rev: 616 $ $LastChangedBy: kutterma $ - $Id: Base.pm 542 2008-02-18 09:38:06Z kutterma $ + $Id: Base.pm 616 2008-04-22 21:51:49Z kutterma $ $HeadURL: http://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Client/Base.pm $ =cut diff --git a/lib/SOAP/WSDL/Definitions.pm b/lib/SOAP/WSDL/Definitions.pm index 3fa94ee..259bcf4 100644 --- a/lib/SOAP/WSDL/Definitions.pm +++ b/lib/SOAP/WSDL/Definitions.pm @@ -9,7 +9,7 @@ use List::Util qw(first); use Class::Std::Fast::Storable; use base qw(SOAP::WSDL::Base); -our $VERSION='2.00_33'; +use version; our $VERSION = qv('2.00.01'); my %types_of :ATTR(:name :default<[]>); my %message_of :ATTR(:name :default<[]>); @@ -118,9 +118,9 @@ Martin Kutter Emartin.kutter fen-net.deE =head1 REPOSITORY INFORMATION - $Rev: 549 $ + $Rev: 616 $ $LastChangedBy: kutterma $ - $Id: Definitions.pm 549 2008-02-20 10:14:26Z kutterma $ + $Id: Definitions.pm 616 2008-04-22 21:51:49Z kutterma $ $HeadURL: http://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Definitions.pm $ =cut diff --git a/lib/SOAP/WSDL/Deserializer/Hash.pm b/lib/SOAP/WSDL/Deserializer/Hash.pm index 342cfa4..9ffa831 100644 --- a/lib/SOAP/WSDL/Deserializer/Hash.pm +++ b/lib/SOAP/WSDL/Deserializer/Hash.pm @@ -8,7 +8,7 @@ use SOAP::WSDL::Expat::Message2Hash; use SOAP::WSDL::Factory::Deserializer; SOAP::WSDL::Factory::Deserializer->register( '1.1', __PACKAGE__ ); -our $VERSION='2.00_25'; +use version; our $VERSION = qv('2.00.01'); sub BUILD { my ($self, $ident, $args_of_ref) = @_; @@ -54,7 +54,7 @@ SOAP::WSDL::Deserializer::Hash - Deserializer SOAP messages into perl hash refs use SOAP::WSDL; use SOAP::WSDL::Deserializer::Hash; - + =head1 DESCRIPTION Deserializer for creating perl hash refs as result of a SOAP call. @@ -152,9 +152,9 @@ Martin Kutter Emartin.kutter fen-net.deE =head1 REPOSITORY INFORMATION - $Rev: 427 $ + $Rev: 616 $ $LastChangedBy: kutterma $ - $Id: Hash.pm 427 2007-12-02 22:20:24Z kutterma $ + $Id: Hash.pm 616 2008-04-22 21:51:49Z kutterma $ $HeadURL: http://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Deserializer/Hash.pm $ =cut diff --git a/lib/SOAP/WSDL/Deserializer/SOM.pm b/lib/SOAP/WSDL/Deserializer/SOM.pm index 857978b..d9b001f 100644 --- a/lib/SOAP/WSDL/Deserializer/SOM.pm +++ b/lib/SOAP/WSDL/Deserializer/SOM.pm @@ -2,7 +2,7 @@ package SOAP::WSDL::Deserializer::SOM; use strict; use warnings; -our $VERSION = '2.00_24'; +use version; our $VERSION = qv('2.00.01'); our @ISA; eval { @@ -37,7 +37,7 @@ SOAP::WSDL::Deserializer::SOM - Deserializer SOAP messages into SOM objects use SOAP::WSDL::Deserializer::SOM; use SOAP::WSDL::Factory::Deserializer; SOAP::WSDL::Factory::Deserializer->register( '1.1', __PACKAGE__ ); - + =head1 DESCRIPTION Deserializer for creating SOAP::Lite's SOM object as result of a SOAP call. @@ -68,11 +68,11 @@ from the L package. =head1 USAGE -SOAP::WSDL::Deserializer will not auroregister itself - to use it for a particular +SOAP::WSDL::Deserializer will not autoregister itself - to use it for a particular SOAP version just use the following lines: my $soap_version = '1.1'; # or '1.2', further versions may appear. - + use SOAP::WSDL::Deserializer::SOM; use SOAP::WSDL::Factory::Deserializer; SOAP::WSDL::Factory::Deserializer->register( $soap_version, __PACKAGE__ ); @@ -114,9 +114,9 @@ Martin Kutter Emartin.kutter fen-net.deE =head1 REPOSITORY INFORMATION - $Rev: 391 $ + $Rev: 616 $ $LastChangedBy: kutterma $ - $Id: SOM.pm 391 2007-11-17 21:56:13Z kutterma $ + $Id: SOM.pm 616 2008-04-22 21:51:49Z kutterma $ $HeadURL: http://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Deserializer/SOM.pm $ =cut diff --git a/lib/SOAP/WSDL/Deserializer/XSD.pm b/lib/SOAP/WSDL/Deserializer/XSD.pm index ed28967..4f07b6a 100644 --- a/lib/SOAP/WSDL/Deserializer/XSD.pm +++ b/lib/SOAP/WSDL/Deserializer/XSD.pm @@ -5,7 +5,7 @@ use Class::Std::Fast::Storable; use SOAP::WSDL::SOAP::Typelib::Fault11; use SOAP::WSDL::Expat::MessageParser; -our $VERSION='2.00_25'; +use version; our $VERSION = qv('2.00.01'); my %class_resolver_of :ATTR(:name :default<()>); @@ -72,7 +72,7 @@ Usually you don't need to do anything to use this package - it's the default deserializer for SOAP::WSDL::Client and interface classes generated by SOAP::WSDL. -Is you want to use the XSD serializer from SOAP::WSDL, set the outputtree() +If you want to use the XSD serializer from SOAP::WSDL, set the outputtree() property and provide a class_resolver. =head1 METHODS @@ -99,9 +99,9 @@ Martin Kutter Emartin.kutter fen-net.deE =head1 REPOSITORY INFORMATION - $Rev: 501 $ + $Rev: 616 $ $LastChangedBy: kutterma $ - $Id: XSD.pm 501 2008-01-26 20:23:32Z kutterma $ + $Id: XSD.pm 616 2008-04-22 21:51:49Z kutterma $ $HeadURL: http://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Deserializer/XSD.pm $ =cut diff --git a/lib/SOAP/WSDL/Expat/Base.pm b/lib/SOAP/WSDL/Expat/Base.pm index 47114de..c25481e 100644 --- a/lib/SOAP/WSDL/Expat/Base.pm +++ b/lib/SOAP/WSDL/Expat/Base.pm @@ -6,7 +6,7 @@ use XML::Parser::Expat; # TODO: convert to Class::Std::Fast based class - hash based classes suck. -our $VERSION = '2.00_32'; +use version; our $VERSION = qv('2.00.01'); sub new { my ($class, $arg_ref) = @_; diff --git a/lib/SOAP/WSDL/Expat/Message2Hash.pm b/lib/SOAP/WSDL/Expat/Message2Hash.pm index 667c2be..6d59357 100644 --- a/lib/SOAP/WSDL/Expat/Message2Hash.pm +++ b/lib/SOAP/WSDL/Expat/Message2Hash.pm @@ -4,7 +4,7 @@ use strict; use warnings; use base qw(SOAP::WSDL::Expat::Base); -our $VERSION = '2.00_27'; +use version; our $VERSION = qv('2.00.01'); sub _initialize { my ($self, $parser) = @_; @@ -21,7 +21,7 @@ sub _initialize { my ($_element, $_method, $_class, $_parser, %_attrs) = (); - no strict qw(refs); + # no strict qw(refs); $parser->setHandlers( Start => sub { push @$list, $current; diff --git a/lib/SOAP/WSDL/Expat/MessageParser.pm b/lib/SOAP/WSDL/Expat/MessageParser.pm index 7fe0815..52a7dbb 100644 --- a/lib/SOAP/WSDL/Expat/MessageParser.pm +++ b/lib/SOAP/WSDL/Expat/MessageParser.pm @@ -4,7 +4,7 @@ use strict; use warnings; use Carp qw(croak confess); -our $VERSION = q{2.00_27}; +use version; our $VERSION = qv('2.00.01'); use SOAP::WSDL::XSD::Typelib::Builtin; use SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType; @@ -24,8 +24,12 @@ sub new { }; bless $self, $class; - $self->load_classes() if ($args->{ class_resolver }) - && ! exists $LOADED_OF{ $self->{ class_resolver } }; + + # 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; } @@ -162,6 +166,9 @@ sub _initialize { # (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..$#_] }); # @@ -172,8 +179,20 @@ sub _initialize { } # set attributes if there are any - $current->attr({ @_[2..$#_] }) if (@_ > 2); - + 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++; return; }, @@ -194,13 +213,6 @@ sub _initialize { $depth--; - # 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; - }; - # we only set character values in leaf nodes if ($_leaf) { # Use dirty but fast access via global variables. @@ -210,12 +222,20 @@ sub _initialize { # $current->set_value( $characters ) if (length($characters)); # $SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType::___value - ->{ $$current } = $characters if $characters =~m{ [^\s] }xms; + ->{ $$current } = $characters + if defined $characters && defined $current; # =~m{ [^\s] }xms; } # empty characters $characters = q{}; + # 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 # $_method = "add_$_localname"; @@ -295,8 +315,8 @@ the same terms as perl itself $Id: $ - $LastChangedDate: 2008-03-29 22:38:55 +0100 (Sa, 29 Mrz 2008) $ - $LastChangedRevision: 585 $ + $LastChangedDate: 2008-04-22 23:51:49 +0200 (Di, 22 Apr 2008) $ + $LastChangedRevision: 616 $ $LastChangedBy: kutterma $ $HeadURL: http://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Expat/MessageParser.pm $ diff --git a/lib/SOAP/WSDL/Expat/MessageStreamParser.pm b/lib/SOAP/WSDL/Expat/MessageStreamParser.pm index 881193f..914bf86 100644 --- a/lib/SOAP/WSDL/Expat/MessageStreamParser.pm +++ b/lib/SOAP/WSDL/Expat/MessageStreamParser.pm @@ -6,7 +6,7 @@ use XML::Parser::Expat; use SOAP::WSDL::Expat::MessageParser; use base qw(SOAP::WSDL::Expat::MessageParser); -our $VERSION = '2.00_24'; +use version; our $VERSION = qv('2.00.01'); sub parse_start { my $self = shift; @@ -43,7 +43,7 @@ SOAP::WSDL::Expat::MessageStreamParser - Convert SOAP messages to custom object # 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 @@ -69,9 +69,9 @@ the same terms as perl itself =head1 REPOSITORY INFORMATION - $Rev: 477 $ + $Rev: 616 $ $LastChangedBy: kutterma $ - $Id: MessageStreamParser.pm 477 2007-12-24 10:23:52Z kutterma $ + $Id: MessageStreamParser.pm 616 2008-04-22 21:51:49Z kutterma $ $HeadURL: http://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Expat/MessageStreamParser.pm $ - + =cut diff --git a/lib/SOAP/WSDL/Expat/WSDLParser.pm b/lib/SOAP/WSDL/Expat/WSDLParser.pm index b696876..f930e0c 100644 --- a/lib/SOAP/WSDL/Expat/WSDLParser.pm +++ b/lib/SOAP/WSDL/Expat/WSDLParser.pm @@ -5,7 +5,7 @@ use Carp; use SOAP::WSDL::TypeLookup; use base qw(SOAP::WSDL::Expat::Base); -our $VERSION = q{2.00_32}; +use version; our $VERSION = qv('2.00.01'); sub _import_children { my ($self, $name, $imported, $importer, $import_namespace) = @_; @@ -279,10 +279,10 @@ the same terms as perl itself =head1 Repository information - $Id: WSDLParser.pm 549 2008-02-20 10:14:26Z kutterma $ + $Id: WSDLParser.pm 616 2008-04-22 21:51:49Z kutterma $ - $LastChangedDate: 2008-02-20 11:14:26 +0100 (Mi, 20 Feb 2008) $ - $LastChangedRevision: 549 $ + $LastChangedDate: 2008-04-22 23:51:49 +0200 (Di, 22 Apr 2008) $ + $LastChangedRevision: 616 $ $LastChangedBy: kutterma $ $HeadURL: http://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Expat/WSDLParser.pm $ diff --git a/lib/SOAP/WSDL/Factory/Deserializer.pm b/lib/SOAP/WSDL/Factory/Deserializer.pm index f8956e1..9e859ba 100644 --- a/lib/SOAP/WSDL/Factory/Deserializer.pm +++ b/lib/SOAP/WSDL/Factory/Deserializer.pm @@ -2,7 +2,7 @@ package SOAP::WSDL::Factory::Deserializer; use strict; use warnings; -our $VERSION = '2.00_24'; +use version; our $VERSION = qv('2.00.01'); my %DESERIALIZER = ( '1.1' => 'SOAP::WSDL::Deserializer::XSD', @@ -47,10 +47,10 @@ SOAP::WSDL::Factory::Deserializer - Factory for retrieving Deserializer objects # 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 @@ -150,5 +150,5 @@ Martin Kutter Emartin.kutter fen-net.deE $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 diff --git a/lib/SOAP/WSDL/Factory/Generator.pm b/lib/SOAP/WSDL/Factory/Generator.pm index ea6294c..2dc79c4 100644 --- a/lib/SOAP/WSDL/Factory/Generator.pm +++ b/lib/SOAP/WSDL/Factory/Generator.pm @@ -2,7 +2,7 @@ package SOAP::WSDL::Factory::Generator; use strict; use warnings; -our $VERSION='2.00_24'; +use version; our $VERSION = qv('2.00.01'); my %GENERATOR = ( 'XSD' => 'SOAP::WSDL::Generator::Template::XSD', @@ -49,10 +49,10 @@ SOAP::WSDL::Factory:Generator - Factory for retrieving generator objects # 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 @@ -168,5 +168,5 @@ Martin Kutter Emartin.kutter fen-net.deE $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 diff --git a/lib/SOAP/WSDL/Factory/Serializer.pm b/lib/SOAP/WSDL/Factory/Serializer.pm index 5d675a3..5414537 100644 --- a/lib/SOAP/WSDL/Factory/Serializer.pm +++ b/lib/SOAP/WSDL/Factory/Serializer.pm @@ -2,7 +2,7 @@ package SOAP::WSDL::Factory::Serializer; use strict; use warnings; -our $VERSION='2.00_24'; +use version; our $VERSION = qv('2.00.01'); my %SERIALIZER = ( '1.1' => 'SOAP::WSDL::Serializer::XSD', @@ -46,10 +46,10 @@ SOAP::WSDL::Factory::Serializer - Factory for retrieving serializer objects # 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 @@ -138,9 +138,9 @@ Martin Kutter Emartin.kutter fen-net.deE =head1 REPOSITORY INFORMATION - $Rev: 510 $ + $Rev: 616 $ $LastChangedBy: kutterma $ - $Id: Serializer.pm 510 2008-01-29 08:03:46Z kutterma $ + $Id: Serializer.pm 616 2008-04-22 21:51:49Z kutterma $ $HeadURL: http://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Factory/Serializer.pm $ - + =cut diff --git a/lib/SOAP/WSDL/Factory/Transport.pm b/lib/SOAP/WSDL/Factory/Transport.pm index ca050ac..3327a93 100644 --- a/lib/SOAP/WSDL/Factory/Transport.pm +++ b/lib/SOAP/WSDL/Factory/Transport.pm @@ -1,10 +1,8 @@ package SOAP::WSDL::Factory::Transport; use strict; use warnings; +use version; our $VERSION = qv('2.00.01'); -our $VERSION='2.00_33'; - -# class data my %registered_transport_of = (); # Local constants @@ -32,14 +30,17 @@ sub register { } sub get_transport { - my ($class, $scheme, %attrs) = @_; + my ($class, $url, %attrs) = @_; - $scheme =~s{ \A ([^\:]+) \: .+ }{$1}x; - if ($registered_transport_of{ $scheme }) { + my $scheme = $url; + $scheme =~s{ \:.+$ }{}xm; + + + if (defined $registered_transport_of{ $scheme }) { no strict qw(refs); - defined %{ "$registered_transport_of{ $scheme }::" } - or eval "require $registered_transport_of{ $scheme }" + defined %{ "$registered_transport_of{ $scheme }::" } 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 @@ -50,28 +51,30 @@ sub get_transport { # sparse resource ... # ... but we've decided to mimic SOAP::Lite... -# my $protocol_class = $SOAP_LITE_TRANSPORT_OF{ $scheme } . '::Client'; -# my $transport; -# eval { -# $transport = $protocol_class->new( %attrs ); -# }; -# return $transport if not $@; 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 }) { - eval "require $SOAP_LITE_TRANSPORT_OF{ $scheme }" - or last SOAP_Lite; - my $protocol_class = $SOAP_LITE_TRANSPORT_OF{ $scheme } . '::Client'; - return $protocol_class->new( %attrs ); - } + 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 + defined %{ "$SOAP_LITE_TRANSPORT_OF{ $scheme }::" } + or eval "require $SOAP_LITE_TRANSPORT_OF{ $scheme }" + or last SOAP_Lite; + + my $protocol_class = $SOAP_LITE_TRANSPORT_OF{ $scheme } . '::Client'; + # 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); - defined %{ "$SOAP_WSDL_TRANSPORT_OF{ $scheme }::" } + defined %{ "$SOAP_WSDL_TRANSPORT_OF{ $scheme }::"} 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 ); @@ -159,7 +162,7 @@ the class should be used for, and $module is the class' module name. To auto-register your transport class on loading, execute register() in your tranport class (see L above). -Multiple protocols ore multiple classes are registered by multiple calls to +Multiple protocols or multiple classes are registered by multiple calls to register(). =head2 Transport plugin package layout @@ -240,9 +243,9 @@ Martin Kutter Emartin.kutter fen-net.deE =head1 REPOSITORY INFORMATION - $Rev: 579 $ + $Rev: 616 $ $LastChangedBy: kutterma $ - $Id: Transport.pm 579 2008-03-09 18:39:24Z kutterma $ + $Id: Transport.pm 616 2008-04-22 21:51:49Z kutterma $ $HeadURL: http://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Factory/Transport.pm $ =cut diff --git a/lib/SOAP/WSDL/Generator/Iterator/WSDL11.pm b/lib/SOAP/WSDL/Generator/Iterator/WSDL11.pm index 5ed801f..e4298c4 100644 --- a/lib/SOAP/WSDL/Generator/Iterator/WSDL11.pm +++ b/lib/SOAP/WSDL/Generator/Iterator/WSDL11.pm @@ -2,6 +2,8 @@ package SOAP::WSDL::Generator::Iterator::WSDL11; use strict; use warnings; use Class::Std::Fast; +use version; our $VERSION = qv('2.00.01'); + my %definitions_of :ATTR(:name :default<[]>); my %nodes_of :ATTR(:name :default<[]>); @@ -242,8 +244,8 @@ The nodes are returned in the order denoted in the following example: -You should not rely too much on this order - it may change. Even though, the -current order will probably remain, but the nodes currently skipped might +You should not rely too much on this order - it may change. Even though the +current order will probably remain, the nodes currently skipped might be returned somewhere along the path. diff --git a/lib/SOAP/WSDL/Generator/PrefixResolver.pm b/lib/SOAP/WSDL/Generator/PrefixResolver.pm index 26dda45..d954899 100644 --- a/lib/SOAP/WSDL/Generator/PrefixResolver.pm +++ b/lib/SOAP/WSDL/Generator/PrefixResolver.pm @@ -3,20 +3,26 @@ use strict; use warnings; use Class::Std::Fast::Storable; +use version; our $VERSION = qv('2.00.01'); + my %namespace_prefix_map_of :ATTR(:name :default<{}>); my %namespace_map_of :ATTR(:name :default<{}>); my %prefix_of :ATTR(:name :default<{}>); sub resolve_prefix { my ($self, $type, $namespace, $element) = @_; - return $prefix_of{ $$self }->{ $type } - if not defined($namespace); - return $namespace_prefix_map_of{ $$self }->{ $namespace } - || ( ($namespace_map_of{ $$self }->{ $namespace }) - ? join ('::', $prefix_of{ $$self }->{ $type }, $namespace_map_of{ $$self }->{ $namespace }) - : $prefix_of{ $$self }->{ $type } - ); - + my $prefix; + if (not defined($namespace)) { + $prefix = $prefix_of{ $$self }->{ $type } + } + else { + $prefix = $namespace_prefix_map_of{ $$self }->{ $namespace } + || ( ($namespace_map_of{ $$self }->{ $namespace }) + ? join ('::', $prefix_of{ $$self }->{ $type }, $namespace_map_of{ $$self }->{ $namespace }) + : $prefix_of{ $$self }->{ $type } + ); + } + return "${prefix}::"; } 1; @@ -67,7 +73,7 @@ Subclasses must implement the following methods: # ... } -resolve_prefix is expected to return a (perl class) prefis. It is called with +resolve_prefix is expected to return a (perl class) prefix. It is called with the following parameters: NAME DESCRIPTION @@ -80,7 +86,7 @@ You usually just need type and namespace for prefix resolving. node is provided for rather funky setups, where you have to choose different prefixes based on type names or whatever. -Note that node may be of any of the following classes: +Node may be of any of the following classes: SOAP::WSDL::Service SOAP::WSDL::XSD::Attribute @@ -90,8 +96,34 @@ Note that node may be of any of the following classes: Note that both namespace and node may be undef - you should test for definedness before doing anything fancy with them. +If you want your prefixes to represent perl class hierarchies, they should +end with '::'. + +Example: + +Imagine you're generating interfaces for the Acme Pet Shop. Acme Corp. has +set up their datatypes to be global across all interfaces (and products), while +elements are local to the product (the Pet Shop in the example). +All elements are in the urn:Acme namespace. + +In addition, there are types in the namespace urn:Acme:Goods, which should go +into the same namespace as types, but be prefixed with 'Goods_' + +You may want prefixes (roughly) like this: + + Interfaces: Acme::Client::PetShop:: + Server: Acme::Server::PetShop:: + Types: Acme::Types:: + Types (Goods): Acme::Types::Goods_ + Elements: Acme::Elements::PetShop:: + Typemaps: Acme::Typemaps::PetShop:: + =back +=head1 BUGS AND LIMITATIONS + +You cannot suffix your types by some rule yet... + =head1 LICENSE AND COPYRIGHT Copyright 2008 Martin Kutter. diff --git a/lib/SOAP/WSDL/Generator/Template.pm b/lib/SOAP/WSDL/Generator/Template.pm index bc41fd8..b257146 100644 --- a/lib/SOAP/WSDL/Generator/Template.pm +++ b/lib/SOAP/WSDL/Generator/Template.pm @@ -5,7 +5,7 @@ use Class::Std::Fast::Storable; use Carp; use SOAP::WSDL::Generator::PrefixResolver; -use version; our $VERSION = qv(2.00_33); +use version; our $VERSION = qv('2.00.01'); my %tt_of :ATTR(:get); my %definitions_of :ATTR(:name :default<()>); diff --git a/lib/SOAP/WSDL/Generator/Template/Plugin/XSD.pm b/lib/SOAP/WSDL/Generator/Template/Plugin/XSD.pm index 3b5a7f1..c893155 100644 --- a/lib/SOAP/WSDL/Generator/Template/Plugin/XSD.pm +++ b/lib/SOAP/WSDL/Generator/Template/Plugin/XSD.pm @@ -4,6 +4,8 @@ use warnings; use Carp qw(confess); use Class::Std::Fast::Storable constructor => 'none'; +use version; our $VERSION = qv('2.00.01'); + my %namespace_prefix_map_of :ATTR(:name :default<{}>); my %namespace_map_of :ATTR(:name :default<{}>); my %prefix_of :ATTR(:name :default<()>); @@ -14,9 +16,6 @@ sub load { # called as MyPlugin->load($context) my ($class, $context, @arg_from) = @_; my $stash = $context->stash(); my $self = bless \do { my $o = Class::Std::Fast::ID() }, $class; -# $self->set_namespace_map( $stash->{ context }->{ namespace_map }); -# $self->set_namespace_prefix_map( $stash->{ context }->{ namespace_prefix_map }); -# $self->set_prefix( $stash->{ context }->{ prefix }); $self->set_prefix_resolver( $stash->{ context }->{ prefix_resolver }); return $self; # returns 'MyPlugin' } @@ -27,9 +26,6 @@ sub new { my ($class, $arg_ref) = @_; my $self = bless \do { my $o = Class::Std::Fast::ID() }, $class; -# $self->set_namespace_map( $arg_ref->{ namespace_map }); -# $self->set_namespace_prefix_map( $arg_ref->{ namespace_prefix_map }); -# $self->set_prefix( $arg_ref->{ prefix }); $self->set_prefix_resolver( $arg_ref->{ prefix_resolver }); return $self; # returns 'MyPlugin' } @@ -38,10 +34,10 @@ sub _get_prefix { my ($self, $type, $node) = @_; my $namespace = defined ($node) ? ref($node) - ? $node->get_targetNamespace + ? $node->get_targetNamespace() : $node : undef; - return $self->get_prefix_resolver->resolve_prefix( + return $self->get_prefix_resolver()->resolve_prefix( $type, $namespace, ref($node) @@ -50,27 +46,16 @@ sub _get_prefix { ); } -#sub _get_prefix { -# my ($self, $type, $namespace) = @_; -# return $prefix_of{ $$self }->{ $type } -# if not defined($namespace); -# return $namespace_prefix_map_of{ $$self }->{ $namespace } -# || ( ($namespace_map_of{ $$self }->{ $namespace }) -# ? join ('::', $prefix_of{ $$self }->{ $type }, $namespace_map_of{ $$self }->{ $namespace }) -# : $prefix_of{ $$self }->{ $type } -# ); -#} - sub create_xsd_name { - my ($self,$element) = @_; - my $name = $self->_resolve_prefix($element) . '::' - . $element->get_name(); + my ($self,$node) = @_; + my $name = $self->_resolve_prefix($node) #. '::' + . $node->get_name(); return $self->perl_name( $name ); } sub create_typemap_name { my ($self, $node) = @_; - my $name = $self->_get_prefix('typemap') . '::' + my $name = $self->_get_prefix('typemap') #. '::' . $node->get_name(); return $self->perl_name( $name ); } @@ -79,10 +64,9 @@ sub create_server_name { my ($self, $server, $port) = @_; my $port_name = $port->get_name(); $port_name =~s{\A (?:.+)\. ([^\.]+) \z}{$1}x; - my $name = join('::', + my $name = join( q{}, $self->_get_prefix('server', $server), - $server->get_name(), - $port_name + join( '::', $server->get_name(), $port_name) ); return $self->perl_name( $name ); } @@ -91,10 +75,9 @@ sub create_interface_name { my ($self, $server, $port) = @_; my $port_name = $port->get_name(); $port_name =~s{\A (?:.+)\. ([^\.]+) \z}{$1}x; - my $name = join('::', + my $name = join( q{}, $self->_get_prefix('interface', $server), - $server->get_name(), - $port_name + join( '::', $server->get_name(), $port_name ) ); return $self->perl_name( $name ); } @@ -121,8 +104,8 @@ sub _resolve_prefix { sub perl_name { my $self = shift; my $name = shift; - $name =~s{[\-]}{_}xmsg; - $name =~s{[\.]}{::}xmsg; + $name =~s{\-}{_}xmsg; + $name =~s{\.}{::}xmsg; return $name; } diff --git a/lib/SOAP/WSDL/Generator/Template/XSD.pm b/lib/SOAP/WSDL/Generator/Template/XSD.pm index f519527..6ee045f 100644 --- a/lib/SOAP/WSDL/Generator/Template/XSD.pm +++ b/lib/SOAP/WSDL/Generator/Template/XSD.pm @@ -5,15 +5,15 @@ use Class::Std::Fast::Storable; use File::Basename; use File::Spec; -our $VERSION = q{2.00_27}; +use version; our $VERSION = qv('2.00.01'); use SOAP::WSDL::Generator::Visitor::Typemap; use SOAP::WSDL::Generator::Visitor::Typelib; use SOAP::WSDL::Generator::Template::Plugin::XSD; use base qw(SOAP::WSDL::Generator::Template); -my %output_of :ATTR(:name :default<()>); -my %typemap_of :ATTR(:name :default<({})>); +my %output_of :ATTR(:name :default<()>); +my %typemap_of :ATTR(:name :default<({})>); sub BUILD { my ($self, $ident, $arg_ref) = @_; @@ -47,6 +47,29 @@ sub BUILD { ); } +# construct object on call to allow late binding of prefix_resolver class +# and namespace maps (not used yet) +sub get_name_resolver { + my $self = shift; + return SOAP::WSDL::Generator::Template::Plugin::XSD->new({ + prefix_resolver => $self->get_prefix_resolver_class()->new({ + namespace_prefix_map => { + 'http://www.w3.org/2001/XMLSchema' => 'SOAP::WSDL::XSD::Typelib::Builtin', + }, + namespace_map => { + }, + prefix => { + attribute => $self->get_attribute_prefix, + interface => $self->get_interface_prefix, + element => $self->get_element_prefix, + server => $self->get_server_prefix, + type => $self->get_type_prefix, + typemap => $self->get_typemap_prefix, + } + }) + }); +} + sub generate { my $self = shift; my $opt = shift; @@ -73,7 +96,7 @@ sub _generate_interface { my $self = shift; my $arg_ref = shift; my $template_name = delete $arg_ref->{ template_name }; - my $prefix_method = delete $arg_ref->{ prefix_method }; + my $name_method = delete $arg_ref->{ name_method }; for my $service (@{ $self->get_definitions->get_service }) { for my $port (@{ $service->get_port() }) { # Skip ports without (known) address @@ -85,10 +108,11 @@ sub _generate_interface { my $output = $arg_ref->{ output } ? $arg_ref->{ output } : $self->_generate_filename( - $self->can($prefix_method)->($self), - $service->get_name(), - $port_name, - ); + $self->get_name_resolver()->can($name_method)->( + $self->get_name_resolver(), + $service, + $port, + )); print "Creating interface class $output\n"; $self->_process($template_name, @@ -105,14 +129,14 @@ sub _generate_interface { sub generate_server { my ($self, $arg_ref) = @_; $arg_ref->{ template_name } = 'Server.tt'; - $arg_ref->{ prefix_method } = 'get_server_prefix'; + $arg_ref->{ name_method } = 'create_server_name'; $self->_generate_interface($arg_ref); } sub generate_client { my ($self, $arg_ref) = @_; $arg_ref->{ template_name } = 'Interface.tt'; - $arg_ref->{ prefix_method } = 'get_interface_prefix'; + $arg_ref->{ name_method } = 'create_interface_name'; $self->_generate_interface($arg_ref); } sub generate_interface; @@ -133,22 +157,7 @@ sub generate_typemap { 'Fault/detail' => 'SOAP::WSDL::XSD::Typelib::Builtin::string', %{ $typemap_of{ident $self }}, }, - resolver => SOAP::WSDL::Generator::Template::Plugin::XSD->new({ - prefix_resolver => $self->get_prefix_resolver_class()->new({ - namespace_prefix_map => { - 'http://www.w3.org/2001/XMLSchema' => 'SOAP::WSDL::XSD::Typelib::Builtin', - }, - namespace_map => { - }, - prefix => { - interface => $self->get_interface_prefix, - element => $self->get_element_prefix, - server => $self->get_server_prefix, - type => $self->get_type_prefix, - typemap => $self->get_typemap_prefix, - } - }) - }), + resolver => $self->get_name_resolver(), }); use SOAP::WSDL::Generator::Iterator::WSDL11; @@ -163,7 +172,7 @@ sub generate_typemap { my $output = $arg_ref->{ output } ? $arg_ref->{ output } - : $self->_generate_filename( $self->get_typemap_prefix(), $service->get_name() ); + : $self->_generate_filename( $self->get_name_resolver()->create_typemap_name($service) ); print "Creating typemap class $output\n"; $self->_process('Typemap.tt', { @@ -176,8 +185,7 @@ sub generate_typemap { } sub _generate_filename :PRIVATE { - my ($self, @parts) = @_; - my $name = join '::', @parts; + my ($self, $name) = @_; $name =~s{ \. }{::}xmsg; $name =~s{ \- }{_}xmsg; $name =~s{ :: }{/}xmsg; @@ -188,7 +196,7 @@ sub visit_XSD_Attribute { my ($self, $attribute) = @_; my $output = defined $output_of{ ident $self } ? $output_of{ ident $self } - : $self->_generate_filename( $self->get_attribute_prefix(), $attribute->get_name() ); + : $self->_generate_filename( $self->get_name_resolver()->create_xsd_name($attribute) ); $self->_process('attribute.tt', { attribute => $attribute } , $output); } @@ -196,7 +204,7 @@ sub visit_XSD_Element { my ($self, $element) = @_; my $output = defined $output_of{ ident $self } ? $output_of{ ident $self } - : $self->_generate_filename( $self->get_element_prefix(), $element->get_name() ); + : $self->_generate_filename( $self->get_name_resolver()->create_xsd_name($element) ); $self->_process('element.tt', { element => $element } , $output); } @@ -204,7 +212,7 @@ sub visit_XSD_SimpleType { my ($self, $type) = @_; my $output = defined $output_of{ ident $self } ? $output_of{ ident $self } - : $self->_generate_filename( $self->get_type_prefix(), $type->get_name() ); + : $self->_generate_filename( $self->get_name_resolver()->create_xsd_name($type) ); $self->_process('simpleType.tt', { simpleType => $type } , $output); } @@ -212,8 +220,8 @@ sub visit_XSD_ComplexType { my ($self, $type) = @_; my $output = defined $output_of{ ident $self } ? $output_of{ ident $self } - : $self->_generate_filename( $self->get_type_prefix(), $type->get_name() ); + : $self->_generate_filename( $self->get_name_resolver()->create_xsd_name($type) ); $self->_process('complexType.tt', { complexType => $type } , $output); } -1; \ No newline at end of file +1; diff --git a/lib/SOAP/WSDL/Generator/Template/XSD/Interface/Body.tt b/lib/SOAP/WSDL/Generator/Template/XSD/Interface/Body.tt index ff80884..f1a77eb 100644 --- a/lib/SOAP/WSDL/Generator/Template/XSD/Interface/Body.tt +++ b/lib/SOAP/WSDL/Generator/Template/XSD/Interface/Body.tt @@ -15,8 +15,8 @@ @parts = map { my $part = $_; (grep { - my ($ns, $lname) = $def->expand( $_ ); - ($lname eq $part->get_name) + # my ($ns, $lname) = $def->expand( $_ ); + ($_ eq $part->get_name) } @body_part_from ) ? do { diff --git a/lib/SOAP/WSDL/Generator/Template/XSD/Interface/Header.tt b/lib/SOAP/WSDL/Generator/Template/XSD/Interface/Header.tt index 0b2c52d..704d97e 100644 --- a/lib/SOAP/WSDL/Generator/Template/XSD/Interface/Header.tt +++ b/lib/SOAP/WSDL/Generator/Template/XSD/Interface/Header.tt @@ -11,10 +11,11 @@ my $def = $stash->{ definitions }; my $type_prefix = $stash->{ type_prefix }; my $element_prefix = $stash->{ element_prefix }; - my ($ns, $lname) = $def->expand( $item->get_part() ); + #my ($ns, $lname) = $def->expand( $item->get_part() ); + my $part_name = $item->get_part(); my ($part) = grep { - $_->get_name eq $lname - && $_->get_targetNamespace eq $ns } @{ $message->get_part( ) }; + $_->get_name eq $part_name + } @{ $message->get_part( ) }; my $part_class = do { my $name; ($name = $part->get_element) diff --git a/lib/SOAP/WSDL/Generator/Template/XSD/Interface/POD/Operation.tt b/lib/SOAP/WSDL/Generator/Template/XSD/Interface/POD/Operation.tt index 47f28d2..0625189 100644 --- a/lib/SOAP/WSDL/Generator/Template/XSD/Interface/POD/Operation.tt +++ b/lib/SOAP/WSDL/Generator/Template/XSD/Interface/POD/Operation.tt @@ -7,4 +7,3 @@ port_op.get_documentation %] $interface->[% operation.get_name %]([% INCLUDE Interface/POD/Message.tt %] ); - \ No newline at end of file diff --git a/lib/SOAP/WSDL/Generator/Template/XSD/Server.tt b/lib/SOAP/WSDL/Generator/Template/XSD/Server.tt index b5a5f24..609d597 100644 --- a/lib/SOAP/WSDL/Generator/Template/XSD/Server.tt +++ b/lib/SOAP/WSDL/Generator/Template/XSD/Server.tt @@ -36,7 +36,7 @@ sub START { } sub handle { - $transport_of{ ${ shift @_ } }->handle(@_); + $transport_of{ ${ $_[0] } }->handle(@_[1..$#_]); } 1; @@ -102,4 +102,4 @@ implementing the SOAP Service methods listed below. Generated by SOAP::WSDL on [% PERL %]print scalar localtime() [% END %] -=pod \ No newline at end of file +=cut diff --git a/lib/SOAP/WSDL/Generator/Template/XSD/Server/POD/Operation.tt b/lib/SOAP/WSDL/Generator/Template/XSD/Server/POD/Operation.tt index 0f8db0d..3de04b8 100644 --- a/lib/SOAP/WSDL/Generator/Template/XSD/Server/POD/Operation.tt +++ b/lib/SOAP/WSDL/Generator/Template/XSD/Server/POD/Operation.tt @@ -3,15 +3,48 @@ [% head3 %] [% operation.get_name %] -[% type = definitions.find_portType( binding.expand( binding.get_type ) ); - port_op = type.find_operation( definitions.get_targetNamespace, operation.get_name ); -port_op.get_documentation %] +[% type = definitions.find_portType( binding.expand( binding.get_type ) ); + port_op = ''; + FOREACH port_op = type.get_operation(); + IF (port_op.get_name == operation.get_name); + LAST; + END; + END; + + input_message_name = port_op.first_input.get_message(); + output_message_name = port_op.first_output.get_message(); + + input_message = definitions.find_message(port_op.first_input.expand(input_message_name)); + output_message = definitions.find_message(port_op.first_output.expand(output_message_name)); + + input_parts = input_message.get_part(); + output_parts = output_message.get_part(); + +# port_op.get_documentation +%] sub [% operation.get_name %] { my ($self, $body, $header) = @_; - # body is a ??? object - sorry, POD not implemented yet - # header is a ??? object - sorry, POD not implemented yet - +[% + IF (input_parts.size() > 1); -%] + # body is a list ref of the following objects: + # [ + # sorry - POD support not implemented yet + # ] + [% ELSE; + input_element = definitions.first_types.find_element(input_parts.0.expand(input_parts.0.get_element)); + IF (input_element); + class = XSD.create_xsd_name( input_element ); + ELSE; + input_type = definitions.first_types.find_type(input_parts.0.expand(input_parts.0.get_type)); + class = XSD.create_xsd_name( input_type ); + END; + -%] + # body is a [% class %] object + [%- + END; + %] + # header is a ??? object - sorry, POD support not implemented yet # do something with body and header... return [% INCLUDE Server/POD/Message.tt %] diff --git a/lib/SOAP/WSDL/Generator/Template/XSD/complexType/POD/attributeSet.tt b/lib/SOAP/WSDL/Generator/Template/XSD/complexType/POD/attributeSet.tt index d6e63f3..c3fc20c 100644 --- a/lib/SOAP/WSDL/Generator/Template/XSD/complexType/POD/attributeSet.tt +++ b/lib/SOAP/WSDL/Generator/Template/XSD/complexType/POD/attributeSet.tt @@ -15,7 +15,10 @@ get_/set_ methods: =over -[% FOREACH element = complexType.get_attribute -%] +[% FOREACH element = complexType.get_attribute; + WHILE element.get_ref; + element = definitions.first_types.find_attribute(element.expand( element.get_ref )); + END; -%] =item * [% element.get_name %] [%- IF (element.get_annotation && element.get_annotation.0.get_documentation) %] diff --git a/lib/SOAP/WSDL/Generator/Template/XSD/complexType/attributeSet.tt b/lib/SOAP/WSDL/Generator/Template/XSD/complexType/attributeSet.tt index 90401e8..deebeb3 100644 --- a/lib/SOAP/WSDL/Generator/Template/XSD/complexType/attributeSet.tt +++ b/lib/SOAP/WSDL/Generator/Template/XSD/complexType/attributeSet.tt @@ -3,18 +3,27 @@ package [% XSD.create_xmlattr_name(complexType) %]; use base qw(SOAP::WSDL::XSD::Typelib::AttributeSet); { # BLOCK to scope variables -[% FOREACH element = complexType.get_attribute %] +[% FOREACH element = complexType.get_attribute; + WHILE element.get_ref; + element = definitions.first_types.find_attribute(element.expand( element.get_ref )); + END; %] my %[% element.get_name %]_of :ATTR(:get<[% element.get_name %]>); [%- END %] __PACKAGE__->_factory( [ qw( -[%- FOREACH element = complexType.get_attribute %] +[%- FOREACH element = complexType.get_attribute; + WHILE element.get_ref; + element = definitions.first_types.find_attribute(element.expand( element.get_ref )); + END; %] [% element.get_name -%] [% END %] ) ], { -[% FOREACH element = complexType.get_attribute -%] +[% FOREACH element = complexType.get_attribute; + WHILE element.get_ref; + element = definitions.first_types.find_attribute(element.expand( element.get_ref )); + END; %] [% element.get_name %] => \%[% element.get_name %]_of, [% END -%] }, @@ -26,10 +35,11 @@ __PACKAGE__->_factory( [% element.get_name %] => '[% XSD.create_xsd_name(element_type) %]', [% ELSIF (ref = element.get_ref); - attribute = definitions.first_types.find_attribute( complexType.expand(ref) ); - # element_type = definitions.get_types.0.find_type(complexType.expand( attribute.get_type )); + WHILE element.get_ref; + element = definitions.first_types.find_attribute(element.expand( element.get_ref )); + END; %] - [% attribute.get_name %] => '[% XSD.create_xsd_name(attribute) %]', + [% element.get_name %] => '[% XSD.create_xsd_name(element) %]', [% ELSIF (element.first_simpleType); THROW NOT_IMPLEMENTED , "Attributes with atomic simpleType definition are not implemented yet"; atomic_types.${ element.get_name } = element.first_simpleType; diff --git a/lib/SOAP/WSDL/Generator/Template/XSD/element.tt b/lib/SOAP/WSDL/Generator/Template/XSD/element.tt index c2af3c2..6a39a30 100644 --- a/lib/SOAP/WSDL/Generator/Template/XSD/element.tt +++ b/lib/SOAP/WSDL/Generator/Template/XSD/element.tt @@ -8,7 +8,10 @@ use warnings; sub get_xmlns { '[% element.get_targetNamespace %]' } __PACKAGE__->__set_name('[% element.get_name %]'); -__PACKAGE__->__set_nillable([% element.get_nillable %]); +__PACKAGE__->__set_nillable([% IF (element.get_nillable); + IF (element.get_nillable != 'false'); %]1[% ELSE %]0[% END; + END; + %]); __PACKAGE__->__set_minOccurs([% element.get_minOccurs %]); __PACKAGE__->__set_maxOccurs([% element.get_maxOccurs %]); __PACKAGE__->__set_ref([% IF element.get_ref; %]'[% element.get_ref %]'[% END %]); diff --git a/lib/SOAP/WSDL/Generator/Visitor.pm b/lib/SOAP/WSDL/Generator/Visitor.pm index 634928e..c1673dd 100644 --- a/lib/SOAP/WSDL/Generator/Visitor.pm +++ b/lib/SOAP/WSDL/Generator/Visitor.pm @@ -3,7 +3,7 @@ use strict; use warnings; use Class::Std::Fast::Storable; -our $VERSION = q{2.00_25}; +use version; our $VERSION = qv('2.00.01'); my %definitions_of :ATTR(:name :default<()>); my %type_prefix_of :ATTR(:name :default<()>); @@ -66,13 +66,13 @@ tree of objects. A Visitor's methods are called using the so-called double dispatch technique. To allow double dispatching, the Visitor implements one method for every class -ro be handled, whereas every class implements just one method (commonly named +to be handled, whereas every class implements just one method (commonly named "access"), which does nothing more than calling a method on the reference given, with the self object as parameter. If all this sounds strange, maybe an example helps. Imagine you had a list of person objects and wanted to print out a list of their names (or address -stamps or everything elseyou like). This can easily be implemented with a +stamps or everything else you like). This can easily be implemented with a Visitor: package PersonVisitor; @@ -107,7 +107,7 @@ Visitor: Person name is Vlissides While using this pattern for just printing a list may look a bit over-sized, -but it may become handy if you need multiple output formats and different +it may become handy if you need multiple output formats and different classes to operate on. The main benefits using visitors are: @@ -188,8 +188,8 @@ mimicing .NET's .asmx example pages. All these behaviours could well be (and have historically been) implemented in the classes holding the WSDL data. This made these classes rather bloated, and -made it hard to change behaviour (like, supporting SOAP Headers, -supporting atomic types and other features which were missing from early +made it hard to change behaviour (like supporting SOAP Headers, +supporting atomic types, and other features which were missing from early versions of SOAP::WSDL). Implementing these behaviours in Visitor classes eases adding new behaviours, @@ -203,7 +203,7 @@ schema implementation. SOAP::WSDL::Base defines an accept method which expects a Visitor as only parameter. -The method visit_Foo_Bar is called on the visitor, whith the self object as +The method visit_Foo_Bar is called on the visitor, with the self object as parameter. The actual method name is constructed this way: @@ -224,7 +224,7 @@ visit_XSD_ComplexType is called on the visitor. =head2 Writing your own visitor SOAP::WSDL eases writing your own visitor. This might be required if you need -some special output format from a WSDL file, or want to feed your own +some special output format from a WSDL file or want to feed your own serializer/deserializer pair with custom configuration data. Or maybe you want to generate C# code from it... @@ -273,7 +273,7 @@ The SOAP::WSDL::Generator::Visitor implementations include part of their own Iterator (which means they know how to find the next objects to visit). You may or may not choose to implement a separate Iterator. -Letting a visitor implementing it's own Iterator visit a WSDL definition is as +Letting a visitor implementing its own Iterator visit a WSDL definition is as easy as writing something like this: my $visitor = MyVisitor->new(); diff --git a/lib/SOAP/WSDL/Generator/Visitor/Typelib.pm b/lib/SOAP/WSDL/Generator/Visitor/Typelib.pm index 91361ed..a366bfe 100644 --- a/lib/SOAP/WSDL/Generator/Visitor/Typelib.pm +++ b/lib/SOAP/WSDL/Generator/Visitor/Typelib.pm @@ -5,6 +5,7 @@ use base qw(SOAP::WSDL::Generator::Visitor SOAP::WSDL::Generator::Template ); +use version; our $VERSION = qv('2.00.01'); 1; diff --git a/lib/SOAP/WSDL/Generator/Visitor/Typemap.pm b/lib/SOAP/WSDL/Generator/Visitor/Typemap.pm index 1223a8e..9448917 100644 --- a/lib/SOAP/WSDL/Generator/Visitor/Typemap.pm +++ b/lib/SOAP/WSDL/Generator/Visitor/Typemap.pm @@ -5,7 +5,7 @@ use Class::Std::Fast::Storable; use base qw(SOAP::WSDL::Generator::Visitor); -our $VERSION = q{2.00_25}; +use version; our $VERSION = qv('2.00.01'); my %path_of :ATTR(:name :default<[]>); my %typemap_of :ATTR(:name :default<()>); @@ -41,7 +41,7 @@ sub add_element_path { sub process_referenced_type { my ( $self, $ns, $localname ) = @_; - return if not $localname; + my $ident = ident $self; # get type's class name @@ -65,8 +65,7 @@ sub process_atomic_type { my ( $self, $type, $callback ) = @_; return if not $type; - my $ident = ident $self; - $callback->( $self, $type ) if $callback; + $callback->( $self, $type ); return $self; } @@ -97,9 +96,6 @@ sub visit_XSD_Element { # warn "simpleType " . $element->get_name(); my @path = @{ $path_of{ ${ $self } } }; my $typeclass = $self->get_resolver()->create_subpackage_name($element); -# my $typeclass = defined ($parent) -# ? join q{::_}, $parent , $element->get_name() -# : join q{::}, $self->resolver()->get_element_prefix( $element->get_targetNamespace), $element->get_name(); $self->set_typemap_entry($typeclass); $typeclass =~s{\.}{::}g; $typeclass =~s{\-}{_}g; @@ -108,14 +104,11 @@ sub visit_XSD_Element { # for atomic and complex types , and ref elements my $typeclass = $self->get_resolver()->create_subpackage_name($element); -# my $typeclass = join q{::}, $self->get_resolver()->get_element_prefix( $element->get_targetNamespace), $element->get_name(); -# $typeclass =~s{\.}{::}g; -# $typeclass =~s{\-}{_}g; $self->set_typemap_entry($typeclass); $self->process_atomic_type( $element->first_complexType() , sub { $_[1]->_accept($_[0]) } ) - && last; + && last SWITCH; # TODO: add element ref handling }; @@ -125,9 +118,6 @@ sub visit_XSD_Element { if (not defined($parent)) { # for atomic and complex types , and ref elements my $typeclass = $self->get_resolver()->create_xsd_name($element); -# my $typeclass = join q{::}, $self->get_resolver()->get_element_prefix($element->get_targetNamespace), $element->get_name(); -# $typeclass =~s{\.}{::}g; -# $typeclass =~s{\-}{_}g; $self->set_typemap_entry($typeclass); } diff --git a/lib/SOAP/WSDL/Manual.pod b/lib/SOAP/WSDL/Manual.pod index 1a2da7d..d9bd4a3 100644 --- a/lib/SOAP/WSDL/Manual.pod +++ b/lib/SOAP/WSDL/Manual.pod @@ -237,62 +237,14 @@ C<--server> or C<-s> option to the call to C. perl wsdl2perl.pl -s -b BASE_DIR URL -Note that SOAP::WSDL only includes a basic CGI based SOAP servers by now - -while more advanced servers (like standalone or mod_perl based) are no big -deal, no base implementation is included yet. - -=head1 Troubleshooting - -=head2 Accessing HTTPS webservices - -You need Crypt::SSLeay installed to access HTTPS webservices. - -=head2 Accessing protected web services - -Passing a userndame and password, or a client certificate and key, to the -transport layer is highly dependent on the transport backend. - -=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 - -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 HTTPS webservices protected by certificate authentication - -You need Crypt::SSLeay installed to access HTTPS webservices. - -See L on how to configure client certificate authentication. +SOAP::WSDL currently includes classes for building a basic CGI and a +mod_perl 2 based SOAP server. =head1 SEE ALSO +L cooking recipes for accessing web services, +altering the XML Serializer and others. + L SOAP::WSDL's XML Schema implementation L The meaning of all these words diff --git a/lib/SOAP/WSDL/Message.pm b/lib/SOAP/WSDL/Message.pm index c9b5899..fcab1b7 100644 --- a/lib/SOAP/WSDL/Message.pm +++ b/lib/SOAP/WSDL/Message.pm @@ -4,6 +4,8 @@ use warnings; use Class::Std::Fast::Storable; use base qw(SOAP::WSDL::Base); +use version; our $VERSION = qv('2.00.01'); + my %part_of :ATTR(:name :default<[]>); 1; diff --git a/lib/SOAP/WSDL/OpMessage.pm b/lib/SOAP/WSDL/OpMessage.pm index 9d8083d..8005d3c 100644 --- a/lib/SOAP/WSDL/OpMessage.pm +++ b/lib/SOAP/WSDL/OpMessage.pm @@ -4,6 +4,8 @@ use warnings; use Class::Std::Fast::Storable; use base qw(SOAP::WSDL::Base); +use version; our $VERSION = qv('2.00.01'); + my %body_of :ATTR(:name :default<[]>); my %header_of :ATTR(:name
:default<[]>); my %headerfault_of :ATTR(:name :default<[]>); diff --git a/lib/SOAP/WSDL/Operation.pm b/lib/SOAP/WSDL/Operation.pm index 6895b78..047f10e 100644 --- a/lib/SOAP/WSDL/Operation.pm +++ b/lib/SOAP/WSDL/Operation.pm @@ -4,6 +4,8 @@ use warnings; use Class::Std::Fast::Storable; use base qw(SOAP::WSDL::Base); +use version; our $VERSION = qv('2.00.01'); + my %operation_of :ATTR(:name :default<()>); my %input_of :ATTR(:name :default<[]>); my %output_of :ATTR(:name :default<[]>); diff --git a/lib/SOAP/WSDL/Part.pm b/lib/SOAP/WSDL/Part.pm index 12aefb7..ce639b5 100644 --- a/lib/SOAP/WSDL/Part.pm +++ b/lib/SOAP/WSDL/Part.pm @@ -6,6 +6,8 @@ use Class::Std::Fast::Storable; use base qw(SOAP::WSDL::Base); +use version; our $VERSION = qv('2.00.01'); + my %element_of :ATTR(:name :default<()>); my %type_of :ATTR(:name :default<()>); diff --git a/lib/SOAP/WSDL/Port.pm b/lib/SOAP/WSDL/Port.pm index 37fd3bf..680f2e1 100644 --- a/lib/SOAP/WSDL/Port.pm +++ b/lib/SOAP/WSDL/Port.pm @@ -4,6 +4,8 @@ use warnings; use Class::Std::Fast::Storable; use base qw(SOAP::WSDL::Base); +use version; our $VERSION = qv('2.00.01'); + my %binding_of :ATTR(:name :default<()>); my %address_of :ATTR(:name
:default<()>); diff --git a/lib/SOAP/WSDL/PortType.pm b/lib/SOAP/WSDL/PortType.pm index b3d6ab0..130e93b 100644 --- a/lib/SOAP/WSDL/PortType.pm +++ b/lib/SOAP/WSDL/PortType.pm @@ -4,6 +4,8 @@ use warnings; use Class::Std::Fast::Storable; use base qw(SOAP::WSDL::Base); +use version; our $VERSION = qv('2.00.01'); + my %operation_of :ATTR(:name :default<()>); my %attributes_of :ATTR(); diff --git a/lib/SOAP/WSDL/SOAP/Address.pm b/lib/SOAP/WSDL/SOAP/Address.pm index f31055e..e739a00 100644 --- a/lib/SOAP/WSDL/SOAP/Address.pm +++ b/lib/SOAP/WSDL/SOAP/Address.pm @@ -3,5 +3,8 @@ use strict; use warnings; use base qw(SOAP::WSDL::Base); use Class::Std::Fast::Storable; + +use version; our $VERSION = qv('2.00.01'); + my %location :ATTR(:name :default<()>); 1; \ No newline at end of file diff --git a/lib/SOAP/WSDL/SOAP/Body.pm b/lib/SOAP/WSDL/SOAP/Body.pm index 84b64ed..4ce691a 100644 --- a/lib/SOAP/WSDL/SOAP/Body.pm +++ b/lib/SOAP/WSDL/SOAP/Body.pm @@ -3,6 +3,9 @@ use strict; use warnings; use base qw(SOAP::WSDL::Base); use Class::Std::Fast::Storable; + +use version; our $VERSION = qv('2.00.01'); + my %use_of :ATTR(:name :default); my %namespace_of :ATTR(:name :default); my %encodingStyle_of :ATTR(:name :default); diff --git a/lib/SOAP/WSDL/SOAP/Header.pm b/lib/SOAP/WSDL/SOAP/Header.pm index e4df549..52f9e06 100644 --- a/lib/SOAP/WSDL/SOAP/Header.pm +++ b/lib/SOAP/WSDL/SOAP/Header.pm @@ -3,10 +3,14 @@ use strict; use warnings; use base qw(SOAP::WSDL::Base); use Class::Std::Fast::Storable; + +use version; our $VERSION = qv('2.00.01'); + my %use_of :ATTR(:name :default); my %namespace_of :ATTR(:name :default); my %encodingStyle_of :ATTR(:name :default); my %message_of :ATTR(:name :default<()>); my %part_of :ATTR(:name :default); + 1; \ No newline at end of file diff --git a/lib/SOAP/WSDL/SOAP/HeaderFault.pm b/lib/SOAP/WSDL/SOAP/HeaderFault.pm index 07403ac..6a59bf2 100644 --- a/lib/SOAP/WSDL/SOAP/HeaderFault.pm +++ b/lib/SOAP/WSDL/SOAP/HeaderFault.pm @@ -3,4 +3,6 @@ use strict; use warnings; use base qw(SOAP::WSDL::Header); +use version; our $VERSION = qv('2.00.01'); + 1; \ No newline at end of file diff --git a/lib/SOAP/WSDL/SOAP/Operation.pm b/lib/SOAP/WSDL/SOAP/Operation.pm index a2b27f3..49b4d96 100644 --- a/lib/SOAP/WSDL/SOAP/Operation.pm +++ b/lib/SOAP/WSDL/SOAP/Operation.pm @@ -4,7 +4,7 @@ use warnings; use Class::Std::Fast::Storable; use base qw(SOAP::WSDL::Base); -our $VERSION=q{2.00_25}; +use version; our $VERSION = qv('2.00.01'); my %style_of :ATTR(:name