在 Java 中使用 WCF WsHttpBinding WebService
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1139285/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Consuming a WCF WsHttpBinding WebService in Java
提问by vicsz
I'm trying to get a Java Client to communicate with a WCF wshttpbinding WebService. But I am unable to do so. The call either hangs, or I get "musunderstoodheader expcetions".
我正在尝试让 Java 客户端与 WCF wshttpbinding WebService 进行通信。但我无法这样做。电话要么挂了,要么我得到“musunderstoodheader expcetions”。
My Web Service is just the default Visual Studio generated "WCF Service Library Template".
我的 Web 服务只是 Visual Studio 生成的默认“WCF 服务库模板”。
My Web Service Client is just a blank IntelliJ project, with the corresponding stub generated using "Add Web Service Client" (the webservice platform specified is JAX-WS 2.X).
我的 Web 服务客户端只是一个空白的 IntelliJ 项目,使用“添加 Web 服务客户端”生成相应的存根(指定的 Web 服务平台是 JAX-WS 2.X)。
When I change my binding to BasicHttpBinding everything works flawlessly.
当我将绑定更改为 BasicHttpBinding 时,一切正常。
I've tried playing with the WsHttpBinding configuration, including turning off security, but I've had no success.
我试过使用 WsHttpBinding 配置,包括关闭安全性,但我没有成功。
Suggestions ? Thoughts ? Is the WsHttpBinding only partially supported by JAX-WS 2.0?
建议?想法?JAX-WS 2.0 是否仅部分支持 WsHttpBinding?
回答by Randolpho
Your problem is that JAX-WSdoesn't support the same WS protocols that are used in the wsHttpBinding. You need to use WSITinstead. WSIT is available as part of the Metrolibrary, which is also available on Glassfish.
您的问题是JAX-WS不支持 wsHttpBinding 中使用的相同 WS 协议。您需要改用WSIT。WSIT 可作为Metro库的一部分使用,也可在Glassfish 上使用。
I recommend using wsHttpBinding or ws2007HttpBinding where possible, but you can still do a fairly secure service with basicHttpBinding over SSL/Transport Auth.
我建议在可能的情况下使用 wsHttpBinding 或 ws2007HttpBinding,但您仍然可以通过 SSL/Transport Auth 使用 basicHttpBinding 提供相当安全的服务。
回答by vicsz
I would carefully examine your WCF config and remove all authenitcation, authoraization etc., properties. Remember, by default, WCF will expose your service securely when using a secure transport/binding. Therefore, unless you configure your Java client to honor those security demands, it will most likely fail to authenticate and you won't see the two converse.
我会仔细检查您的 WCF 配置并删除所有身份验证、授权等属性。请记住,默认情况下,WCF 将在使用安全传输/绑定时安全地公开您的服务。因此,除非您将 Java 客户端配置为满足这些安全要求,否则它很可能无法通过身份验证,并且您将看不到两者的对立。
Once you have the two talking, gradually work through adding each security element until you have your Java client cofigured correctly.
双方交谈后,逐步添加每个安全元素,直到正确配置 Java 客户端。

