[Xml-compile] Logging from callback

Robin V. robinsp at gmail.com
Sat Apr 24 14:10:21 GMT 2010


After reading some documentation, Fault soap handling is clearer in my
mind, but the way to return detail object from callback with x::c::s
is still a mystery to me...

I've understood the meaning of fault code and how to build it with
x::c::s, that's the only progress I made.

I only managed to trigger an error by passing an hashref in a "detail" element:

my $code = pack_type SOAP11ENV, 'Server.validationFailed';

{
	Fault => {
		faultcode   => $code
		, faultstring => 'not implemented'
		, faultactor  => 'who mom likes',
          	detail => {
          		'{http://www.siri.org.uk/siri}OtherError' => {
				ErrorText => 'pouet'
	  		},
	 	Description =>  'ARRRG'
		}
	}
}

It returns this message which is coherent with the fact that x::c::s
expects "detail" to be an XML::LibXML element.

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Body>
      <SOAP-ENV:Fault>
         <faultcode>SOAP-ENV:Server.invalidResponse</faultcode>
         <faultstring>procedure DataSupply for SOAP11 produced an
invalid response</faultstring>
         <faultactor>NEXT</faultactor>
         <detail>
            <error>elements for 'any' are XML::LibXML nodes, not
HASH(0xcf4a2d8) at
{http://schemas.xmlsoap.org/soap/envelope/}Fault/detail#any</error>
         </detail>
      </SOAP-ENV:Fault>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The other thing I observed (not knowing if it's a normal behaviour or
not) is that the SOAP-ENV:Fault element is sometimes a direct child
element of SOAP-ENV:Body:

"http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <soap:Fault>
      <faultcode>SOAP-ENV:Server</faultcode>

and it's sometimes a second level child:

   <SOAP-ENV:Body>
      <siriWS:DataSupplyResponse>
         <SOAP-ENV:Fault>
            <faultcode>SOAP-ENV:Server</faultcode>

Once again, thanks in advance for the help you could give me :)

Best regards,
Robin


On Sat, Apr 24, 2010 at 2:51 PM, Robin V. <robinsp at gmail.com> wrote:
> I feel like I should have paid more attention to the content of the
> 'faultcode', to its meaning. I'm digging up the web for information
> about soap fault handling, but any hint on the good way to return
> fault message detail is still appreciated.
>
> Robin
>
>
>> It's not something mandatory, but I would have liked to issue a real
>> fault message for unimplemented services of the wsdl. The docs are
>> clear on how to return fault and I managed to return a simple fault,
>> but I'd like to return a complex fault (with detail). Is this possible
>> with x:c ?
>>
>> I don't see how to do this in
>> http://search.cpan.org/~markov/XML-Compile-SOAP-Daemon-2.02/lib/XML/Compile/SOAP/Daemon.pod
>>
>> Should I return something like:
>>
>>        {
>>       SiriError => {
>>                                faultcode   => 111,
>>                                faultstring => 'not implemented',
>>                                faultactor  => 'who mom likes',
>>                                OtherError => {
>>                                        ErrorText => 'Mistake'
>>                                },
>>                                Description =>  'ARRRG'
>>        }
>



More information about the Xml-compile mailing list