ASP.NET
  Home arrow ASP.NET arrow Page 3 - ASP.NET and Web Services, Part 1
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Moblin 
JMSL Numerical Library 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

ASP.NET and Web Services, Part 1
By: McGraw-Hill/Osborne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 9
    2004-03-08

    Table of Contents:
  • ASP.NET and Web Services, Part 1
  • What Is a Web Service?
  • Creating a Web Service
  • Defining a Service-Oriented Architecture (SOA)
  • SOA Web Services
  • Primary Web Services Technologies
  • SOAP's Messaging Architecture
  • Other SOAP Attributes
  • More SOAP Attributes

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    ASP.NET and Web Services, Part 1 - Creating a Web Service


    (Page 3 of 9 )


    Microsoft designates ASP.NET as the technology for building web services. Both business logic and presentation layer are bundled together within ASP.NET. The developer begins the web service process by applying attributes that inform the Common Language Runtime (CLR) back to treat a defined class and its methods as a web service. (Refer to Chapter 5 for a complete discussion about the CLR and its functionality.) Web service business logic is stored in an .asmx file. The code can dwell either within the .asmx file or in a precompiled class. The developer applies the following directive to the file containing the class name and namespace in which the class for the web service resides. It looks like this:


    <%@ WebService Language "VB" Class ="IFCE" %>

    Then, the developer declares a method that includes the number of parameters and its data types, as shown here:


    <WEBMETHOD()><WebMethod()>Public Function ConvertCurrency 
    (ByVal x As DoubleByVal y as Double) As Double 
      
    //write the code to implement the method 
    End Function

    The code is compiled to Microsoft Intermediate Language (MSIL) and to its own specific assembly. Typically, the assembly should be placed in a bin file so others can reference it. Creating a web service class looks like this:


    Imports System.Web.Services 
    Public 
    Class IFCE 
      Inherits WebService 
      
    'declare the methods here exposed by the Web Service 
    End Class 

    XML-based web services use the namespace mechanism for defining an end point for the web service, the namespace to whom a client forwards requests. Here is the syntax:


    <WebService (Namespace="http://www.IFCE.com/Webservices/"_
    Public 
    Class IFCEWebService {}

    ASP.NET uses reflection inspect metadata attributes. Attributes facilitate applying WebMethod attribute to declare methods as previously demonstrated. By examining this process, it is clear that the client requests a server-side provider to expose its services. The provider is mandated to issue the client a contract (aWSDL file) that lists the services it exposes. This information informs the client how to communicate with the service provider and utilize its services.

    Therefore, it is possible to add to our definition of a web service by describing it as a discrete piece of business logic written in Java, managed C++ .NET, C# .NET, or some other programming language. Depending on the language, a function or method is typically decorated with a web method attribute, thereby designating it as eligible to initiate a call to a web service provider. This process informs the CLR that this call is to be treated as a valid web service invocation.

    Remember: This is part one of chapter 7 .NET & J2EE Interoperability, by Dwight Peltzer (McGraw-Hill/Osborne, ISBN 0-07-223054-1, 2004). If you like what you see, feel free to click on the following link to get your own copy!
    Buy this book now.

    More ASP.NET Articles
    More By McGraw-Hill/Osborne


     

    ASP.NET ARTICLES

    - Source Code for Saving and Retrieving Data w...
    - Using GridView to Save and Retrieve Data wit...
    - Handling Dynamic Images in ASP.NET 3.5 AJAX ...
    - Retrieving Data with AJAX and the GridView C...
    - Playing with Images in ASP.NET 3.5 AJAX Appl...
    - Saving and Retrieving Data with AJAX
    - Enhancing PHP Via the ASP.NET AJAX Framework...
    - Enhancing PHP Programming with the ASP.NET A...
    - Classes and ASP.NET AJAX
    - Using ASP.NET AJAX
    - Building a Simple Storefront with LINQ
    - Developing a Dice Game Using ASP.NET Futures...
    - Completing an ASP.NET AJAX Server-Centric Ba...
    - Information Management for an ASP.NET AJAX S...
    - Comment and Order Management for an ASP.NET ...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
    Stay green...Green IT