Skip to main content

Notifications

Announcements

No record found.

Business Central forum

Microsoft.Dynamics.Nav.Runtime.NavHttpContent Variable not initialized

(0) ShareShare
ReportReport
Posted on by 405

Hi everyone,

I am deploying extension in D365BC (Cloud Version)

I am getting error :

“Microsoft.Dynamics.Nav.Runtime.NavHttpContent Variable not initialized”

even though Http Content is initialized.

Thanks!!!

Categories:
  • Verified answer
    Manish Ratan Profile Picture
    Manish Ratan 405 on at
    RE: Microsoft.Dynamics.Nav.Runtime.NavHttpContent Variable not initialized

    have Allow HttpClient Requests in extension. And it worked.

  • Manish Ratan Profile Picture
    Manish Ratan 405 on at
    RE: Microsoft.Dynamics.Nav.Runtime.NavHttpContent Variable not initialized

    more info:

    Have created an extension in which i have used "HttpClient" to consume a DotNet webservice. Below are the code:

    procedure GetWeb(Parameter1: Code[20];Parameter2:Code[20]);

    var

    HttpClient: HttpClient;

    HttpResponse: HttpResponseMessage;

    ResponseText: Text;

    URL: Text;

    HttpRequest: HttpRequestMessage;

    SubFolder: Text[100];

    OrderNo: Code[20];

    HttpsContent: HttpContent;

    HttpsHeader: HttpHeaders;

    ReturnValue: ARRAY[20] OF Text[1000];

    jObj: JsonObject;

    json: Text;

    SalesnRec: Record "Sales & Receivables Setup";

    begin

    SalesnRec.Get();

    clear(json);

    json := '';

    HttpsContent.WriteFrom(json);

    HttpsContent.GetHeaders(RequestHeader);

    URL := StrSubstNo(SalesnRec."API URL" + Parameter1 + '/' + Parameter2);

    HttpClient.DefaultRequestHeaders.Add('WebsiteGuid', SalesnRec."Website-GUID");

    IF HttpClient.Post(URL, HttpsContent, HttpResponse) THEN BEGIN

    HttpResponse.Content.ReadAs(ResponseText);

    Message(ResponseText);

    END;

    end;

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,462 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,551 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans