如标题所示,我们正在寻找一种访问Windows集成(NTLM)身份验证背后的.NET 3.5 Web服务的方法。

我们整个星期都在互联网和这个论坛中进行搜索,但尚未找到解决此问题的解决方案。

我们尝试了DefaultHttpConnections,HttpPost,HttpGet的不同变体等。

但是,我们尝试验证自己的身份,因此遇到了以下问题:

    SSLHandshakeException

或者
   Authentication scheme ntlm not supported
   Authentication error: Unable to respond to any of these challenges:
   ntlm=WWW-Authenticate: NTLM, negotiate=WWW-Authenticate: Negotiate

IIS身份验证设置如下:

我们试图访问的页面是默认站点的子文件夹中的.aspx,并且我们没有特权,将身份验证更改为默认站点也不安全。

我知道互联网上的许多其他人也有类似的问题。

而且,我们正在开发的应用程序不应使用网络 View 。

任何有关如何解决此问题的 build 性指针将受到高度赞赏。提前致谢。



更新:我们现在更改了服务,以执行基本身份验证和ntlm身份验证。

当我们将以下代码运行到localhost测试服务器时,我们得到正确的响应,localhost没有任何身份验证机制。响应如下:
<soap:Body>
<FooResponse xmlns="uri:FlexAPI">
<FooResult>
<typeFooBar>
<FooNumber>4545</FooNumber>
<BarNumber>1</BarNumber>
</typeFooBar>
</FooResult>
</FooResponse>
</soap:Body>

但是,当我们在经过身份验证的服务器上运行以下代码时,我们得到了这一点。

org.xmlpull.v1.XmlPullParserException:预期:
START_TAG {http://schemas.xmlsoap.org/soap/envelope/}信封
(在java.io.InputStreamReader@4054b398中的位置:START_TAG @ 2:44)
        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);



        request.addProperty("Foo", Bar.getText().toString());
        request.addProperty("Foo", Bar.getText().toString());
        request.addProperty("Foo", Bar() );
        request.addProperty("Foo", Bar.getText().toString());



        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);


        envelope.dotNet = true;
        envelope.setOutputSoapObject(request);

        envelope.encodingStyle = "utf-8";
        envelope.implicitTypes = false;

        String myUrlz= "http://" + myUrl.getText().toString() +"/Foo/Bar.asmx";



        HttpTransportBasicAuth auth = new HttpTransportBasicAuth(myUrlz, "Foo", "Bar");

        auth.debug = true;
try
{

auth.call(SOAP_ACTION, envelope); // Fails on this line.
System.out.println("Dump" + auth.responseDump);


// all the other stuff.....


}
catch (FooException Bar)
{

                // ¯\_(ツ)_/¯

}

因此,基本上,访问 protected 服务时,我们将收到html响应而不是xml。是的,除了身份验证部分外,localhost服务和Sharp服务完全相同。

最佳答案

简短的答案是“否”,Android上没有针对NTLM的现成方法。

长答案是,已经成功尝试使用Apache HttpClient将您自己的解决方案结合在一起。请参阅以下链接:

http://danhounshell.com/blog/android-using-ntlm-authentication-with-httpclient/
http://mrrask.wordpress.com/2009/08/21/android-authenticating-via-ntlm/

关于java - 有没有可靠的方法来处理来自Android应用程序的Windows集成(NTLM)身份验证?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7037105/

10-11 09:26
查看更多