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

Announcements

News and Announcements icon
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,172 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,172 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,172 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,172 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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,687 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,041 Super User 2026 Season 1

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 974 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans