离子|基于SOAP的Web服务|例外:缺少“访问控制允许来源" [英] IONIC | SOAP based web-service | exception: 'Access-Control-Allow-Origin' missing

查看:125
本文介绍了离子|基于SOAP的Web服务|例外:缺少“访问控制允许来源"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用IONIC框架开发移动应用程序,并且想访问基于SOAP的Web服务,我发现了这个

I am developing mobile application using IONIC framework and I want to access SOAP based web-service, i have found this TUTORIAL.

我正在访问基于网络服务的公共部署的肥皂.我已经在SOAP-UI中测试了上述基于SOAP的Web服务,并且能够访问该Web服务,但是当我从ionic框架访问同一Web服务时,它会抛出一个异常:

I am accessing publicly deployed soap based web-service. I have tested the mentioned SOAP based web-service in SOAP-UI and i am able to access the web-service, but when i am accessing the same web-service from ionic framework, it throws an exception:

跨域请求被阻止:相同来源策略"不允许读取 http://上的远程资源www.webservicex.net/globalweather.asmx?wsdl . (原因:CORS标头"Access-Control-Allow-Origin"缺失).

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://www.webservicex.net/globalweather.asmx?wsdl. (Reason: CORS header 'Access-Control-Allow-Origin' missing).

任何人都可以让我知道是什么问题吗?

Can anyone let me know whats the issue?

推荐答案

CORS是在服务器上启用的.您必须确保查询的服务器发送的标头具有

CORS is something that is enabled on the server. you have to make sure that the headers that are sent by the queried server have

访问控制允许来源*;

Access-Control-Allow-Origin *;

完成后,该问题应得到解决.在您的情况下,XML请求被阻止,因为服务器响应中不存在这些标头.

Once that is done, the issue should be resolved. The XML request is being blocked in your case, because these headers are not present in the server response.

更多信息可在此处找到, http://www.w3.org/wiki/CORS_Enabled

More info can be found here, http://www.w3.org/wiki/CORS_Enabled

但是

出于开发目的,您可以尝试在开发阶段使用chrome扩展程序作为解决方法.

For development purpose you can try to use chrome extension as workaround in your development phase.

尝试: https://chrome.google.com/webstore/detail/allow -control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi

注意:在生产环境中,您应该在服务器端启用它. 但是在开发过程中,您可以尝试使用插件来禁用安全性.

NOTE: In Production you should enable it on your server side. But during development, you can try plug-in to disable security.

这篇关于离子|基于SOAP的Web服务|例外:缺少“访问控制允许来源"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆