0

I have been given a wsdl and xsd file from a company partner to access their https service. I have installed the client certificate and can access their API using SoapUI after configuring the security in soapUI.

what are the next steps to consume the API in a .net application?

I have generated the proxy using svcutil. I have added the certificate to the local machine and current user - trusted root certification authorities The cert is from the service provider and works through soapUI. its not self signed.

When i make the call to the service i get Could not establish secure channel for SSL/TLS with authority 'WEB_SERVICE_URL:11851'.

Do i need to configure https in the config file or what am i missing?

thank you

user2329438
  • 295
  • 3
  • 6
  • 17
  • 1
    If it's not already, your URL should be "https:/ /WEB_SERVICE_URL:11851 ... plus, you should have a class/method following your Port, something like: https:/ /WEB_SERVICE_URL:11851/WebServiceName/Method While the xsd will help you craft the xml you'll send, you should get a bit of sample data from this company and try that out. – Brian Nov 28 '13 at 12:17
  • It turned out i had to specify the certificate in code – user2329438 Nov 28 '13 at 13:20

1 Answers1

0

It turned out i had to specify the certificate in code

       // Create the binding.

        BasicHttpBinding customerBinding = new BasicHttpBinding();
        customerBinding.Security.Mode = BasicHttpSecurityMode.Transport;
        customerBinding.Security.Transport.ClientCredentialType =
           HttpClientCredentialType.Certificate;

        // Create the endpoint address. Note that the machine name 
        // must match the subject or DNS field of the X.509 certificate
        // used to authenticate the service. 
        EndpointAddress customerEa = new               
          EndpointAddress("https:URL_OF_SERVICE:11851/WebServices/GetCustomerDetailsService");

        // Create the client.             
        customerClient = new GetCustomerDetails1Client(customerBinding, customerEa);

        // The client must specify a certificate trusted by the server.
           customerClient.ClientCredentials.ClientCertificate.SetCertificate(
            StoreLocation.CurrentUser,
            StoreName.My,
            X509FindType.FindBySubjectName,
            "CERTIFICATE_NAME");
user2329438
  • 295
  • 3
  • 6
  • 17