我完全被卡住了,不知道为什么会这样——请帮忙!!:)
我有一个试图调用用 Perl 编码的方法的 javascript。
javascript函数:
function getSOAP() {
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('POST', 'http://localhost/ispy/cwebs/hi/', true);
// build SOAP request
var sr =
'<?xml version="1.0" encoding="UTF-8"?>' +
'<Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">' +
'<Body>' +
'<hi>' +
'<who>markh</who>' +
'</hi>' +
'</Body>' +
'</Envelope>';
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) { alert('done use firebug to see responce'); }
}
}
// Send the POST request
xmlhttp.setRequestHeader('Content-Type', 'text/xml; charset=utf-8');
xmlhttp.setRequestHeader("SOAPAction", '"urn:iSPYcwebs#hi"');
xmlhttp.setRequestHeader("Accept", '"application/soap"');
xmlhttp.send(sr);
}
====== 在 apache httd.conf 中:
# BEGIN MOD_PERL CONFIG
ScriptAlias /perl-bin/ "C:/work/dev/indigoampp/apache-2.2.11/perl-bin/"
<Location /ispy/cwebs/hi>
SetHandler perl-script
PerlSendHeader On
PerlResponseHandler Apache::SOAP
PerlSetVar dispatch_to "C:/work/dev/indigoampp/perl-5.10.0/site, iSPYcwebs::hi"
PerlSetVar options "compress_threshold => 1000"
</Location>
<Directory "C:/work/dev/indigoampp/apache-2.2.11/htdocs">
<IfModule mod_perl.c>
# Files directive is only valid in Directory section
<Files ~ "\.(pl|pm|cgi)$">
SetHandler perl-script
PerlHandler ModPerl::Registry
Options ExecCGI
Allow from all
PerlSendHeader On
</Files>
</IfModule>
</Directory>
# END MOD_PERL CONFIG
======
我试图调用的 Perl 代码:
#!C:/work/dev/indigoampp/perl-5.10.0/bin/perl.exe -w
package iSPYcwebs;
use strict;
use SOAP::Lite +trace => 'debug';
use vars qw(@ISA);
@ISA = qw(&hi SOAP::Server::Parameters );
sub hi {
my $self = shift;
my $envelope = pop;
my $who = $envelope->dataof("//hi/who")->value;
return SOAP::Data->name('hello' => 'iSPY says hello to '.$who);
}
1;
======
这是错误字符串:
拒绝访问 C:\work\dev\indigoampp\perl-5.10.0\site\lib/SOAP/Lite.pm 第 2806 行的类 (main) 中的方法 (hi)。
======
我敢肯定我不能成为这个星球上第一个尝试这个的人,但我似乎无法在任何地方找到答案。Stackoverflow - 你是我最后的希望!!