Following example will give a clear Idea about how to create a Web Service and How to consume the service.
Create One Web Service Application
-->File-->New-->Project-->VC-->Web-->Asp.Net Web Service Application
By default one service will be added "HELLO WORLD"
Think that you are providing this service only.
Then Public this though IIS, then you will get a Link.
Create one Project for Accessing the Web Service.
Add the reference as
Right click on Project select Add Web Service Reference and Give the path of Hosted Web Service
Link.
There you can find the Namespace.
If you want to call the Web Service method then you need to create the instance as
Namespace.ServiceName proxy=new Namespace.ServiceName();
proxy.WebMethod() nothing but a service.
Create One Web Service Application
-->File-->New-->Project-->VC-->Web-->Asp.Net Web Service Application
By default one service will be added "HELLO WORLD"
Think that you are providing this service only.
Then Public this though IIS, then you will get a Link.
Create one Project for Accessing the Web Service.
Add the reference as
Right click on Project select Add Web Service Reference and Give the path of Hosted Web Service
Link.
There you can find the Namespace.
If you want to call the Web Service method then you need to create the instance as
Namespace.ServiceName proxy=new Namespace.ServiceName();
proxy.WebMethod() nothing but a service.
No comments:
Post a Comment