我正在尝试连接到 Azure 数据市场,它是一个 odata 存储库。我正在使用最新的 Olingo 库 r4.2.0。以下代码:
String serviceUrl = "https://api.datamarket.azure.com/DataGovUK/MetOfficeWeatherOpenData/v1/";
ODataClient client = ODataClientFactory.getClient();
ODataServiceDocumentRequest req = client.getRetrieveRequestFactory().getServiceDocumentRequest(serviceUrl);
req.setAccept("application/json;application/xml;odata.metadata=full");
req.setContentType("application/json;application/xml;odata.metadata=full");
ODataRetrieveResponse res = req.execute();
返回异常
org.apache.olingo.client.api.communication.ODataClientErrorException: null [HTTP/1.1 415 Unsupported Media Type]
服务器返回:
<?xml version="1.0" encoding="utf-8"?>
<m:error mlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<m:code />
<m:message xml:lang="en-US">
Unsupported media type requested.
</m:message>
</m:error>
有人试图用这个库或另一个用 Java 连接到 Azure 数据市场?