Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Creating a Web Service

In ASP.NET, the complexities of SOAP messaging and HTTP transport are abstracted from developers, so creating XML-based Web services is actually quite simple. This abstraction is enabled through attributes that tell the common language runtime (CLR) to treat a specified class and its methods as Web services. Based on these attributes, the CLR provides all of the plumbing necessary to expose the class and methods as Web services, as well as providing a contract that clients can use to determine how to call the Web service and the return types to expect from it.

Declaring a Web Service

Web services in ASP.NET are defined in files with the .asmx file extension. The actual code for an ASP.NET Web service can reside either in the .asmx file or in a precompiled class. Either way, the Web service is declared in the .asmx file by adding the @ WebService directive to the file. The syntax for declaring a Web service in which the class will be defined within the .asmx files is


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint