简体   繁体   English

Weblogic上的CXF客户端NTLM身份验证

[英]CXF client NTLM authentication on weblogic

I am developing a sharepoint web service client with Apache CXF and I am having a lot of problems with the NTLM authentication when the client runs on the weblogic server. 我正在使用Apache CXF开发一个sharepoint Web服务客户端,并且当客户端在weblogic服务器上运行时,NTLM身份验证存在很多问题。

If I run a simple test on Eclipse, the code works perfectly, but If I run the same code on a web application deployed on weblogic 10.3.6, the NTLM authentication fails and sends the following error: 如果我在Eclipse上运行简单的测试,则代码可以正常工作,但是,如果我在weblogic 10.3.6上部署的Web应用程序上运行相同的代码,则NTLM身份验证将失败并发送以下错误:

org.apache.cxf.transport.http.HTTPException: HTTP response '401: Unauthorized' when communicating with http://win-server-2008/sitios /sitio_registro/_vti_bin/Lists.asmx

I don't know what could be the difference between running the same code on a test and on a web application deployed on weblogic. 我不知道在测试和在weblogic上部署的Web应用程序上运行相同代码之间可能有什么区别。 Any idea? 任何想法?

The authentication code snipet is: 身份验证代码片段为:

Client client = ClientProxy.getClient(listsSoap);
HTTPConduit http = (HTTPConduit) client.getConduit();
        if (http instanceof AsyncHTTPConduit) {
            AsyncHTTPConduit conduit = (AsyncHTTPConduit) http;
            DefaultHttpAsyncClient defaultHttpAsyncClient;
            try {
                defaultHttpAsyncClient = conduit.getHttpAsyncClient();
            } catch (IOException exception) {
                throw new RuntimeException(exception);
            }

            Credentials credentials = new NTCredentials( conexionSharepointConfigVO.getUser(), conexionSharepointConfigVO.getPwd(), "", "" );

            defaultHttpAsyncClient.getCredentialsProvider().setCredentials( AuthScope.ANY,credentials);

            ((BindingProvider) listsSoap).getRequestContext().put(Credentials.class.getName(), credentials);
        }

UPDATE: I tested the same code in Tomcat 6.0.43 and it works ok. 更新:我在Tomcat 6.0.43中测试了相同的代码,并且工作正常。

您可以创建Windows服务以将该服务设置为在所需帐户下运行,也可以在打开命令提示符时使用“以其他用户身份运行”选项,以便WebLogic以所需用户的身份从命令行启动。

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

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