[Xml-compile] XML::Compile::SOAP::Daemon access to SOAP Header content

Mark Overmeer mark at overmeer.net
Wed Sep 15 08:01:12 GMT 2010


* Lars Thegler (lars at thegler.dk) [100915 07:24]:
> I'm writing a SOAP service based on XML::Compile::SOAP::Daemon and a
> WSDL specification [1], which has some authentication information in a
> SOAP Header element.
> 
> I'm setting up callbacks with $deamon->operationsFromWSDL($wsdl,
> callbacks => ...); but the callback is only receiving the SOAP Body
> content.
> 
> How can I access the content received in the SOAP Header?

The SOAP messages are decoded into a HASH. Each body element can be
found back under the part-name as used in the WSDL. This also counts
for header elements which are defined in the WSDL... However... often
header elements are added without being described in the WSDL... and
those are simply ignored (unless the mustUnderstand flag is set)

For WS-addressing, you can simply load the XML::Compile::SOAP::WSA
module, and it will add knowledge about those headers. The same
concept can be used to support other XML standards. There are a lot
of those standards. Which one do you need?

Another approach could be to change the SOAP decoding a little, to
return the header element under its name as XML::LibXML node when it
is not understood... probably a simple change in XML::Compile::SOAP.
Something like

  sub _reader_hook($$)
  {   my ($self, $type, $do) = @_;
  ...
 -          else
 -          {   trace __x"node {type} ignored, expect from {has}",
 -                  type => $type, has => [sort keys %trans];
 -          }
 +          else
 +          {   $h{$type} = $child;
 +          }

-- 
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