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>
ExportTool.Web.org.un.data.NSIStdV20Service service = new ExportTool.Web.org.un.data.NSIStdV20Service();

var xmlData = service.GetCompactData(xmlNode);

Assert.That(xmlData, Is.Not.Null);
<pre>

Book .NET Web Services: Architecture and Implementation

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s