Uploaded image for project: 'Olingo'
  1. Olingo
  2. OLINGO-1614

Get metadata of dynamics 365 is very slow, it's much slower than using HttpRequest

    XMLWordPrintableJSON

Details

    • Question
    • Status: Open
    • Major
    • Resolution: Unresolved
    • (Java) V4 4.10.0
    • None
    • odata2-core, odata4-client
    • None
    • windows, java

    Description

      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.

      It seems it does not show nice here, Please check the attached file.

      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(); }

      Attachments

        1. getmetadat.txt
          1 kB
          Yufei

        Activity

          People

            Unassigned Unassigned
            yufeihe Yufei
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: