Blog

Visual Studio Web Reference without Web Service (or direct from WSDL file)

April 20, 2016

This may be documented elsewhere, but I had a hard time finding it so I’m going to write a quick blog entry about it for my reference.

I needed to build a Visual Studio 2013 project that had a connection to a Web Service. However the the code would only have access to the web service once deployed. In essence I needed to tell Visual Studio how to access the web service without actually having access to the web service.

The solution was actually quite simple, though not exactly intuitive. First get the WSDL file for the web service to be referenced. This usually involves appending the ?wsdl variable to the web service URI.

Example:

http://www.foo.com/foo.asmx?wsdl

In my case I used Internet Explorer from a computer that could access the web service (i.e. behind the firewall) and copied the WSDL content to a local file.

Once you have a local copy of the web service WSDL file; adding the Web Reference to Visual Studio is pretty straightforward.

  1. Add Web Reference
  2. In the URL box provided enter the path to the LOCAL WSDL file:
    file://C:\Path\To\Local\File\webservice.txt

This should load everything Visual Studio needs to know how to call the web service. This won’t really help you test the code, but it will let you get a clean build.

0 Comments

Leave Your Comment

Your email address will not be published. Required fields are marked *


about me

An information technology professional with twenty five years experience in systems administration, computer programming, requirements gathering, customer service, and technical support.