[ https://issues.apache.org/jira/browse/OLINGO-1614?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Yufei updated OLINGO-1614: -------------------------- Attachment: getmetadat.txt > Get metadata of dynamics 365 is very slow, it's much slower than using > HttpRequest > ---------------------------------------------------------------------------------- > > Key: OLINGO-1614 > URL: https://issues.apache.org/jira/browse/OLINGO-1614 > Project: Olingo > Issue Type: Question > Components: odata2-core, odata4-client > Affects Versions: (Java) V4 4.10.0 > Environment: windows, java > Reporter: Yufei > Priority: Major > Attachments: getmetadat.txt > > > Hi > This is the code to get metadata. time used is 28 seconds. It's too slow. > It's around 10 seconds if I use HttepoRequest and XML parsing with > DocumentBuilder. > Is there anyway to make it faster? > I checked with 5.0.0 and 4.10.0, it's the same. > Thank you. > > ////////////////////////////////////////////////////////////////////////////// > private static void getMetadata2(String accessToken) > { > // Create an OData client > ODataClient client = ODataClientFactory.getClient(); > // Specify the OData service endpoint > String serviceRoot = > "https://orgc8a62a2c.api.crm.dynamics.com/api/data/v9.0/"; > String metadataEndpoint = serviceRoot; // + "$metadata"; > > EdmMetadataRequest request = > client.getRetrieveRequestFactory().getMetadataRequest(metadataEndpoint); > // request.setAccept("application/xml"); // Set the desired media type > request.addCustomHeader(HttpHeader.AUTHORIZATION, "Bearer " + > accessToken); // Add the access token > // Execute the request > long startTime = System.nanoTime(); > ODataRetrieveResponse<Edm> response = request.execute(); > long endTime = System.nanoTime(); > long elapsedTime = endTime - startTime; > // Convert elapsed time to seconds > double elapsedTimeInSeconds = (double) elapsedTime / 1e9; > > // Print the elapsed time in seconds > System.out.println("Time consumed for request.execute() : " + > elapsedTimeInSeconds + " seconds"); > > int code = response.getStatusCode(); > String ret = response.getStatusMessage(); > > Edm edm = response.getBody(); > } -- This message was sent by Atlassian Jira (v8.20.10#820010)