[Xml-compile] xsi:type in WSDL

Mark Overmeer mark at overmeer.net
Thu Jun 10 14:02:50 GMT 2010


* Mark Overmeer (mark at overmeer.net) [100609 11:15]:
> Somewhere, the xsi_infomation is not passed to the reader component
> in the call. That's a bug which I will fix.

After a long search, I figured-out that there is no other way to
do it then the "work-around".  compileClient() promissed too much
flexibility.  It is not possible to pass compile options with it,
but only via the opts_rw and friends.

Reason: SOAP uses "any" on many places. It is also unpredictable whether
WSDLs contain "any" constructs.  The decoding of "any" is partially
run-time (at first use) using trick "any_element => 'ATTEMPT'". The means
that the compile options must be passed from compile-time into
run-time... and there is no way to achieve that, except via those opts_
settings (at least at the moment, without serious rewrite)

Concluding: the "feature" is incorrectly described in the documentation.
I'll repair that in the next release.

By the way: you can declare() the components which will be processed
for "any" beforehand. Then, you are able to pre-compile these pieces
before an fork().

"any" is ugly.

> The following is both a good work-around as easier to maintain:
> 
>  my $adsns = 'https://adwords.google.com/api/adwords/cm/v201003';
> 
>  my @err_types = qw/ads:OperationAccessDenied ads:AuthenticationError
>      ads:AuthorizationError/;
> 
>  my $wsdl  = XML::Compile::WSDL11->new('ads.wsdl'
>    , prefixes => [ ads => $adsns ]
>    , opts_rw  => [ xsi_type => { 'ads:ApiError' => \@err_types } ]
>    );
> 
>  my $call = $wsdl->compileClient('get', transport_hook => \&fake_server);
-- 
Regards,
               MarkOv

------------------------------------------------------------------------
       Mark Overmeer MSc                                MARKOV Solutions
       Mark at Overmeer.net                          solutions at overmeer.net
http://Mark.Overmeer.net                   http://solutions.overmeer.net




More information about the Xml-compile mailing list