0151 355 4555

.NET 1.0, 1.1 and 2.0 Web References

To add a reference to any of Data8's web services, first identify the URL for the service. This can be found in the service documentation section - the URL for each service is listed at the top of the first documentation page for each service. For example, the URL for the address validation service is http://webservices.data-8.co.uk/addresscapture.asmx and can be found on the documentation page for the address validation service.

Once you have the URL for the service you are interested in, in Visual Studio, expand the project node in Solution Explorer and right-click on References. Depending on the version of Visual Studio you are running you will see either "Add Web Reference" or "Add Service Reference". If you see "Add Web Reference", click that option. If you see "Add Service Reference", click that option, then click "Advanced...", then "Add Web Reference...". You will now see the "Add Web Reference" dialog.

Add Web Reference dialog

Paste in the URL for the service you identified from the service documentation earlier and click the "Go" button to the right of the URL text box. You will now be shown a screen showing a list of all the operations supported by the web services, and the "Web reference name" box will be enabled.

Add Web Reference dialog with URL entered

Enter a more useful name in the "Web reference name" text box. For example, when adding a reference to the AddressCapture service you might use the name "AddressCapture". Finally, click on "Add Reference" and a reference to the web service will be added to your project.

Web Reference in Solution Explorer

In order to call the web service, first include the appropriate namespace. This will be the default namespace of your project followed by the name you gave the web reference.

You can then create an instance of the web service and start calling methods on it as illustrated in the sample below.

Please refer to the service documentation for details on what methods are available for each service and how they should be used. Please note that the C# and VB.NET sample code within the service documentation is written for .NET 3.5 and therefore uses a slightly different naming convention for the service classes (they are suffixed with "SoapClient"). Other than that difference the samples within the documentation will work with .NET 1.0, 1.1 and 2.0 as well.

using YourProject.AddressCapture;

namespace YourProject
  public class YourClass
    public void Sample()
      AddressCapture.AddressCapture proxy = new AddressCapture.AddressCapture();
      AddressOutput result = proxy.GetFullAddressSimple(
        "CH2 4NE",