Consuming a web service
Main purpose of creating a web service is to use the service from same server different application or different server . So to access a web service from another application the following task needed to be performed. To know how to create a web service click here.- We have to add the service reference to our client application
- Give the reference a meaning full name
- Create a object of the service
Creating the Proxy
presents it to the client application.This Process is describe in this picture
Now Take the following steps for creating the proxy:
Step (1) :In my case, client is a windows application. so to add web reference first right click on application then select add service reference, Now Click on Advance it will open up service reference settings there at the end of the window click add web reference.
Step (2) : Now add web reference window will open and you have to copy the hosted web service address to the URL address bar. A meaning full web service reference name should be given then click on add reference. It will add the service reference with the client application now from the client application you can create object of the service reference and call the web service method.
Step (3) : write down the below code to create object of the service .
ConsumeService.Service1 obj = new ConsumeService.Service1();