具有 NTLM 身份验证的 SOAP Web 服务的 Java 客户端
我花了很多日日夜夜试图找到一个合适的 Java 框架,可以连接到使用 Negotiate/NTLM 身份验证的 Microsoft Dynamics CRM。我使用 JAX-WS、Axis2、CXF 和各种 HTTP 协议处理程序尝试了 Stackoverflow 和其他资源上的所有现有建议。他们中没有一个人按预期工作。目前最好的方法是 Axis2/commons-httpclient-3.1,我可以使用 NTLM 摘要跟踪至少所有三个阶段,但是目标 IIS 仍然拒绝使用 401 Unauthorized 进行身份验证。 Apache CXF - 都具有内置的 Java6 NTLM 支持和 jCIFS,有些人建议将其作为补救措施,但也不起作用,因为前者在第二个 401 响应上失败(而根据说法,它应该发送第三个请求)协议),后一种尝试从空输入流读取响应代码并失败。
那么,问题是是否有人成功地从 Java 6 平台掌握了受 NTLM 保护的 SOAP Web 服务?
I spent many days and nights trying to find a proper Java framework that could connect to Microsoft Dynamics CRM which uses Negotiate/NTLM authentication. I tried all existing suggestions on Stackoverflow and other resources with JAX-WS, Axis2, CXF with various HTTP protocol handlers. No one of them worked as expected. The best approach currently is Axis2/commons-httpclient-3.1, where I can trace at least all three phases with NTLM digest, however the target IIS still refuses the authentication with 401 Unauthorized. Apache CXF — both with a built-in Java6 NTLM support and jCIFS, which some people suggested as a remedy, didn't work either as the former fails on the second 401 response (while it should have been send the third request, according to the protocol) and the latter one attempts to read the response code from an empty input stream and fails.
So, the question is whether anybody has succeeded to master an NTLM-protected SOAP web service from the Java 6 platform?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我希望其他人能插话,因为我对这个领域的了解已经有好几年了,也许不是最好的建议——特别是,我只使用过 commons-httpclient 3,而没有任何新的软件包承诺这样做NTLM/NTLMv2 正确。
您可能已经注意到,commons-httpclient 3 的 NTLM 身份验证代码仅支持 NTLM,而不支持较新的 NTLMv2 协议。我对此问题的解决方案是使用 commons-httpclient 3 并用支持 NTLMv2 的解决方案替换 NTLM 身份验证代码。幸运的是,NTLMv2 规范是由 Microsoft 发布 。老实说,实施起来并不困难,但当然,现在你必须自己维护它,由于多种原因,这可能是不可取的。
I was hoping somebody else would chime in, as my knowledge of this area is several years old now and perhaps not the best advice - in particular, I've only worked with commons-httpclient 3 and none of the newer packages that promise to do NTLM/NTLMv2 correctly.
As you've probably noticed, commons-httpclient 3's NTLM authentication code supports only NTLM, not the newer NTLMv2 protocol. My solution to this problem was to use commons-httpclient 3 and replace the NTLM authentication code with an NTLMv2 capable solution. Fortunately, the NTLMv2 specification is published by Microsoft. It's honestly not terrible difficult to implement but of course it's now something you have to maintain yourself which may not be desirable for a number of reasons.
我忘了说我自己确实找到了解决方案。线索是用 Jespa+jCIFS 并制作一些小补丁以使其与 JAX-WS 一起使用。
I forgot so say that I did find a solution myself. The clue is to replace the standard Java protocol stack with Jespa+jCIFS and make some minor patch to work it with JAX-WS.