Consuming a WebService
- In the Solution Explorer, on the Northwind Project
- Right Click on References and choose "Add Service Reference..."
- You'll get the "Add Service Reference" Dialog
- Paste the WebService URL in the Address TextBox
- Select the Service you require
- See the different methods of that Service
- Choose the Namespace where all the classes related to this WebService will be stored
- To use the WebService, Create a new instance of the XXXClient class (OrderServiceClient class in our case). Note that this class is in the
OrderService
namespace we've previously chose in the "Add Service Reference" dialog - See that the
GetOrder
method of the client returns an object of typeOrderService.OrderPoco
that was automatically generated by Visual Studio as part of our Service Reference.
We'll use that class to interact with the Service
public void Run()
{
var c = new OrderService.OrderServiceClient();
var o = c.GetOrder(10249);
}
Help us improve, Edit this page on GitHub
or email us at info@fireflymigration.com