Project Online を使用して、MS Project Server 2013 で SharePoint 2013 をホストしています。Restful Jersey クライアントからhttps://my_company.sharepoint.com/sites/pwa/_api/ProjectData/Projectsにアクセスしようとすると、適切な資格情報を提供した後、私はステータス タイプ 403 の応答を取得します。応答のテキスト本文に対応する文字列は、次の xml です。
<?xml version="1.0" encoding="UTF-8"?>
<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<m:code>-2147024891, System.UnauthorizedAccessException</m:code>
<m:message xml:lang="en-US">Access denied. You do not have permission to perform this action or access this resource.</m:message>
</m:error>
Rest API を認証してアクセスするために使用しているコードは次のとおりです。
String url = "https://myCompany.sharepoint.com/sites/pwa/_api/ProjectData/Projects";
try {
Client client = Client.create();
client.addFilter(new HTTPBasicAuthFilter(username, pass));
WebResource webResource = client.resource(url);
ClientResponse response = (ClientResponse)webResource.type(MediaType.APPLICATION_ATOM_XML).get(ClientResponse.class);
InputStream inputStream = response.getEntityInputStream();
try {
String output = IOUtils.toString(inputStream);
System.out.println("output: "+output);
} catch(IOException e) {
e.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
この問題は、Project Online が使用する https プロトコルに何らかの形で関連していると思いますが、よくわかりません。どんな助けでも大歓迎です。