我有一個工作的騾子到我使用的C#服務端點。在Mule中使用Windows憑據的CXF端點ESB
服務託管在WCF/C#上 - mule使用由apache cxf(Wsdl2java)生成的一組類來爲該服務打開一個客戶端。 但是,直到現在我所用的所有服務都是基於服務的 - 這意味着沒有安全/憑證驗證。
現在 - 我想改變這一點。我想將c#服務的綁定設置爲WSHttpBinding。
有沒有一種方法可以使用NTLM Credentials來使用c#服務?
當前端點被定義爲:
<cxf:jaxws-client serviceClass="com.TimeLineListener.IBusListeningService"
operation="getMessage" />
<outbound-endpoint address="${TMSService.host}"
exchange-pattern="one-way" />
從阿帕奇CXF的文檔:
NTLM身份驗證
//Set the jcifs properties
jcifs.Config.setProperty("jcifs.smb.client.domain", "ben.com");
jcifs.Config.setProperty("jcifs.netbios.wins", "xxx.xxx.xxx.xxx");
jcifs.Config.setProperty("jcifs.smb.client.soTimeout", "300000"); //5
minutes
jcifs.Config.setProperty("jcifs.netbios.cachePolicy", "1200"); //20 minutes
//jcifs.Config.setProperty("jcifs.smb.client.username", "myNTLogin");
//jcifs.Config.setProperty("jcifs.smb.client.password", "secret");
//Register the jcifs URL handler to enable NTLM
jcifs.Config.registerSmbURLHandler();
Finally, you need to setup the CXF client to turn off chunking. The reason is that the NTLM authentication requires a 3 part handshake which breaks the streaming.
//Turn off chunking so that NTLM can occur
Client client = ClientProxy.getClient(port);
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(36000);
httpClientPolicy.setAllowChunking(false);
http.setClient(httpClientPolicy);
所以,我怎麼可以定義在XML的上述這些項目???我還沒有看到任何這樣的例子....
而addtionaly,即使我嘗試建立連接沒有安全(WSHttpBinding與安全=無) - 我仍然無法使其工作,因爲內容類型不匹配(假設是應用程序/ XML,它是文本/ XML或類似的東西)
我真的很喜歡某種例子,如何做到這一點。
謝謝(再次)!
你看過這篇文章嗎? http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-NTLMAuthentication – 2011-12-14 18:18:00
我看了一下,仍然沒有完全得到如何實現(修正了我的問題) – Menyh 2011-12-18 15:10:40