In Olingo 2 I could do this:
Edm metadataEdm = EntityProvider.readMetadata(metadataInputStream, false); //metadataInputStream is java.io.InputStream
From what I have read in Olingo 4, you can do this:
ODataClient client = ODataClientFactory.getClient();
String serviceRoot = "http://services.odata.org/V4/Northwind/Northwind.svc";
EdmMetadataRequest request
= client.getRetrieveRequestFactory().getMetadataRequest(serviceRoot);
ODataRetrieveResponse<Edm> response = request.execute();
But in my project I can only use HTTPClient for any network calls - which means I can't use ODataClient client.
From HttpClient I can get the InputStream. Is there a way (as shown above for Olingo 2) to get the Edm object from InputStream in Olingo 4 ?
Yes there is a way to do this in Olingo 4 using the
ODataReader.It accepts input stream in methodEdm readMetadata(InputStream input);Your code above can be modified in the following way to achieve the same result.