我正在学习SOAP并创建了一个非常小的CGI脚本,该脚本在Apache上运行,它将提供一小组功能。
#!/usr/bin/perl
use SOAP::Transport::HTTP;
SOAP::Transport::HTTP::CGI
-> dispatch_to('Demo')
-> handle;
package Demo;
sub hi {
return "hello, world";
}
sub bye {
return "goodbye, cruel world";
}
sub languages {
return ("Perl", "C", "sh");
}
我的客户
#!perl -w
use SOAP::Lite;
print SOAP::Lite
-> uri('http://localhost:80/cgi-bin/Demo')
-> proxy('http://localhost:80/cgi-bin/hibye.cgi')
-> hi()
-> result;
运行脚本时,所有内容都会编译并且没有错误。问题是,当我运行客户端时,它完成了,但它没有得到响应。我认为URI可能是错误的,但我不确定。代理很好。
编辑:在控制台中运行脚本时我没有遇到错误,但是我在apache日志中遇到错误(由于某些原因我没有检查)。 错误
script not found or unable to stat: /usr/lib/cgi-bin/hibye.cgis
这是一个许可问题。我修复了它,现在我在运行脚本时没有任何问题出现在控制台中,也没有出现在错误日志中。
在访问日志中,我得到以下内容:
"POST /cgi-bin/hibye.cgi HTTP/1.1" 500 780 "-" "SOAP::Lite/Perl/0.714"
答案 0 :(得分:0)
经过一些实验,我发现了问题 - 它是在uri绑定中。在这种情况下,必须改变:
http://localhost:80/cgi-bin/Demo
为:
http://localhost:80/Demo
并且脚本将按预期工作。