从 GWT 客户端调用 SOAP Web 服务
我没有任何使用 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 文件位于现有域中,
已提供 。我也有这个:
它有什么帮助我要连接到 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,
is already provided. And I also have this:
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您尝试从另一个域访问
SOAP
服务,那么您可能会受到SOP
的限制。我建议构建一个薄服务器端层,该层实际上将与 SOAP 服务进行通信。要与 GWT 服务器端对话,您可以使用 DispatchAsync 或 RequestFactory。If you're trying to access
SOAP
service from another domain then you're probably limited bySOP
. I'd suggest building a thin server-side layer that will actually talk to theSOAP
service. To talk to your GWT server-side you can use, for example, DispatchAsync or RequestFactory.