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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Business Central forum

Calling Soap Services directly from al

(0) ShareShare
ReportReport
Posted on by 175

can i directly call soap services in AL code if possible please share some code for this to me Thanks in advance.

Categories:
I have the same question (0)
  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    There's a native codeunit called 1290 SOAP Web Service Request Mgt that exposes methods for calling SOAP ws. Many of them are however usable only on-premise.

    With pure AL, you can do something like:

    HttpContentWS.WriteFrom(ContentText);

    HttpContentWS.GetHeaders(HttpHeadersWS);

    HttpHeadersWS.Add('SOAPAction','tempuri.org/GetLoginInformation');

    HttpHeadersWS.Remove('Content-Type');

    HttpHeadersWS.Add('Content-Type','text/xml');

    // Invoke the web service

    HttpClientWS.Post(GetWebServiceAddress,HttpContentWS,HttpResponseMessageWS);

    where XMLRequestString is the SOAP message that you need to create.

    My suggestion: don't do all with pure AL, handling external web services (maybe with complex parameters or protocols like SOAP or particular authentication types) can be handled more efficiently by using Azure Functions that calls that WS.

  • SirDard Profile Picture
    175 on at

    you mean to say i should use soap via (for example .net) and made a web service ?

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    You can create an azure function that in turns calls your SOAP web service. On the Azure Function you can use C# (or any other supported languages) and call any web services you want, without technical limitations that there are in AL on some cases.

  • SirDard Profile Picture
    175 on at

    okay Thanks alot.

  • Community Member Profile Picture
    on at

    What kind of service do you need to call? There's quite a lot you can do with pure AL already. It may take some tinkering around, but I was able to integrate to the Azure Service Bus with pure AL. I wrote a short blog post about it you're interested: dynamics365bc.blogspot.com/.../connecting-business-central-to-azure.html

    Tero

  • SirDard Profile Picture
    175 on at

    Sir, basically i have just create a soap service for sales journal I want to call it from Al code to make sale journal i will pass customer number , doc type = payment , and amount and all its do for business central on premises

  • Community Member Profile Picture
    on at

    Did you create the soap service in Business Central and you want to call it from another instance of Business central? Is there a need to authenticate to the soap Service? Sounds like you might be able to just call post with HttpClient. See this for documentation:

    docs.microsoft.com/.../httpclient-data-type

    Tero

  • SirDard Profile Picture
    175 on at

    Yes it will be good if authenticate to the soap service but not compulsory . Can share with me code ? because I am new .

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

News and Announcements

Season of Giving Solutions is Here!

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 > Business Central

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans