使用Java中的WCF WsHttpBinding web服务

时间:2022-02-15 09:49:43

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 web服务进行通信。但我做不到。通话要么挂起,要么我得到“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?

建议吗?想法吗?WsHttpBinding是否只被JAX-WS 2.0部分支持?

2 个解决方案

#1


14  

Your problem is that JAX-WS doesn't support the same WS protocols that are used in the wsHttpBinding. You need to use WSIT instead. WSIT is available as part of the Metro library, which is also available on Glassfish.

您的问题是JAX-WS不支持wsHttpBinding中使用的相同的WS协议。你需要用WSIT来代替。WSIT是地铁图书馆的一部分,也可以在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,但是您仍然可以使用basicHttpBinding在SSL/Transport Auth上执行相当安全的服务。

#2


0  

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配置并删除所有authenitcation、authoraization等属性。请记住,在使用安全传输/绑定时,WCF将安全地公开您的服务。因此,除非您配置您的Java客户机以满足这些安全需求,否则它很可能无法进行身份验证,并且您不会看到两者之间的相反情况。

Once you have the two talking, gradually work through adding each security element until you have your Java client cofigured correctly.

一旦您有了这两个对话,逐步添加每个安全元素,直到Java客户机正确编码。

#1


14  

Your problem is that JAX-WS doesn't support the same WS protocols that are used in the wsHttpBinding. You need to use WSIT instead. WSIT is available as part of the Metro library, which is also available on Glassfish.

您的问题是JAX-WS不支持wsHttpBinding中使用的相同的WS协议。你需要用WSIT来代替。WSIT是地铁图书馆的一部分,也可以在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,但是您仍然可以使用basicHttpBinding在SSL/Transport Auth上执行相当安全的服务。

#2


0  

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配置并删除所有authenitcation、authoraization等属性。请记住,在使用安全传输/绑定时,WCF将安全地公开您的服务。因此,除非您配置您的Java客户机以满足这些安全需求,否则它很可能无法进行身份验证,并且您不会看到两者之间的相反情况。

Once you have the two talking, gradually work through adding each security element until you have your Java client cofigured correctly.

一旦您有了这两个对话,逐步添加每个安全元素,直到Java客户机正确编码。