trigger OnAction()
var
httpcontentws: HttpContent;
httpheadersws: HttpHeaders;
httpclientws: HttpClient;
HttpResponseMessageWS: HttpResponseMessage;
HttpRequestMessageWS: HttpRequestMessage;
base64convert: Codeunit "Base64 Convert";
Instream: InStream;
Response: text;
result: Boolean;
MyHttpClient: HttpClient;
RequestMessage: HttpRequestMessage;
ResponseMessage: HttpResponseMessage;
Headers: HttpHeaders;
Content: HttpContent;
XMLRequest: text;
XML_text: text;
URL: text;
XmlDoc: XmlDocument;
begin
MyHttpClient.DefaultRequestHeaders.Add('Authorization', 'Basic YXp6dXJlOjVubkdzbDhBd1NMYmh2N29ubGc5S0dsSlEyUWdueCt3WWs0UGQrNEFvTFU9');
MyHttpClient.DefaultRequestHeaders.Add('Accept', 'text/html, application/xhtml+xml');
Content.Clear();
Content.WriteFrom('<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:com="urn:microsoft-dynamics-schemas/codeunit/CompanySyncWS"><soapenv:Header/><soapenv:Body><com:TestFunction><com:pValue>RC000001</com:pValue></com:TestFunction></soapenv:Body></soapenv:Envelope>');
Headers.Clear();
RequestMessage.SetRequestUri('https://api.businesscentral.dynamics.com/v2.0/efd8ddfb-b094-4938-9b36-c77112f290af/LiveCopy/WS/IMechE%20Services/Codeunit/CompanySyncWS');
RequestMessage.Method('POST');
Content.GetHeaders(Headers);
Headers.Remove('Content-Type');
Headers.TryAddWithoutValidation('Content-Type', 'text/xml; charset=utf-8');
Headers.TryAddWithoutValidation('SOAPAction', 'urn:microsoft-dynamics-schemas/codeunit/CompanySyncWS:TestFunction');
Content.GetHeaders(Headers);
MyHttpClient.Post('https://api.businesscentral.dynamics.com/v2.0/efd8ddfb-b094-4938-9b36-c77112f290af/LiveCopy/WS/IMechE%20Services/Codeunit/CompanySyncWS', Content, ResponseMessage);
ResponseMessage.Content.ReadAs(Response);
Message(Response);
end;