繁体   English   中英

需要Perl SOAP :: Transport :: HTTP :: 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::RequestHTTP::Response

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM