![](/img/trans.png)
[英]Perl WebService increase max connections using HTTP::Server::Simple::CGI
[英]Need Perl SOAP::Transport::HTTP::CGI sanity check
好的,我認為沒有簡單的方法(使我變得懶惰)來完成我想要的事情,但是鑒於我要執行的Perl SOAP :: Transport :: HTTP :: CGI代碼片段是攔截通過該服務的所有SOAP操作並記錄操作或故障的結果...
SOAP::Transport::HTTP::CGI
-> dispatch_to(
#first arg needs to be the directory holding the PackageName.pm modules with no trailing "/". The args aftre the first are name of SPECIFIC packages to be loaded as needed by SOAP requests
#Failure to call out specific moudules below will allow the external SOAP modules to be loaded, but the overall module @INC path for other Perl modules will be blocked for security reasons
SOAP_MODULE_INCULDE, #name of the directory holding the PackageName.pm modules with no trailing "/"
"TechnicalMetaDataExtraction", #prod - wrapper for EXIFTool
"Ingest", #module (package) name
"ImageManipulation", #module (package) name
"FacebookBroadcast", #unfinished
"CompressDecompress", #unfinished
"ImageOCR", #prod - tesseract
"HandleDotNet", #prod
"Pipeline", #prod (needs work)
"TwitterBroadcast", #prototype
"Messaging", #prototype but text format email works
"Property", #development
"FileManager", #prototype
"PassThrough" #prod - module to do location conversion (URL -> Fedora Obj+DS, Fedora Obj+DS -> file, URL -> InlineBase64, etc.) but format conversion
) #done with the dispacth_to section
-> on_action(sub {
#on_action method lets you specify SOAPAction understanding. It acceptsreference to subroutine that takes three parameters: SOAPAction, method_uri and method_name.
#'SOAPAction' is taken from HTTP header and method_uri and method_name are extracted from request's body. Default behavior is match 'SOAPAction' if present and ignore it otherwise.
#die SOAP::Data->type('string')->name('debug')->value("Intercepted call, SOAP request='".shift(@_)."'");
if($Debug) {
#@_ notes:
#[0] - "http://www.example.org/PassThrough/NewOperation"
#[1] - http://www.example.org/PassThrough/
#[2] - NewOperation
#[3] - "undefined"
my %DataHash=(
message => @_[0]
);
#SendMessageToAMQTopic(localtime()." - ".@_[0]);
SendDebugMessage(\%DataHash, "info");
} #there's only one element passed at this level
}) #end on_action
#-> on_debug() #not valid for SOAP::Transport::HTTP::CGI
#-> request() #valid, but does not fire - request method gives you access to HTTP::Request object which you can provide for Server component to handle request.
#-> response() #does not fire - response method gives you access to HTTP::Response object which you can access to get results from Server component after request was handled.
#-> options({compress_threshold => 10000}) #causes problems for the JavaScript soap client - removed for the moment
-> handle() #fires but ignores content in sub - handle method will handle your request. You should provide parameters with request() method, call handle() and get it back with response().
;
最初,我認為我可以從“ on_action”方法中獲取所需的信息,但是該信息僅包含SOAP調用的目的地(在發送之前?),我正在尋找操作結果中的數據,該結果將被發送回SOAP客戶端。 “ SOAP :: Transport :: HTTP :: CGI”的文檔有點薄,在線示例很少。
有人知道這是否可能提供上面的代碼嗎? 如果不是,那么唯一的選擇是更改我的SOAP服務代碼模塊的每個方法以包括“ SendDebugMessage”功能。
我建議對SOAP::Transport::HTTP::CGI
子類化,然后加入handle()
方法。 一個未經測試且可能無法正常工作的示例為:
package MySoapCGI;
use Data::Dumper;
use SOAP::Transport::HTTP;
use base 'SOAP::Transport::HTTP::CGI';
sub handle {
my $self = shift;
$self->SUPER::handle(@_);
warn Dumper($self->request);
warn Dumper($self->response);
}
用所需的任何日志記錄替換自卸車。 您可能需要進行一些XML解析,因為它們將是原始HTTP::Request
和HTTP::Response
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.