Dear cprogramming administrators and members,

A greeting of peace. I hope everyone is in good health upon reading this forum.

I am currently studying Web services and tried some programming on my own, here's my code for a Web Service:

<%@ WebService language="C#" class="MyService" %>

using System;
using System.Web.Services;
using System.Xml.Serialization;

public class MyService : WebService{
  private String name;
  public void setData(String n){
      name = n;
  public String getData(){     
      return name;
tried to "compile" using:

C:\InetPub\wwwroot\> WSDL http://localhost/MyService.asmx?WSDL
C:\InetPub\wwwroot\> csc /t:library MyService.cs
Then here's my C# console application that will use the Web service:

using System;
using System.IO;
namespace Win32{
  class Hi{
    public static int Main(String [] args){
      MyService m = new MyService();
      string name;
      Console.WriteLine("Please enter name: ");
      name = Console.ReadLine();
      Console.WriteLine( "Hello there using Web Service.  Your name is: "+m.getData() );
      return 0;

}//end namespace
Then "compile" it again using:

C:\InetPub\wwwroot\> csc /r:MyService.dll Win32.cs
I just wonder when I tried to run it, the name I entered was not returned by the getData() method.

Is there missing in my code? I hope someone could help me here.

Thank you & God bless.

Respectfully Yours,