Search code examples
visual-studiovisual-studio-2013wsdlssl-certificate

Client Certificates and Visual Studio WSDL


I have what may be a rather unusual issue where I am unable to consume a wsdl in visual studio 2013.

In order to view the url in IE/Chrome/Safari I have been required to install a .p12 and .crt secure certificates.

I have set IE not to prompt but in Safari I see the following prompt: enter image description here I guess that visual studio is also wishing to confirm the certificate but unable to prompt.

When attempting to add a service reference in Visual Studio 2013 I see the following error:

"An error occured (details) while attempting to find services at..."

The details are:

There was an error downloading 'https://xxx/xxx.svc/$metadata'.
The request was aborted: Could not create SSL/TLS secure channel.
Metadata contains a reference that cannot be resolved: 'https://xxx.wsdl'.
Could not establish secure channel for SSL/TLS with authority 'xxx.com'.
The request was aborted: Could not create SSL/TLS secure channel.
If the service is defined in the current solution, try building the solution and adding the service reference again.

Is there a work around?


Solution

  • The first step as Prashant says is to download the WSDL file. This is as simple as 'File > Save As' from the browser.

    The next step is to examine the downloaded WSDL and look at the xml for any 'xs:import' references. Follow each of the references and download the files to the same path as the WSDL.

    I found that the the WSDL referenced 2x .xsd files ahd the files then referenced other .xsd files. I ended up with a total of 6 files.

    For all the files (both wsdl and xsd) it is necessary to check the 'xs:import' to ensure the schemaLocation points to the local file path.

    add service reference

    Finally, if you add a service reference as perusal and enter the local path of the WSDL file.

    Sorry to answer my own question, but I wanted to document this for the rest of the team and also anyone else who may be stuck.

    local file path