从 GWT 客户端调用 SOAP Web 服务

发布于 2024-12-17 10:25:31 字数 1584 浏览 2 评论 0原文

我没有任何使用 SOAP 的经验,所以请帮助我。

我在客户端有一个带有 GWT 的网络项目。至于该网站所需的信息,我必须调用/访问 SOAP Web 服务。我读过一些论坛,我应该使用 RequestBuilder 来做到这一点。我有以下代码:

    RequestBuilder builder = new RequestBuilder( RequestBuilder.POST, URL.encode( url ) );

    try {
      builder.sendRequest( null, new RequestCallback() {
        public void onResponseReceived( Request request, Response response) {
            if (200 == response.getStatusCode()) {
                // processing response here
            } else {
                // Handle the error
            }
        }

        public void onError(Request request, Throwable exception) {
            // error
        }

      });
    } catch (RequestException e) {
        // Couldn't connect to server
    }

此代码会导致错误并返回状态代码0。我认为这是 SOP(Same-Origin-Policy)

我可以通过其他方式访问 GWT 中的 SOAP Web 服务吗?

编辑

在此项目中,.wsdl 文件位于现有域中,

http://sample.com/server/soap/soap.wsdl< /p>

已提供 。我也有这个:

http://sample.com/server/soap/soapserver.php< /p>

它有什么帮助我要连接到 SOAP Web 服务吗?

我已经在 java 中创建了一个 SOAP 客户端,但在 javax.xml.* 上遇到了有关继承所需模块的错误。

I don't have any experience working with SOAP so please help me.

i have web project with GWT on the client side. as for the information needed for this site, i have to call/access SOAP web service. i've read some forums that i should use RequestBuilder in order to do so. i have the following code:

    RequestBuilder builder = new RequestBuilder( RequestBuilder.POST, URL.encode( url ) );

    try {
      builder.sendRequest( null, new RequestCallback() {
        public void onResponseReceived( Request request, Response response) {
            if (200 == response.getStatusCode()) {
                // processing response here
            } else {
                // Handle the error
            }
        }

        public void onError(Request request, Throwable exception) {
            // error
        }

      });
    } catch (RequestException e) {
        // Couldn't connect to server
    }

This code causes an error and return status code 0. I think it's the SOP(Same-Origin-Policy) again.

Is there any other way I can do to access SOAP web service in GWT?

E D I T

In this project, a .wsdl file, which is located from an existing domain,

http://sample.com/server/soap/soap.wsdl

is already provided. And I also have this:

http://sample.com/server/soap/soapserver.php

How does it help me to connect to the SOAP web service?

I have created a SOAP Client in java but i encountered an error on javax.xml.* about inheriting the required modules.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

知足的幸福 2024-12-24 10:25:31

如果您尝试从另一个域访问 SOAP 服务,那么您可能会受到 SOP 的限制。我建议构建一个薄服务器端层,该层实际上将与 SOAP 服务进行通信。要与 GWT 服务器端对话,您可以使用 DispatchAsyncRequestFactory

If you're trying to access SOAP service from another domain then you're probably limited by SOP. I'd suggest building a thin server-side layer that will actually talk to the SOAP service. To talk to your GWT server-side you can use, for example, DispatchAsync or RequestFactory.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文