web
You’re offline. This is a read only version of the page.
close
Skip to main content
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
    RE: Web Request error

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

  • BC questions Profile Picture
    5 on at
    RE: Web Request error

    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
    RE: Web Request error

    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
    RE: Web Request error

    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
    RE: Web Request error

    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
    RE: Web Request error

    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
    RE: Web Request error

    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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

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

#1
Sumit Singh Profile Picture

Sumit Singh 2,039

#2
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 1,863

#3
YUN ZHU Profile Picture

YUN ZHU 1,736 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans