使GWT与ASP.NET Web服务交互 [英] Make GWT interact with ASP.NET Web Service

查看:98
本文介绍了使GWT与ASP.NET Web服务交互的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道互联网上的一篇优秀文章或教程,展示如何利用GWT利用(ASP.NET)Web服务跨域?

据我所知,应该可以从GWT与XML或JSON进行交互,但当Web服务位于不同的域时会变得更加困难。我尝试过找到一篇文章来演示这个设置,但没有任何运气。

我最初是用JSONP方法(如Google的建议),以便在JavaScript中进行跨站点AJAX调用,但结束了太多的黑客,我必须将它们合并到ASP.NET Web服务中才能使用。



解决方案,而不是将GWT RPC用于JAVA servlet,充当代理,然后使用SOAP调用ASP.NET Web服务。 SOAP Java类是使用作为JAX-WS项目一部分的wslist工具生成的(如演示



使用GWT RPC,我仍然可以异步调用JAVA servlet,为用户提供无缝体验。


Does anyone know of a good article or tutorial on the Internet demonstrating the use of GWT leveraging a (ASP.NET) web service cross domain?

To my knowledge, interacting with either XML or JSON should be possible from GWT, but becomes a lot more difficult when the web service is on a different domain. I've tried finding an article that demonstrates this setup, but without any luck.

解决方案

I was initially going for a JSONP approach (as suggested by Google), in order to do cross site AJAX calls in JavaScript, but ended up with too many hacks that I had to incorporate into the ASP.NET web service in order for it to work.

The solution, in my case, was instead to use GWT RPC to a JAVA servlet, acting as a proxy, which then would call the ASP.NET Web Service using SOAP. The SOAP Java classes was generated using the wslist tool that is part of JAX-WS project (as demonstrated here).

Using the GWT RPC, I was still able to call the JAVA servlet asynchronously, giving the user a seamless experience.

这篇关于使GWT与ASP.NET Web服务交互的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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