Step 1: Go to=>File=>New=>WebSite
Step 2: Select Asp.New Web service
Step 3: Write Method in your web
service class file.
My method name is: MyServiceMethod
Step 4: Then Run This Application
and watch this window in your browser. And also look at the method that has been
created by me. Here you can test whether your method works properly or not.
B.
Publish This service on
your local IIS server.
Step 1: Right click on your
application=>Publish Web site
Step 2: Checked =>Use Fixed Naming
and single page assemblies and browse target location.
Step 3: Select=>Local IIS=>Default
Website=>Create New Web Application by clicking on the small icon located at the above of this Screen shot.=>write name of your application.and click
on Open button.
=>You can access this web service
using=> http://localhost/mytestwebservice URL
Step 4=> After that click OK
button.
Step 5=> After that you can
access the the web service using this URL http://localhost/mytestwebservice/Service.asmx
C. How to consume Web service in Web
Application?
Consuming Web service :
=>Using WSDL generated Proxy
class.=>How to generate proxy class?
Step 1=>Open Command Prompt.From=>Start=>
Step 2=> Write this command on
Command Prompt.
Open=>Command prompt=>right click=>paste below written command
Formate of command=>wsdl /l:CS /n:namespace /o:DriveName:\classname.cs
Service URL
wsdl /l:CS /n:myserviceclassnameSpace /o:d:\myserviceclassname.cs http://localhost/mytestwebservice/Service.asmx
After that Press enter.
Using this command generate the proxy class
file of the web service.you can use this class in in your web and window application.
Step 3=>Add myserviceclassname.cs file in your application and consume service in your application.
Step 4=>Call method of service class like this:
Step 5=> Out put is=>