从Android消费Sharepoint web服务时出错

从Android消费Sharepoint web服务时出错,android,web-services,sharepoint,ntlm,Android,Web Services,Sharepoint,Ntlm,我正在尝试使用以下代码从Android使用Sharepoint authentication.asmx webservice: String SOAPRequestXML = "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schem

我正在尝试使用以下代码从Android使用Sharepoint authentication.asmx webservice:

String SOAPRequestXML = "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
        + "   xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
        + "<soap:Body>"
        + "<Login xmlns=\"http://schemas.microsoft.com/sharepoint/soap/\">"
        + "<username>u</username>"
        + "<password>p</password>"
        + "</Login>"
        + "</soap:Body>" + "</soap:Envelope>";
 Log.i("request is ", SOAPRequestXML + "!!!"); 
se = new StringEntity(SOAPRequestXML, HTTP.UTF_8);
se.setContentType("text/xml; charset=utf-8");



HttpPost httppost = new HttpPost(url);
httppost.setEntity(se);
DefaultHttpClient httpclient = new DefaultHttpClient();
// register ntlm auth scheme
httpclient.getAuthSchemes().register("ntlm",
        new NTLMSchemeFactory());
httpclient.getCredentialsProvider()
        .setCredentials(
                // Limit the credentials only to the specified
                // domain and port
                new AuthScope("IPADD", -1),
                // Specify credentials, most of the time only
                // user/pass is needed
                new NTCredentials("myusername", "mypassword", "",
                        ""));

BasicHttpResponse httpResponse = (BasicHttpResponse) httpclient
        .execute(httppost);
HttpEntity resEntity = httpResponse.getEntity();

strResponse = EntityUtils.toString(resEntity);
String SOAPRequestXML=“”
+ ""
+ ""
+“u”
+“p”
+ ""
+ "" + "";
i(“请求是”,SOAPRequestXML+“!!!”);
se=新的StringEntity(SOAPRequestXML,HTTP.UTF_8);
setContentType(“text/xml;charset=utf-8”);
HttpPost HttpPost=新的HttpPost(url);
httppost.setEntity(se);
DefaultHttpClient httpclient=新的DefaultHttpClient();
//注册ntlm身份验证方案
httpclient.getAuthSchemes().register(“ntlm”,
新的NTLMSchemeFactory());
httpclient.getCredentialsProvider()
.setCredentials(
//仅将凭据限制到指定的值
//域和端口
新的AuthScope(“IPADD”,-1),
//仅在大多数情况下指定凭据
//需要用户/通行证
新的NTCredentials(“我的用户名”、“我的密码”和“”,
""));
BasicHttpResponse httpResponse=(BasicHttpResponse)httpclient
.执行(httppost);
HttpEntity当前状态=httpResponse.getEntity();
strResponse=EntityUtils.toString(最近性);
这里se是包含soap信封的StringEntity,但我得到以下响应:-

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <soap:Fault>
      <faultcode>soap:Server</faultcode>
      <faultstring>Server was unable to process request. ---&gt; Site is not configured for Claims Forms Authentication.</faultstring>
      <detail />
    </soap:Fault>
  </soap:Body>
</soap:Envelope>

soap:服务器
服务器无法处理请求。--未为索赔表单身份验证配置站点。

我建议您使用“获取未经授权的错误”