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!!!
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!!!
have Allow HttpClient Requests in extension. And it worked.
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;
André Arnaud de Cal... 291,462 Super User 2024 Season 2
Martin Dráb 230,551 Most Valuable Professional
nmaenpaa 101,156