How can I use https web service with C#

omerfaruk
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();
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();
0
Answers
-
-
Lars_Westman wrote: »Have you setup the NAV Server to use SSL?
Yes , I can run the webservice link ( https://... ) on a browser and could see the structure of it.0 -
How you consuming the NAV web service in C# code?
I suggest, you should consume web service via web reference.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions