简体   繁体   English

Java 使用具有域身份验证的 SharePoint 2010 REST 服务

[英]Java Consume SharePoint 2010 REST Service with Domain Authentication

first of all I have the following components:首先,我有以下组件:

  • SharePoint 2010 Server (intranet -> accessable only by valid domain account) SharePoint 2010 Server(内联网 -> 只能通过有效的域帐户访问)
  • SharePoint Lists I need to read我需要阅读的 SharePoint 列表
  • Java Client Application consuming SharePoint REST service (not working!)使用 SharePoint REST 服务的 Java 客户端应用程序(不工作!)

I've searched for a while now and I can't find a working java version to consume a REST service from a SharePoint 2010 server with domain authentication.我已经搜索了一段时间,但我找不到一个可用的 Java 版本来使用来自具有域身份验证的 SharePoint 2010 服务器的 REST 服务。 I already tried Spring Framework for this issue which does not really help.我已经针对这个问题尝试了 Spring Framework,但这并没有真正的帮助。

I changed the example code (from https://spring.io/guides/gs/consuming-rest/ ) to following and it works fine:我将示例代码(从https://spring.io/guides/gs/sumption-rest/ )更改为以下代码,它工作正常:

RestTemplate restTemplate = new RestTemplate();
String s = restTemplate.getForObject("http://gturnquist-quoters.cfapps.io/api/random", String.class);
System.out.println(s);

But my URL looks completely different: " http://server/site/_vti_bin/listdata.svc/listName "但我的网址看起来完全不同:“ http://server/site/_vti_bin/listdata.svc/listName

When I try to make the same call with my URL I get the error message: org.springframework.web.client.HttpClientErrorException: 400 Bad Request当我尝试使用我的 URL 进行相同调用时,我收到错误消息:org.springframework.web.client.HttpClientErrorException: 400 Bad Request

So my first problem is to make the Spring Framework work with the SharePoint REST service.所以我的第一个问题是让 Spring Framework 与 SharePoint REST 服务一起工作。 Since I also tried plain Http-calls I assume that I will get an authentication problem in the next step since the SharePoint server is only accessable by people authenticated by the active directory (with valid kerberos ticket).由于我还尝试了普通的 Http 调用,因此我假设我在下一步中会遇到身份验证问题,因为 SharePoint 服务器只能由通过活动目录(使用有效的 kerberos 票证)进行身份验证的人员访问。

Can anyone help me to get this SharePoint REST <-> Java communication to work ?谁能帮我让这个 SharePoint REST <-> Java 通信工作?

You can take a look of this project I've created that communicates with the sharepoint rest API and has a working implementation of most common operations you'll need.您可以查看我创建的这个项目,该项目与 sharepoint rest API 进行通信,并具有您需要的最常见操作的工作实现。 Also you can extend it with your needs as you'll have a working code example您也可以根据需要扩展它,因为您将拥有一个有效的代码示例

https://github.com/kikovalle/PLGSharepointRestAPI-java https://github.com/kikovalle/PLGSharepointRestAPI-java

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

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