blog

Home / DeveloperSection / Blogs / Web Services in ASP.Net

Web Services in ASP.Net

Amit Singh4874 11-Dec-2010

A webservice is typically an application programming interface (API) or WebAPI that is accessed via Hypertext Transfer Protocol (HTTP) and executed ona remote system, hosting the requested service.
The basicWeb services platform is XML + HTTP.
XML providesa language which can be used between different platforms and programminglanguages and still express complex messages and functions.
The HTTPprotocol is the most used Internet protocol.

Web services  elements:

1.      SOAP (Simple Object Access Protocol)

2.      UDDI (Universal Description, Discovery andIntegration)

3.      WSDL (Web Services Description Language)

Important point related to web services

1.      Web services are application components

2.      Web services communicate using open protocols

3.      Web services are self-contained andself-describing

4.      Web services can be discovered using UDDI

5.      Web services can be used by other applications

6.    XML is the basis for Web services

How to create the webservices in ASP.Net

    Create a new websiteby selecting "ASP.NET Web Site" and give the name of the website.
    service.cs fileappears inside the solution with a default webmethodnamed as "WelCome()"
    Right click on the webservice project and add a web reference instead of adding anormal reference.
    A window appears that displays a list of webservices knowsto the solution.
    Click on "Webservices in this solution"
    a search progress bar appears and
    Select the service that appears in the list
    progress bar appears once again.
    web method appears on the screen
    Click on "Addreference" button. This would add localhost
    Solution would have App_WebReferencefolder

    How use in project orconsumption

        Add a UI (.aspx)to the webservice project
        Add a button and a label to the form
        Double click the button to see the click event of the button
        Create an object of type service localhost.serviceName
        Write code to display the value returned by the webmethod onthe label
        Execute the solution by setting the added aspx as thestartpage.
        click on the button and the message "welcome to use the webservice"would be displayed on the label


        Updated 18-Sep-2014

        Leave Comment

        Comments

        Liked By