Skip Menu |

This queue is for tickets about the SOAP-WSDL CPAN distribution.

Report information
The Basics
Id: 42388
Status: resolved
Priority: 0/
Queue: SOAP-WSDL

People
Owner: Nobody in particular
Requestors: adam.prime [...] utoronto.ca
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.00.06
Fixed in: (no value)



Subject: [PATCH] Disabling 'die' in Typemaps
At work I'm working on an application which is supposed to provide a series of versioned SOAP interfaces. Part of our requirements, is that it be possible for a 'newer' version of a client to be able to at least partially be able to talk to and older version of a server. In order for this to work, SOAP::WSDL need to not die when it encounters an unexpected element in the SOAP body, and should instead ignore it. This patch modifies wsdl2perl.pl to add an option called unstrict (u) which when enabled causes the Typemaps files get_class function to not die when it is asked for a class it doesn't know what to do with, and instead return '__SKIP__', which causes the parser to simply skip the block. Thoughts?
Subject: unstrict.patch
Index: lib/SOAP/WSDL/Generator/Template.pm =================================================================== --- lib/SOAP/WSDL/Generator/Template.pm (revision 764) +++ lib/SOAP/WSDL/Generator/Template.pm (working copy) @@ -15,6 +15,7 @@ my %type_prefix_of :ATTR(:name<type_prefix> :default<MyTypes>); my %element_prefix_of :ATTR(:name<element_prefix> :default<MyElements>); my %attribute_prefix_of :ATTR(:name<attribute_prefix> :default<MyAttributes>); +my %unstrict_of :ATTR(:name<unstrict> :default<0>); my %INCLUDE_PATH_of :ATTR(:name<INCLUDE_PATH> :default<()>); my %EVAL_PERL_of :ATTR(:name<EVAL_PERL> :default<0>); my %RECURSION_of :ATTR(:name<RECURSION> :default<0>); @@ -62,6 +63,7 @@ }), }, definitions => $self->get_definitions, + unstrict => $self->get_unstrict, NO_POD => delete $arg_ref->{ NO_POD } ? 1 : 0 , %{ $arg_ref } }, Index: lib/SOAP/WSDL/Generator/Template/XSD/Typemap.tt =================================================================== --- lib/SOAP/WSDL/Generator/Template/XSD/Typemap.tt (revision 764) +++ lib/SOAP/WSDL/Generator/Template/XSD/Typemap.tt (working copy) @@ -7,7 +7,13 @@ sub get_class { my $name = join '/', @{ $_[1] }; - exists $typemap_1->{ $name } or die "Cannot resolve $name via " . __PACKAGE__; + exists $typemap_1->{ $name } or +[%- IF !unstrict -%] + die "Cannot resolve $name via " . __PACKAGE__; +[%- ELSE -%] + return '__SKIP__'; +[%- END -%] + return $typemap_1->{ $name }; } Index: bin/wsdl2perl.pl =================================================================== --- bin/wsdl2perl.pl (revision 764) +++ bin/wsdl2perl.pl (working copy) @@ -22,6 +22,7 @@ generator => 'XSD', server => 0, namespace => 0, + unstrict => 0, ); { # a block just to scope "no warnings" @@ -69,6 +70,7 @@ generator=s server|s namespaces|n + unstrict|u ) ); @@ -141,6 +143,8 @@ if $generator->can('set_OUTPUT_PATH'); $generator->set_definitions($definitions) if $generator->can('set_definitions'); +$generator->set_unstrict($opt{ unstrict }) + if $generator->can('set_unstrict'); # $generator->set_wsdl($xml) if $generator->can('set_wsdl'); # start with typelib, as errors will most likely occur here...
Subject: Re: [rt.cpan.org #42388] [PATCH] Disabling 'die' in Typemaps
Date: Wed, 14 Jan 2009 17:47:13 +0100
To: bug-SOAP-WSDL [...] rt.cpan.org
From: Martin Kutter <martin.kutter [...] fen-net.de>
Hi Adam, ... the problem is that I'm already removing typemaps altogether, because they don't allow recursive data structures, so this is only a temporary fix. There's a feature request open on sourceforge asking for the same behaviour, so I gave it a quick try. You'll need rev766 or newer from SOAP::WSDL's subversion at https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/ Pass the following (extra) to the interface's constructor: deserializer_args => { strict => 0 } Example: my $soap = MyInterfaces::TestService::TestPort->new({ deserializer_args => { strict => 0 } }); The feature is not implemented for servers yet. Martin Am Dienstag, den 13.01.2009, 16:57 -0500 schrieb Adam Prime via RT: Show quoted text
> Tue Jan 13 16:57:34 2009: Request 42388 was acted upon. > Transaction: Ticket created by APRIME > Queue: SOAP-WSDL > Subject: [PATCH] Disabling 'die' in Typemaps > Broken in: 2.00.06 > Severity: Important > Owner: Nobody > Requestors: adam.prime@utoronto.ca > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=42388 > > > > At work I'm working on an application which is supposed to provide a > series of versioned SOAP interfaces. Part of our requirements, is that > it be possible for a 'newer' version of a client to be able to at least > partially be able to talk to and older version of a server. In order > for this to work, SOAP::WSDL need to not die when it encounters an > unexpected element in the SOAP body, and should instead ignore it. > > This patch modifies wsdl2perl.pl to add an option called unstrict (u) > which when enabled causes the Typemaps files get_class function to not > die when it is asked for a class it doesn't know what to do with, and > instead return '__SKIP__', which causes the parser to simply skip the block. > > Thoughts?
Subject: Re: [rt.cpan.org #42388] [PATCH] Disabling 'die' in Typemaps
Date: Wed, 14 Jan 2009 13:15:30 -0500
To: bug-SOAP-WSDL [...] rt.cpan.org
From: Adam Prime <adam.prime [...] utoronto.ca>
Well, i'm happy to hear that regardless, unfortunately it's the server end that I actually need, not the client. Is the server side of this something your actively hacking on? Martin Kutter via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=42388 > > > Hi Adam, > > ... the problem is that I'm already removing typemaps altogether, > because they don't allow recursive data structures, so this is only a > temporary fix. > > There's a feature request open on sourceforge asking for the same > behaviour, so I gave it a quick try. > > You'll need rev766 or newer from SOAP::WSDL's subversion at > https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/ > > Pass the following (extra) to the interface's constructor: > > deserializer_args => { strict => 0 } > > Example: > > my $soap = MyInterfaces::TestService::TestPort->new({ > deserializer_args => { strict => 0 } > }); > > The feature is not implemented for servers yet. > > Martin >
Subject: Re: [rt.cpan.org #42388] [PATCH] Disabling 'die' in Typemaps
Date: Fri, 16 Jan 2009 19:15:55 +0100
To: bug-SOAP-WSDL [...] rt.cpan.org
From: Martin Kutter <martin.kutter [...] fen-net.de>
Hi Alexander, I just looked through the server implementation, and it looks like there are no additional changes needed for CGI-based servers - the mod_perl implementation will need some changes to make the strictness behaviour configurable from the apache configuration. All you have to do for CGI-based servers is to create a deserializer explicitly and pass it to the transport object. Your code should look somewhat like this: my $soap = MyServer->new({ transport_class => "SOAP::WSDL::Server::CGI", dispatch_to => 'main', }); $soap->get_transport()->set_deserializer( SOAP::WSDL::Deserializer::XSD->new({ strict => 0, } ); $soap->handle(); I haven't tested this setup yet, though... It will take some time untill I get to add the mod_perl stuff and the tests - time's always scarce... Martin Am Mittwoch, den 14.01.2009, 13:16 -0500 schrieb Adam Prime via RT: Show quoted text
> Queue: SOAP-WSDL > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=42388 > > > Well, i'm happy to hear that regardless, unfortunately it's the server > end that I actually need, not the client. Is the server side of this > something your actively hacking on? > > > Martin Kutter via RT wrote:
> > <URL: https://rt.cpan.org/Ticket/Display.html?id=42388 > > > > > Hi Adam, > > > > ... the problem is that I'm already removing typemaps altogether, > > because they don't allow recursive data structures, so this is only a > > temporary fix. > > > > There's a feature request open on sourceforge asking for the same > > behaviour, so I gave it a quick try. > > > > You'll need rev766 or newer from SOAP::WSDL's subversion at > > https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/ > > > > Pass the following (extra) to the interface's constructor: > > > > deserializer_args => { strict => 0 } > > > > Example: > > > > my $soap = MyInterfaces::TestService::TestPort->new({ > > deserializer_args => { strict => 0 } > > }); > > > > The feature is not implemented for servers yet. > > > > Martin > >
> >
Fixed in 2.00.07