简体   繁体   English

具有NTLM身份验证的SOAP Web服务的Java客户端

[英]Java client for SOAP web service with NTLM authentication

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. 我花了很多天晚上才设法找到可以连接到使用Negotiate / NTLM身份验证的Microsoft Dynamics CRM的正确Java框架。 I tried all existing suggestions on Stackoverflow and other resources with JAX-WS, Axis2, CXF with various HTTP protocol handlers. 我使用各种HTTP协议处理程序,使用JAX-WS,Axis2,CXF尝试了关于Stackoverflow和其他资源的所有现有建议。 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. 当前最好的方法是Axis2 / commons-httpclient-3.1,在这里我可以使用NTLM摘要至少跟踪所有三个阶段,但是目标IIS仍拒绝使用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. Apache CXF —两者都具有内置的Java6 NTLM支持和jCIFS(有人建议作为补救措施)均不起作用,因为前者在第二个401响应上失败了(根据本应发送第三个请求,根据协议),而后者尝试从空的输入流中读取响应代码并失败。

So, the question is whether anybody has succeeded to master an NTLM-protected SOAP web service from the Java 6 platform? 因此,问题是,是否有人从Java 6平台成功掌握了受NTLM保护的SOAP Web服务?

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. 我希望其他人对此有所了解,因为我对该领域的知识已有多年历史,可能不是最好的建议-特别是,我只使用commons-httpclient 3,但没有一个新的软件包承诺NTLM / NTLMv2正确。

As you've probably noticed, commons-httpclient 3's NTLM authentication code supports only NTLM, not the newer NTLMv2 protocol. 您可能已经注意到,commons-httpclient 3的NTLM身份验证代码仅支持NTLM,而不支持较新的NTLMv2协议。 My solution to this problem was to use commons-httpclient 3 and replace the NTLM authentication code with an NTLMv2 capable solution. 我对这个问题的解决方案是使用commons-httpclient 3并将NTLM身份验证代码替换为支持NTLMv2的解决方案。 Fortunately, the NTLMv2 specification is published by Microsoft . 幸运的是,NTLMv2规范由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. 坦白说,实现起来并非难事,但当然,现在您必须维护自己,这由于多种原因可能是不希望的。

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. 提示是用Jespa + jCIFS替换标准的Java协议栈,并做一些小的补丁以使其与JAX-WS一起使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM