Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Business Central forum

Https Web Service Connection

(0) ShareShare
ReportReport
Posted on by

Hello Every One,

I want to connect to a HTTPS web service from AL Code ,here is the AL code

HttpRequestMessage.Method('POST');
HttpRequestMessage.GetHeaders(HttpHeaders);
HttpHeaders.Add('Method', 'POST');

AuthText := StrSubstNo('%1:%2','Username','Password');
TempBlob.WriteAsText(AuthText,TextEncoding::Windows);
HttpHeaders.Add('Authorization',StrSubstNo('BASIC %1',TempBlob.ToBase64String()));

// OutputContentText := GlobalRequestText;
HttpContent.WriteFrom(OutputContentText);
HttpContent.GetHeaders(HttpHeadersContent);
HttpHeadersContent.Remove('Content-Type');
HttpHeadersContent.Add('Content-Type', 'application/soap+xml;charset=UTF-8;action="'+WSAction+'"');

HttpRequestMessage.Content(HttpContent);

HttpClient.SetBaseAddress(Url);
//HttpClient.
//_HttpClient.AddCertificate();
HttpClient.AddCertificate('');
MESSAGE(OutputContentText);
if HttpClient.Post('https://SomeServerName/SomeService.svc',HttpContent,HttpResponse) then 
//if HttpClient.Send(HttpRequestMessage, HttpResponse) then
MESSAGE('GenerateLabelFromASN - Request Succefully Sent...')
else
Message('TO BADDDD....');
I get an  ERROR(an ERROR Occured) while sending request.
My questions is ,
1- is it supported the https connection in Dynamics 365 AL
2- how can i add certificate to HttpClient Object.
3- do i need to HOST the SSL certificate in Azure or somewhere.
4- How to Ignore SSL certificate from the request,if can not add a certificate.
Thanks
Categories:
  • Rishikesh Tiwari Profile Picture
    130 on at
    RE: Https Web Service Connection

    Have you got any solution to this problem ?

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

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans