Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 509
Gavin Avatar asked Mar 18 '15 13:03

Gavin


People also ask

How do I enable client certificates?

On the taskbar, click Start, and then click Control Panel. In Control Panel, click Programs and Features, and then click Turn Windows Features on or off. Expand Internet Information Services, then select Client Certificate Mapping Authentication, and then click OK.

What are client certificates used for?

Client certificates are, as the name indicates, used to identify a client or a user, authenticating the client to the server and establishing precisely who they are.


2 Answers

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

like image 80
Gavin Avatar answered Sep 28 '22 14:09

Gavin


You should get the .wsdl file and then use wsdl.exe to generate a proxy from it.

like image 23
Prashant Avatar answered Sep 28 '22 14:09

Prashant