[Xml-compile] Examples of code for handling anyType elements with complex typed sub-elements?

Mark Overmeer mark at overmeer.net
Tue Aug 12 15:17:11 GMT 2014


Hi Kingsley,

It seems that your email got stuck at the mailinglist provider
for 8 days....

* Kingsley Kerce (kingsley at localyokelmedia.com) [140812 13:55]:
> I'm using XML::Compile::WSDL11 with (what I expect is) a relatively
> complex WSDL.  I have no control or influence on the WSDL or service.
> There are quite a few anyType elements, many of which have
> sub-elements with complex types.

Complex and ugly.  Not the best combination.  Modern schema's use
substitutionGroups for this.

> Are there any publicly available examples of code which handle a
> complex typed sub-element, i.e.,
>     XML::Compile::WSDL11->new(..., opts_rw => { any_type => \&code } ...
> in Reader and Writer contexts?

XML::Compile usually does understand AnyType's with some help.

> Also, what's a good approach for separating the Reader and Writer
> aspects of any_type handlers?

Good question.  The opts_rw are used in both cases, opts_reader and
opts_writer options in only one.

By default, the anyTypes in the received message get decoded when
their type is known in a schema.  For writing XML, it is more
complex.  You need to create XML nodes separately.

There are many uses of this in other modules I wrote.  For instance,
lib/XML/Compile/WSS/BasicAuth.pm sub prepareWriting() shows it a few
times.  You probably do not need that sub{} which I create at the
end.  I hope it is enough to understand the process.
-- 
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