肥皂的Ajax跨域问题 [英] Soap Ajax cross domain problem

查看:103
本文介绍了肥皂的Ajax跨域问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用ajax访问另一台服务器上的SOAP的Web服务,但我得到一个访问控制允许起源错误。 Web服务返回XML所以JSONP不能使用和web服务也被用于在另一个应用程序,以便修改可能是最后的选项。任何解决办法?

I'm trying to access a SOAP web service on another server using ajax but I'm getting an Access Control Allow Origin error. The web service returns XML so JSONP can't be used and the web service is also being used in another app so modifications is probably the last option. Any solutions?

推荐答案

如果你不能做到JSONP,那么你的选择是:

If you can't do JSONP, then your options are:

  1. Craete一个服务器代理在网页的域,可以从其他域获取期望的结果,并将其从允许的域中继给你。
  2. 如果你愿意限制你的浏览器支持一些现代的浏览器,那么你可以调查跨地资源共享(CORS),这是一个更安全的方式做跨域请求。你可以阅读一下 rel="nofollow">。
  3. 通过闪存跨域Ajax支持,需要放置您要访问的服务器的主机在适当的跨域策略文件。请参见这里和的此处一些更多的信息。
  1. Craete a server proxy at the domain of the page that can fetch the desired result from the other domain and relay it to you from the allowed domain.
  2. If you're willing to limit your browser support to some modern browsers, then you can investigate Cross Origin Resource Sharing (CORS) which is a "safer" way to do cross-domain requests. You can read about it here.
  3. Cross-domain ajax support via Flash which requires the placement of an appropriate cross-domain policy file on the host of the server you want to access. See here and here for some more info.

这篇关于肥皂的Ajax跨域问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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