[Xml-compile] Help with compiling serializers and de-serializers

Mark Overmeer mark at overmeer.net
Thu May 26 12:47:56 GMT 2011


* Bill Moseley (moseley at hank.org) [110525 13:02]:
> On Tue, May 24, 2011 at 11:40 PM, Mark Overmeer <mark at overmeer.net> wrote:
> Still needs work and docs.  And I'm sure there's code that could be done
> more efficiently (suggestions welcome).
> 
> Here's the controller Role:
>    http://hank.org/CatalystX/TraitFor/Controller/SOAP.pm

Taaadaaa... merging fake Perl (Moose) and real Perl OO does complicate
things.

As your question was already answered in my previous email: there
is no need for you to produce low-level faults. It is already there
and tested. Method XML::Compile::Daemon::process() handles all
errors on XML level.  On the transport level, you cannot reply with
XML so you do not need your soap_fault().

> For example, say I require a SOAPAction header, then I have this code:
>    return $self->soap_fault( "Missing SOAPAction header" ) unless
> $request->header( 'soapaction' );

process() will call the handler for you, so there is no need for your
code to produce these errors.  Sometimes SOAPAction is used, maybe
WSA is used, etc.  Do not try to be smarter ;-)

If you accidentally do have a SOAPAction in your transport protocol,
then pass it as fourth parameter to process().  But it may be undef
and still work ;-)  According to the SOAP "specification", the
SOAPAction is only for proxies to be able to route. The selection
of the handler should be based on the name of the body elements.
(Very poor design: that can be very expensive to discover)

> What would you write for that soap_fault method to have it build
> a SOAP XML fault response?

In stead of returning structural values to have XML produced for you,
you can also always provide a fully prepared XML::LibXML::Element node.
-- 
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