web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Web Request error

(0) ShareShare
ReportReport
Posted on by 5

We have updated customer version from dynamics 2017 to dynamics bc and the servers are the same so the security permissions remains the same.

I' m having difficulties on a webrequest because on bc it took to long and gives timeout error, on dynamics 2017 that does not happen, its immediate.

Any idea why? I as looking ate codeunit 1299 Web Request Helper and the error occurs here HttpWebResponse := HttpWebRequest.GetResponse; on GetWebResponse function.

Thank you

I have the same question (0)
  • Verified answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    Is the request sent correctly? What about authentication? Causes could be a lot.

  • BC questions Profile Picture
    5 on at

    Thank you for the answer...

    The code is exactly the same on both version, the behavior should not be the same?

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    If code is the same yes, also response should be the same. It's quite difficult to know the reason without seeing the code of the call.

  • BC questions Profile Picture
    5 on at

    Here it is...

    HttpWebRequestMgt.Initialize(STRSUBSTNO('apiservices.gtglobal.eu/.../access_token'));

    HttpWebRequestMgt.SetMethod('POST');

    HttpWebRequestMgt.AddBodyAsText(

    STRSUBSTNO('grant_type=password&username=*****&password=*****'));//hided on purpose to post the code here

    ltempBlob.INIT;

    ltempBlob.Blob.CREATEINSTREAM(lResponseInStrem);

    HttpWebResponse := HttpWebResponse.HttpWebResponse;

    StatusCode := HttpWebResponse.StatusCode;

    lResponseHeaders := HttpWebResponse.Headers;

    HttpWebRequestMgt.GetResponse(lResponseInStrem,StatusCode,lResponseHeaders);

    lResponseInStrem.READTEXT(ltxt);

    lTokenAccess := COPYSTR(ltxt,18);

    lTokenAccess := COPYSTR(lTokenAccess, 1, STRPOS(lTokenAccess, '"')-1);

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    THis same code works in NAV 2017? Is this the same physical server? Can you reach the URL you're calling?

    A timeout error is normally due to unreachable endpoint or firewall problems.

  • BC questions Profile Picture
    5 on at

    The answer is yess to all your questions that's why I don't understand why its tooks too long on BC

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    You can also try to check NavHttpClientMaxTimeout parameter on the service tier.

    docs.microsoft.com/.../configure-server-instance

    If nothing change, I think you need a debug on both side (you and the final endpoint)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,785

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,007 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 948 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans