Results 1 to 4 of 4

Thread: How to create the Web Services component in C#.NET

  1. #1
    Join Date
    Jan 2009
    Posts
    96

    How to create the Web Services component in C#.NET

    Hey Friends,

    I have enough knowledge about the C#.NET so therefore i have decided to start with making web services component in the C#.Net, but I wanted to have a little helping hand about how to start for making the web services.

    I have Visual Studio 2005 installed on my computer,So, If anyone aware about it please let me know.

    Thanking you

  2. #2
    Join Date
    Jan 2006
    Posts
    211

    Re: How to create the Web Services component in C#.NET

    Web Services run on top of HTTP. Therefore, they are developed and deployed on a Web Server and their URL is advertised so that "Internet" clients can discover and make use of their services. Even though that Web Server can be Microsoft IIS, or Apache, or any other such server, at this point in time, the .NET framework only supports deployment on Microsoft IIS.

    In this article, we will build a web service called OIDServer that clients can use to generate a unique Object Identity (OID) string. The generated OID string is unique, and can be used by the client wherever unique keys are needed - either for COM GUIDs, or to act as a unique primary key for a database table, etc. Since the Web Service class is deployed on a Web Server, any "Internet" client can access it and make use of its services - as opposed to COM components which can only be accessed by COM clients.

    The various steps that are involved in creating a Web Service Component using C# and the .NET Framework are as follows (I'm going to assume you're using the VS.NET IDE):

    1. Create a Visual C# - ASP.NET Web Service project
    2. Develop the OIDServer.asmx file and the OIDServer.asmx.cs class file
    3. Modify the generated AssemblyInfo.cs to add the right assembly information
    4. Build the Project Files


    you may get some more info here:
    http://my.execpc.com/~gopalan/dotnet...ce_server.html

  3. #3
    Join Date
    Dec 2008
    Posts
    161

    Re: How to create the Web Services component in C#.NET

    We are going to use C# to create a Web Service called "SecurityWebService." A Web Service file will have an .ASMX file extension. (as opposed to an .ASPX file extension of a ASP.NET file). The first line of the file will look like

    Code:
     <%@ WebService Language="C#" class="SecurityWebService" %>
    This line will instruct the compiler to run on Web Service mode and the name of the C# class. We also need to access the Web Service namespace. It is also a good practice to add a reference to the System namespace.

    using System;
    using System.Web.Services;

    The SecurityWebService class should inherit the functionality of the Web Services class. Therefore, we put the following line of code:

    public class SecurityWebService : WebService

    Now we can use our object-oriented programming skills to build a class. C# classes are very similar to C++ or Java classes. It will be a walk in the park to create a C# class for anyone with either language-coding skills.

    Dot-net Web Services are intelligent enough to cast basic data types. Therefore, if we return "int," "float," or "string" data types, it can convert them to standard XML output. Unfortunately, in most cases we need get a collection of data regarding a single entity. Let's take an example.

    Our SecurityWebService stock quotes service requires the user to enter a company code, and it will deliver the full company name and the current stock price. Therefore, we have three pieces of information for a single company:

    1. Company code (data type - string)
    2. Company name (data type - string)
    3. Price (data type - Double)

  4. #4
    Join Date
    Dec 2008
    Posts
    112

    Re: How to create the Web Services component in C#.NET

    IIS, create a virtual folder. Create a bin directory in the physical path of the virtual folder and copy the dll file in the bin folder.
    Create a file TestService.asmx in the physical path of and paste the following code in it:
    <%@ WebService Language="C#" Class="Service1" %>
    using System.Web.Services;
    public class Service1 : System.Web.Services.WebService { [WebMethod Description="This method converts a temperature in " + "degrees Fahrenheit to a temperature in degrees Celsius.")]
    Code:
    public double ConvertTemperature(double dFahrenheit)
    { testComNet.myClass obj=new testComNet.myClass();
    double dC=obj.ConverFtoC(ref dFahrenheit);
    obj=null;
    return dC
    }
    }

Similar Threads

  1. ActiveX component can't create object error
    By Abe Simpson in forum Windows x64 Edition
    Replies: 8
    Last Post: 14-06-2011, 11:32 PM
  2. Error 429 : ActiveX component can't create object
    By GunTher in forum Vista Help
    Replies: 8
    Last Post: 30-01-2011, 03:04 AM
  3. How to create a JSpinner component?
    By MAGAR in forum Software Development
    Replies: 5
    Last Post: 30-01-2010, 04:55 PM
  4. How to create a JList component in java?
    By KALANI84 in forum Software Development
    Replies: 4
    Last Post: 28-01-2010, 04:11 PM
  5. Error=429: ActiveX component can't create object
    By vibhub in forum Vista Help
    Replies: 2
    Last Post: 23-12-2008, 07:41 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,005,100.77510 seconds with 16 queries