繁体   English   中英

XMLHttpRequest无法加载http://ideone.com/api/1/service.wsdl。 Access-Control-Allow-Origin不允许使用Origin null。

[英]XMLHttpRequest cannot load http://ideone.com/api/1/service.wsdl. Origin null is not allowed by Access-Control-Allow-Origin.

XMLHttpRequest无法加载http://ideone.com/api/1/service.wsdl Access-Control-Allow-Origin不允许使用Origin null。

请在这方面帮助我

 <html>
<head>
 <title> Web services </title>

<script type="text/javascript" src="jquery.js">
</script>

<script type="text/javascript" src="soapproxy.js">
</script>


<script type="text/javascript">


testob={user:"harisrinivas",pass:"ideonehari"};

function resultcallback(res, xml, text, proxy) {
            alert(res);
        }
        function failurecallback(res, xml, text, proxy) {
            alert("SayHello() failed");
        }
        function gotproxycallback(proxy, wsdl, text) {
            if (proxy instanceof SOAPProxy) {
               //proxy.SayHello(null, true, resultcallback, failurecallback);
               SOAPProxy.prototype.invoke(test, testob, async, resultcallback, faultcallback);

            } else {
                alert("Proxy not created!");
            }
        }
        $(document).ready(function () {
            try {
                SOAPProxyFabric.fromUrl("http://ideone.com/api/1/service.wsdl", true, gotproxycallback);
            } catch (x) {
                alert("Failed to load or parse WSDL!");
            }
        });
</script>

</head>


<body>

<h1> Web service testing by Hari Srinivas </h1>



</body>

</html>

我正在使用jquery和soapproxy( http://code.google.com/p/js-soap-proxy/ )。 问题是什么 ? 以及如何删除此错误。

我猜soapproxy fromurl使用xmlhttprequest,不允许网站A的页面向网站B发出请求。其中:

A = google.com 
B = yahoo.com 
or 
A = mysite:80.com 
B = mysite:90.com 
or 
A = subdomain.mysite.com 
B = othersub.mysite.com

您可以在Wikipedia上找到相同的原产地政策信息。 解决该问题的方法是JSONP,但我不认为soapproxy使用它。 快速查找是否是您的问题的另一种方法是获取firefox的forcecors插件,将其激活(查看->工具栏->添加在栏上),然后单击cors(在屏幕的右下角)。 如果为红色,则可以从任何站点连接到任何站点,因为该插件摆弄着http响应,从而使服务器B假装向您发送了cors标头(允许其他网站通过xmlhttprequests连接到它)。

如果您可以访问具有该服务的服务器,则可以按照以下网站上的说明轻松在服务器上启用cors: http ://enable-cors.org/,其中提供了每种类型的Web服务器的示例。

暂无
暂无

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

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