Let me explain with a simple Webservice which has the function to concatenate strings.
Here are the steps below to create a Webservice in ASP.NET using C# :
(1) Open Visual Studio -> Create Project -> ASP.NET Webservice Application
It will create an Application with default Service file as follows :
In this example I have created a webservice method that returns concatenated string as
output.WebMethod attribute makes the function callable from remote Web Clients.
Namespace "http://tempuri.org/" is a temporary url provided for under development
project.Here we can provide the hosted url of the Webservice.
On running the output is :
.asmx is the file to which webservice url navigates. It contains all functions,its parameters and its return types. On clicking the function it displays a test interface as follows :
The result on clicking Invoke button is :
On clicking Service Description of .asmx, we will get WSDL
(Webservice Definition Language) file which is an xml file that defines the webservice
and it looks like :
Like normal Websites or Web Applications , Webservices can be hosted in IIS. For eg. if we
host it in local machine url looks like :
http://localhost/WebService1/Service.1asmx
Here are the steps below to create a Webservice in ASP.NET using C# :
(1) Open Visual Studio -> Create Project -> ASP.NET Webservice Application
It will create an Application with default Service file as follows :
In this example I have created a webservice method that returns concatenated string as
output.WebMethod attribute makes the function callable from remote Web Clients.
Namespace "http://tempuri.org/" is a temporary url provided for under development
project.Here we can provide the hosted url of the Webservice.
On running the output is :
.asmx is the file to which webservice url navigates. It contains all functions,its parameters and its return types. On clicking the function it displays a test interface as follows :
The result on clicking Invoke button is :
On clicking Service Description of .asmx, we will get WSDL
(Webservice Definition Language) file which is an xml file that defines the webservice
and it looks like :
Like normal Websites or Web Applications , Webservices can be hosted in IIS. For eg. if we
host it in local machine url looks like :
http://localhost/WebService1/Service.1asmx
No comments:
Post a Comment