Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 06-02-2009
Member
 
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
Reply With Quote
  #2  
Old 06-02-2009
Member
 
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
Reply With Quote
  #3  
Old 06-02-2009
Member
 
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)
Reply With Quote
  #4  
Old 06-02-2009
Member
 
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
}
}
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to create the Web Services component in C#.NET"
Thread Thread Starter Forum Replies Last Post
ActiveX component can't create object error Abe Simpson Windows x64 Edition 8 14-06-2011 11:32 PM
Error 429 : ActiveX component can't create object GunTher Vista Help 8 30-01-2011 03:04 AM
How to create a JSpinner component? MAGAR Software Development 5 30-01-2010 04:55 PM
How to create a JList component in java? KALANI84 Software Development 4 28-01-2010 04:11 PM
Error=429: ActiveX component can't create object vibhub Vista Help 2 23-12-2008 07:41 PM


All times are GMT +5.5. The time now is 08:07 PM.