开发者

Injecting a custom die() handler into mod_perl SOAP handler

开发者 https://www.devze.com 2023-02-17 04:40 出处:网络
We\'re using a $server = SOAP::Transport::HTTP::Apache->new; $server->dispatch_with(...) over here as a backend to a JS-based application. Should the underl开发者_开发技巧ying module die, it sen

We're using a $server = SOAP::Transport::HTTP::Apache->new; $server->dispatch_with(...) over here as a backend to a JS-based application. Should the underl开发者_开发技巧ying module die, it sends back a nice error message that gets displayed by the JS code.

The problem is, I would like more detailed messages (e.g. Carp::longmess), and a hard copy of those on STDERR.

How can I inject a custom exception handler into SOAP::Transport::HTTP::Apache with minimal code modifications?

(This is a large and old project we can't afford to rewrite, though honestly it deserves a rewrite).

UPDATE: here's a sample error message:

<soap:Body><soap:Fault>
<faultcode>soap:Server</faultcode><faultstring>Column 
'allocation' cannot be null at 
/usr/local/lib/perl5/site_perl/5.8.8/Tangram/Storage.pm
 line 686. </faultstring></soap:Fault></soap:Body>

I get a Tangram error but this is unlikely a bug in Tangram and anyway I need a full stack-trace. OTOH, the die message got into a SOAP message which is not a normal die action so there's a handler somewhere -- which I want to customize a bit.


The error handler is located under SOAP::Transport::HTTP::Server::_output_soap_fault. Try a grep on <faultcode> in the perl INC paths.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号