You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@olingo.apache.org by Pablo Leira <pl...@denodo.com> on 2016/06/15 07:55:34 UTC
Hi,
I am developing an OData client using Olingo 4.2.0. I am trying to read a
entity with hasStream=true. With this code:
String service_root ="
http://services.odata.org/V4/OData/(S(h3pggazgkuei3wtiwn3aeclv))/OData.svc";
final URI uri2 = client.newURIBuilder(service_root).
appendEntitySetSegment("Advertisements").
appendKeySegment(UUID.fromString("f89dee73-af9f-4cd4-b330-db93c25ff3c7")).build();
final ODataMediaRequest streamReq =
client.getRetrieveRequestFactory().getMediaEntityRequest(uri2);
if (StringUtils.isNotBlank(product.getMediaContentType()))
{
streamReq.setFormat(ContentType.parse(product.getMediaContentType()));
}
final ODataRetrieveResponse<InputStream> streamRes =
streamReq.execute();
And I am obtaining this exception executing the ODataMediaRequest:
(415) Unsupported Media Type [HTTP/1.1 415 Unsupported Media Type]
org.apache.olingo.client.api.communication.ODataClientErrorException: (415)
Unsupported Media Type [HTTP/1.1 415 Unsupported Media Type]
at
org.apache.olingo.client.core.communication.header.ODataErrorResponseChecker.checkResponse(ODataErrorResponseChecker.java:75)
at
org.apache.olingo.client.core.communication.request.AbstractRequest.checkResponse(AbstractRequest.java:54)
at
org.apache.olingo.client.core.communication.request.AbstractODataRequest.doExecute(AbstractODataRequest.java:308)
at
org.apache.olingo.client.core.communication.request.retrieve.ODataMediaRequestImpl.execute(ODataMediaRequestImpl.java:58)
at
org.apache.olingo.client.core.communication.request.retrieve.ODataMediaRequestImpl.execute(ODataMediaRequestImpl.java:36)
Is there any wrong in the code?
Thanks in advance