diff --git a/Build.PL b/Build.PL index d7817ee..d249fa8 100644 --- a/Build.PL +++ b/Build.PL @@ -4,7 +4,7 @@ $build = Module::Build->new( create_makefile_pl => 'passthrough', dist_abstract => 'SOAP with WSDL support', dist_name => 'SOAP-WSDL', - dist_version => '2.00_18', + dist_version => '2.00_19', module_name => 'SOAP::WSDL', license => 'artistic', requires => { @@ -40,6 +40,11 @@ $build = Module::Build->new( 'XML::Parser::Expat' => 0, }, recursive_test_files => 1, + meta_add => { + no_index => { + namespace => 'SOAP::WSDL::Generator::Template::XSD', + }, + } ); $build->add_build_element('tt'); $build->create_build_script; diff --git a/CHANGES b/CHANGES index dfc6d64..f038089 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ -Release notes for SOAP::WSDL 2.00_18 +Release notes for SOAP::WSDL 2.00_19 ------- I'm proud to present a new pre-release version of SOAP::WSDL. @@ -33,6 +33,23 @@ Features: The following changes have been made: +2.00_19 +---- +The following features were added (the numbers in square brackets are the +tracker IDs from https://sourceforge.net/tracker/?group_id=111978&atid=660924): + + * [ 1810395 ] Implement complexType complexContent extension + +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): + + * [ 1813144 ] Typemap not used in interface class + * [ 1810058 ] .tt's pod indexed on CPAN + +The following uncategorized improvements have been made: + + * Documentation improvements + 2.00_18 ---- The following features were added (the numbers in square brackets are the diff --git a/MANIFEST b/MANIFEST index 22fac4c..cc2ad57 100644 --- a/MANIFEST +++ b/MANIFEST @@ -59,12 +59,14 @@ 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/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/choice.tt lib/SOAP/WSDL/Generator/Template/XSD/complexType/POD/complexContent.tt lib/SOAP/WSDL/Generator/Template/XSD/complexType/POD/restriction.tt lib/SOAP/WSDL/Generator/Template/XSD/complexType/POD/structure.tt lib/SOAP/WSDL/Generator/Template/XSD/complexType/restriction.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/structure.tt lib/SOAP/WSDL/Generator/Template/XSD/Interface.tt diff --git a/META.yml b/META.yml index f9a22b8..5aabe7f 100644 --- a/META.yml +++ b/META.yml @@ -1,6 +1,6 @@ --- name: SOAP-WSDL -version: 2.00_18 +version: 2.00_19 author: [] abstract: SOAP with WSDL support license: artistic @@ -246,3 +246,5 @@ generated_by: Module::Build version 0.2808 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.2.html version: 1.2 +no_index: + namespace: SOAP::WSDL::Generator::Template::XSD diff --git a/TODO b/TODO index a973440..05ae23f 100644 --- a/TODO +++ b/TODO @@ -2,7 +2,6 @@ TODO list for SOAP::WSDL 2.00 Pre-releases -------- -* Implement a Generator Plugin API * Implement a interface similar to SOAP::Schema (#1783639) diff --git a/lib/SOAP/WSDL/Generator/Template/XSD/Interface.tt b/lib/SOAP/WSDL/Generator/Template/XSD/Interface.tt index 18149d7..a85c6ef 100644 --- a/lib/SOAP/WSDL/Generator/Template/XSD/Interface.tt +++ b/lib/SOAP/WSDL/Generator/Template/XSD/Interface.tt @@ -4,6 +4,10 @@ use warnings; use Class::Std::Storable; use base qw(SOAP::WSDL::Client::Base); +# only load if it hasn't been loaded before +require [% typemap_prefix %]::[% service.get_name %] + if not [% typemap_prefix %]::[% service.get_name %]->can('get_class'); + sub START { $_[0]->set_proxy('[% port.first_address.get_location %]') if not $_[2]->{proxy}; $_[0]->set_class_resolver('[% typemap_prefix %]::[% service.get_name %]') diff --git a/lib/SOAP/WSDL/Generator/Template/XSD/complexType/all.tt b/lib/SOAP/WSDL/Generator/Template/XSD/complexType/all.tt index 8c414ae..8b5bc65 100644 --- a/lib/SOAP/WSDL/Generator/Template/XSD/complexType/all.tt +++ b/lib/SOAP/WSDL/Generator/Template/XSD/complexType/all.tt @@ -1,3 +1,4 @@ +use Class::Std::Storable; use base qw(SOAP::WSDL::XSD::Typelib::ComplexType); { # BLOCK to scope variables diff --git a/lib/SOAP/WSDL/Generator/Template/XSD/complexType/complexContent.tt b/lib/SOAP/WSDL/Generator/Template/XSD/complexType/complexContent.tt index f985236..2ca8c2e 100644 --- a/lib/SOAP/WSDL/Generator/Template/XSD/complexType/complexContent.tt +++ b/lib/SOAP/WSDL/Generator/Template/XSD/complexType/complexContent.tt @@ -1,7 +1,7 @@ [% IF (complexType.get_variety == 'restriction'); INCLUDE complexType/restriction.tt(complexType = complexType); ELSIF (complexType.get_variety == 'sequence'); - THROW NOT_IMPLEMENTED, "${ complexType.get_name } - complexType complexContent extension not implemented yet"; + INCLUDE complexType/extension.tt(complexType = complexType); ELSE; THROW UNKNOWN, "unknown variety ${ complexType.get_variety }"; END; diff --git a/lib/SOAP/WSDL/Generator/Template/XSD/complexType/contentModel.tt b/lib/SOAP/WSDL/Generator/Template/XSD/complexType/contentModel.tt index 7e7694f..b38d459 100644 --- a/lib/SOAP/WSDL/Generator/Template/XSD/complexType/contentModel.tt +++ b/lib/SOAP/WSDL/Generator/Template/XSD/complexType/contentModel.tt @@ -1,15 +1,7 @@ -[% IF (complexType.get_variety == 'all'); - INCLUDE complexType/all.tt(complexType = complexType); -ELSIF (complexType.get_variety == 'sequence'); - INCLUDE complexType/all.tt(complexType = complexType); -ELSIF (complexType.get_variety == 'group'); - THROW NOT_IMPLEMENTED, "${ element.get_name } - complexType group not implemented yet"; -ELSIF (complexType.get_variety == 'choice'); - INCLUDE complexType/all.tt(complexType = complexType); -ELSIF (complexType.get_contentModel == 'simpleContent'); +[% IF (complexType.get_contentModel == 'simpleContent'); THROW NOT_IMPLEMENTED, "${ element.get_name } - complexType simpleContent not implemented yet"; ELSIF (complexType.get_contentModel == 'complexContent'); INCLUDE complexType/complexContent.tt(complexType = complexType); ELSE; - THROW NOT_IMPLEMENTED, "Unknown content model ${ complexType.get_contentModel }"; + INCLUDE complexType/variety.tt(complexType = complexType); END %] diff --git a/lib/SOAP/WSDL/Generator/Template/XSD/complexType/extension.tt b/lib/SOAP/WSDL/Generator/Template/XSD/complexType/extension.tt new file mode 100644 index 0000000..45fc3b8 --- /dev/null +++ b/lib/SOAP/WSDL/Generator/Template/XSD/complexType/extension.tt @@ -0,0 +1,24 @@ +[% + +base_name=complexType.expand( complexType.get_base); +base_type = definitions.first_types.find_type( base_name ); + +element_from = complexType.get_element; + +# +# Sanity check: All original elements must be noted first +# +FOREACH element = base_type.get_element; + IF element_from.${ loop.index }.get_name != element.get_name; + THROW WSDL "${element.get_name} not found at position ${ loop.index } in extension type ${ complexType.get_name }"; + END; +END; + + +-%] +use base qw([% type_prefix %]::[% base_name.1.replace('\.', '::') %]); +[% + +INCLUDE complexType/variety.tt(complexType = complexType); + +%] \ No newline at end of file diff --git a/lib/SOAP/WSDL/Generator/Template/XSD/complexType/restriction.tt b/lib/SOAP/WSDL/Generator/Template/XSD/complexType/restriction.tt index f6141db..fd3edcc 100644 --- a/lib/SOAP/WSDL/Generator/Template/XSD/complexType/restriction.tt +++ b/lib/SOAP/WSDL/Generator/Template/XSD/complexType/restriction.tt @@ -1,7 +1,7 @@ [% IF (base=complexType.get_base); base_name=complexType.expand(base); -%] -use base qw([% type_prefix %]::[% base_name.1 %]); +use base qw([% type_prefix %]::[% base_name.1.replace('\.', '::') %]); [% ELSE; THROW NOT_IMPLEMENTED, "restriction without base not supported"; diff --git a/lib/SOAP/WSDL/Generator/Template/XSD/complexType/variety.tt b/lib/SOAP/WSDL/Generator/Template/XSD/complexType/variety.tt new file mode 100644 index 0000000..4d7bb64 --- /dev/null +++ b/lib/SOAP/WSDL/Generator/Template/XSD/complexType/variety.tt @@ -0,0 +1,13 @@ +[% +IF (complexType.get_variety == 'all'); + INCLUDE complexType/all.tt(complexType = complexType); +ELSIF (complexType.get_variety == 'sequence'); + INCLUDE complexType/all.tt(complexType = complexType); +ELSIF (complexType.get_variety == 'group'); + THROW NOT_IMPLEMENTED, "${ element.get_name } - complexType group not implemented yet"; +ELSIF (complexType.get_variety == 'choice'); + INCLUDE complexType/all.tt(complexType = complexType); +ELSE; + THROW NOT_IMPLEMENTED, "Unknown variety ${ complexType.get_variety }"; +END; +%] \ No newline at end of file diff --git a/lib/SOAP/WSDL/Manual/XSD.pod b/lib/SOAP/WSDL/Manual/XSD.pod index 7206cfb..7a237c3 100644 --- a/lib/SOAP/WSDL/Manual/XSD.pod +++ b/lib/SOAP/WSDL/Manual/XSD.pod @@ -178,6 +178,13 @@ no check for occurence 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 @@ -192,12 +199,30 @@ No additional processing or content checking is performed yet. complexType restriction -Note that complexType with restriction variety classes don't exhibit their -type via the xsi:type attribute yet, so they currently cannot be used as -a replacement for their base type. - =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 @@ -217,8 +242,6 @@ SOAP::WSDL::XSD::Typelib::XSD::list. Derivation by restriction is implemented by inheriting from a base type and applying the required restrictions. -=head2 Complex Types - =head1 FACETS XML Schema facets are not implemented yet. @@ -244,7 +267,6 @@ The following XML Schema declaration elements are not supported yet: =item * Type definition elements - complexContent - only restriction supported simpleContent union diff --git a/lib/SOAP/WSDL/TypeLookup.pm b/lib/SOAP/WSDL/TypeLookup.pm index b249681..ced216a 100644 --- a/lib/SOAP/WSDL/TypeLookup.pm +++ b/lib/SOAP/WSDL/TypeLookup.pm @@ -136,6 +136,10 @@ my %TYPES = ( type => 'METHOD', method => 'set_restriction', }, + extension => { + type => 'METHOD', + method => 'set_extension', + }, list => { type => 'METHOD', method => 'set_list', diff --git a/lib/SOAP/WSDL/XSD/ComplexType.pm b/lib/SOAP/WSDL/XSD/ComplexType.pm index c3ad001..f0c17e7 100644 --- a/lib/SOAP/WSDL/XSD/ComplexType.pm +++ b/lib/SOAP/WSDL/XSD/ComplexType.pm @@ -18,7 +18,7 @@ my %abstract_of :ATTR(:name :default<()>); my %mixed_of :ATTR(:name :default<()>); # default is false # is set to simpleContent/complexContent -my %content_model_of :ATTR(:name :default<()>); +my %content_model_of :ATTR(:name :default); sub get_variety; *get_variety = \&get_flavor; @@ -45,6 +45,12 @@ sub set_restriction { $base_of{ ident $self } = $element->{ Value }; } +sub set_extension { + my $self = shift; + my $element = shift; + $flavor_of{ ident $self } = 'extension'; + $base_of{ ident $self } = $element->{ Value }; +} sub init { my $self = shift; diff --git a/t/SOAP/WSDL/Generator/Template.t b/t/SOAP/WSDL/Generator/Template.t index 48eec2b..c63f24d 100644 --- a/t/SOAP/WSDL/Generator/Template.t +++ b/t/SOAP/WSDL/Generator/Template.t @@ -19,14 +19,8 @@ my $generator = SOAP::WSDL::Generator::Template::XSD->new({ definitions => $definitions, }); my $output = q{}; -$generator->generate_interface({ - NO_POD => 1, - output => \$output, -}); -ok eval $output; -$output = q{}; $generator->generate_typemap({ NO_POD => 1, output => \$output, @@ -35,7 +29,19 @@ $generator->generate_typemap({ ok eval $output; print $@ if $@; -print $output; +#print $output; + +$output = q{}; +$generator->generate_interface({ + NO_POD => 1, + output => \$output, +}); + +ok eval $output; +print $@ if $@; + + +# print $output; __END__ my $tt = Template->new( diff --git a/t/SOAP/WSDL/Generator/XSD.t b/t/SOAP/WSDL/Generator/XSD.t index 03ba3ca..6a9f4d8 100644 --- a/t/SOAP/WSDL/Generator/XSD.t +++ b/t/SOAP/WSDL/Generator/XSD.t @@ -1,4 +1,4 @@ -use Test::More tests => 26; +use Test::More tests => 30; use File::Basename qw(dirname); use File::Spec; use File::Path; @@ -107,5 +107,15 @@ $complexRestriction = MyTypes::testComplexTypeRestriction->new({ is $complexRestriction->get_Test1(), 'test1'; is $complexRestriction->get_Test2(), 'test2'; +ok eval { require MyTypes::testComplexTypeExtension }; +$complexExtension = MyTypes::testComplexTypeExtension->new({ + Test1 => 'test1', + Test2 => 'test2', + Test3 => 'test3', +}); +is $complexExtension->get_Test1(), 'test1'; +is $complexExtension->get_Test2(), 'test2'; +is $complexExtension->get_Test3(), 'test3'; + rmtree "$path/testlib"; diff --git a/t/acceptance/wsdl/generator_test.wsdl b/t/acceptance/wsdl/generator_test.wsdl index 7300ef7..e876701 100644 --- a/t/acceptance/wsdl/generator_test.wsdl +++ b/t/acceptance/wsdl/generator_test.wsdl @@ -84,6 +84,21 @@ + + + complexType extension test + + + + + + + + + + + +