Java 与Sharepoint的集成

Java 与Sharepoint的集成,java,rest,sharepoint,Java,Rest,Sharepoint,我正在尝试使用java程序,使用基于rest的api连接到Sharepoint 2013。 我的密码是- DefaultHttpClient httpclient = new DefaultHttpClient(); List<String> authpref = new ArrayList<String>(); authpref.add(AuthPolicy.NTLM); // httpclient.getParams().setPara

我正在尝试使用java程序,使用基于rest的api连接到Sharepoint 2013。 我的密码是-

    DefaultHttpClient httpclient = new DefaultHttpClient();
    List<String> authpref = new ArrayList<String>();
    authpref.add(AuthPolicy.NTLM);
    // httpclient.getParams().setParameter(AuthPNames.CREDENTIAL_CHARSET,
    // authpref);
    NTCredentials creds = new NTCredentials(userName, password, "portal", "xyz.com");
    httpclient.getCredentialsProvider().setCredentials(AuthScope.ANY, creds);

    HttpHost target = new HttpHost("portal.xyz.com", 80);

    // Make sure the same context is used to execute logically related
    // requests
    HttpContext localContext = new BasicHttpContext();

    // Execute a cheap method first. This will trigger NTLM authentication
    HttpGet httpget = new HttpGet("http://portal.xyz.com/Sites/XYZteam/_api/web/GetFolderByServerRelativeUrl('/Sites/XYZteam/GlobalBrandBook')/Files");
    httpget.addHeader("Accept", "application/json;odata=verbose");
    httpget.addHeader("X-HTTP-Method", "GET");
    httpget.addHeader(HttpHeaders.USER_AGENT, "Mozilla/4.0+(compatible;+MSIE+5.01;+Windows+NT+5.0");
    HttpResponse response = httpclient.execute(target, httpget, localContext);
    HttpEntity entity = response.getEntity();
    System.out.println(EntityUtils.toString(entity));
我甚至尝试了基本的身份验证,但每次我都会收到403禁止的错误。即使调用Soap请求也会产生相同的错误

任何线索都会大有帮助

蒂娜