Hi EveryOne am trying to Send Request in Json and get the response from Navision, Am New to Dot.Net Variables.
Below is Code i have Tried So Far
HttpwebreqHan := HttpwebreqHan.WebRequestHandler();
HttpwebreqHan.ClientCertificateOptions(HttpClientCerOpt.Manual);
X509Store := X509Store.X509Store(X509StoreName.My,X509StoreLocation.CurrentUser);
X509Store.Open(X509OpenFlags.ReadOnly);
X509Store := X509Store.Certificates.Find(X509StoreType.FindBySubjectName,'J5UKSH8F',TRUE);
HttpwebreqHan.ClientCertificates();
HttpClient := HttpClient.HttpClient(HttpwebreqHan);
BaseUrl := 'vsdc.staging.vms.frcs.org.fj/.../Sign'; // Added
INvc := '0010001335';
StringContent := StringContent.StringContent(GetJsonInvoice_StructureString(INvc,sas),Encoding.UTF8,'application/json');
HttpClient.BaseAddress := Uri.Uri(BaseUrl);
HttpResponseMessage := HttpClient.PostAsync('POST',StringContent).Result; // Error Coming At this Point
IF HttpResponseMessage.IsSuccessStatusCode THEN
result := HttpResponseMessage.Content.ReadAsStringAsync.Result;
The Error Is Saying like Below
A call to System.Threading.Tasks.Task`1[System.Net.Http.HttpResponseMessage].Result failed with this message: The remote certificate is invalid according to the validation procedure.
---------------------------
OK
---------------------------
*This post is locked for comments
Dear Raja,
I try to consume a SOAP-Webservice from NAV2017 with client-certificate and want to use a code like yours. But I can't find a DotNet-variable for X509store in NAV. Please can you tell me what variables (DotNet with complete Assemply ...) you used? If I have success I will tell you, so maybe you will be able to solve your problem (even it is about 18 month old). Tnx.
Best regards, Wolfram
Hi Alexander,
Thanks for reply . Its like Hierarchy of Certificates i have added it in Trusted Certificate Root. what i think is its Not loaded in HttpClient Variable with which it has to send request.. Its a Bad Request. Do you got anything related to this like code that might be very useful.
Please check first the following failure options:
your current certificate is self-signed and not added as a trusted certificate
certificate is expired
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156