SOAP-WSDL - Re: What module(s) should i use to throw a soap exception in my server

Posted on Tue Mar 4 21:07:10 2008 by mkutter in response to 7262 (See the whole thread of 2)
Re: What module(s) should i use to throw a soap exception in my server
Hi Eugenio,

The proper way to throw a exception is just to die - SOAP::WSDL::Server::CGI catches the exception and sends a SOAP Fault back to the client.

If you want more control over the SOAP Fault sent to the client, you can die with a SOAP::WSDL::SOAP::Fault11 object - or just let the SOAP::Server's deserializer create one for you:

my $soap = MyServer::SomeService->new(); die $soap->get_deserializer()->generate_fault({ code => 'soap:Server', role => 'urn:localhost', message =>; "The error message to pas back", detail => "Some details on the error", });

You may use any other object as exception, provided it has a serialize() method which returns the object's XML representation.

Write a response