Consume asmx API web service c#

Possibly save 4 hours of your time: There are projects where you will be consuming external data source through an API they provide. The API could be .asmx web service.

  1. Right click the project in Solution Explorer and choose Add Service Reference.

Add Service Reference.png

2. Click on Advanced at the bottom.

3. Then click on Web Reference to generate access code.

4. Next enter the URL to the external web service. Then click on the arrow icon to find the web service. Then click Add Reference.

add web service

5. Note that the Web References folder is created with the web service code.

6. Here is an example of code calling the web service:

</pre> service = new;

var xmlData = service.GetCompactData(xmlNode);

Assert.That(xmlData, Is.Not.Null);

Book .NET Web Services: Architecture and Implementation