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...
Suggested Answer

Getting data from a Dynamics Nav web service

(1) ShareShare
ReportReport
Posted on by 77
Hi,
Is there any way to connect to Dynamics NAV 2018 Odata V4 web service with Business Central Saas?
I am trying to get the data from a web service, this is the code I use:
var
    Client: HttpClient;
    Request: HttpRequestMessage;
    Response: HttpResponseMessage;
    Content: HttpContent;
    JsonResponse: Text;
    JsonObject: JsonObject;
    RecordJson: JsonObject;
    ServiceUrl: Text;
    Username: Text;
    Password: Text;
    companyinfo: Record "Company Information";
begin
    companyinfo.FindSet();
    ServiceUrl := 'http://192.168.1.1:7049/DynamicsTest/ODataV4/Company(' + companyinfo.companyserviceweb + ')/customers';
    Username := 'SERVER\SYSTEMTEST';
    Password := '123456';
    Client.DefaultRequestHeaders.Clear();
    Client.DefaultRequestHeaders.Add('Authorization', 'Basic' + Base64Encode(Username + ':' + Password));
    Request.SetRequestUri(ServiceUrl);
    Request.Method := 'GET';
    if Client.Send(Request, Response) then begin
        Content := Response.Content();
        Content.ReadAs(JsonResponse);
        JsonObject.ReadFrom(JsonResponse);
        Message(JsonResponse);
    end else begin
        Error('Error: ' + Format(Response.HttpStatusCode));
    end;
end;
 
If I connect from the browser it asks for the credentials and I add them, it allows me to access the web service, but I can't get the information from the web service.

     
I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    95,729 Super User 2025 Season 2 on at
    This is a local IP address, http://192.168.1.1.
    BC cannot access the local PC, including local folders, etc.
    If you make it public on the public Internet, BC should be able to access it. I think this is the problem.
     
    Hopefully other experts can give you better advice.
     
    Thanks.
    ZHU
  • Gerardo Rentería García Profile Picture
    25,236 Most Valuable Professional on at
    Hi
    I agree with what our colleague mentioned.
    Here some useful information. 
    BR
    GR

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,135

#2
YUN ZHU Profile Picture

YUN ZHU 733 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 612

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans