简体   繁体   English

当查询字符串不够长时,如何从jQuery调用(网络本地)第三方网络服务?

[英]How to call a (network local) 3rd party web service from jQuery when query string isn't long enough?

There are 3rd Party web service's that we call from a Fat client, it has been running without any problems for years. 我们从Fat客户端调用了3rd Party Web服务,多年来一直没有任何问题。

I have been tasked with converting the Fat client into a mobile ready site that works on any common browser. 我的任务是将Fat客户端转换为可在任何通用浏览器上使用的可移动网站。 As the 3rd Party service requires a cross domain call, I have to use JSONP, however this uses a HTTP GET and passes the data in the query string. 由于第3方服务需要跨域调用,因此我必须使用JSONP,但这使用HTTP GET并在查询字符串中传递数据。 Some of the objects we send are rather large and require a POST due to the limit on query string , however with JSONP this is not possible. 由于查询字符串限制,我们发送的某些对象相当大,并且需要POST,但是使用JSONP则无法实现。

This answer has made me wonder if there is an approach I have missed. 这个答案让我想知道是否有我错过的方法。 Does anyone have any suggestions? 有没有人有什么建议?

It isn't possible to write a proxy handler/service that makes the call for me due to firewall/security restrictions at all the sites (there are 1000's sites, and they all have instances of this 3rd party service and will not change their rules). 由于所有站点(有1000个站点,并且它们都具有此第三方服务的实例,并且它们都具有此实例)的防火墙/安全性限制,因此无法编写代理处理程序/服务来为我打电话)。 So it is important that the jQuery script can make this call from the browser itself. 因此,重要的是jQuery脚本可以从浏览器本身进行此调用。

Only option would be to find a way to compress what is sent to the server and have the server uncompress it. 唯一的选择是找到一种压缩发送到服务器的内容并使服务器解压缩的方法。

Other option is to enable CORS on the remote server to allow the cross domain calls. 另一种选择是在远程服务器上启用CORS以允许跨域调用。

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

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