How can I use https web service with C#

omerfarukomerfaruk Member Posts: 16
Hi, we tried to connect NAV web service via https on c# with no success so far. Could someone lead me to a working example ?

What we need is editing data on NAV via https web service on a web page ( using c#)


Ths is what we have :

_binding = new BasicHttpBinding();
_binding.Security.Mode = BasicHttpSecurityMode.TransportWithMessageCredential;
_binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.Certificate;
_binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;
EndpointAddress _endpoint = new EndpointAddress(new Uri("https://192.168.1.19:8047/TEST/WS/TEST/Codeunit/Web_Fonksiyonlari"));
recws2 = new WS_WEBPAGE2.Web_Fonksiyonlari_PortClient(_binding, _endpoint);
recws2.ClientCredentials.UserName.UserName = xxx@st.com";
recws2.ClientCredentials.UserName.Password = "xxxxxx";
recws2.ClientCredentials.ClientCertificate.SetCertificate(StoreLocation.LocalMachine, StoreName.My,
X509FindType.FindByThumbprint, "852F6AF8CC8F64EB4DD7C9EF26FDD866275B32C4");
recws2.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode =
System.ServiceModel.Security.X509CertificateValidationMode.PeerOrChainTrust;
recws2.EF_Post_NAV();

Answers

Sign In or Register to comment.