Using Visual Studio 2010.
I created a webservice GetDemographicData asmx, GetDemographicData asmx.cs and then used wsdl to create a proxy, then used csc.exe to create dll.

But in the autogenerated cs:

1.I lost the function: public DataSet Get_GetDemographicData(string CaseNum, int Version)
2. The namespace changed to my-labs

Why?? Please see my code below:

Any help is appreciated. Thanks.

<%@ WebService Language="C#" CodeBehind="~/App_Code/GetDemographicData.cs" Class="GetDemographicData" %>

 

GetDemographicData.cs was created under AppData as follows:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;

///
/// Summary description for GetCurrentReportVersion
///
[WebService(Namespace = "<a href="http://localhost/" )]"="" rel="nofollow">http://localhost/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class GetDemographicData : System.Web.Services.WebService{

public GetDemographicData()
{

//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod(Description = "Returns GetDemographicData by CaseNum")]
public DataSet Get_GetDemographicData(string CaseNum, int Version)
{
String myConn = ConfigurationManager.ConnectionStrings["DBConnectionString"].ToString();
SqlConnection conn = new SqlConnection(myConn);
SqlCommand cmd = new SqlCommand();
SqlDataAdapter adapter = new SqlDataAdapter();
DataSet dsInfo = new DataSet();
string query = "Reports.GetDemographicData";
try
{
cmd.CommandText = query;
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@CaseNo", CaseNum));
cmd.Parameters.Add(new SqlParameter("@Version", Version));
cmd.Connection = conn;
adapter.SelectCommand = cmd;
adapter.Fill(dsInfo, "GetDemographicData");
return dsInfo;
}
catch (Exception ex)
{
System.Web.HttpContext.Current.Response.Write(ex.Message);
return null;
}
finally
{
conn.Close();
}
}

}

 

Now I want to compile the cs so that I can get a GetDemographicData.dll, which can be added as reference to a console client on the same machine.
So I run the following commands at the command prompt:

 

wsdl /l:cs /protocol:SOAP http://localhost/My_HL7_Interface/GetDemographicData.asmx?wsdl

c:\Windows\Microsoft.net\Framework\v3.5\csc.exe /t:library /r:System.web.Services.dll /r:System.xml.dll GetDemographicData.cs

 

I get the dll, but the cs file now lost the function public DataSet Get_GetDemographicData(string CaseNum, int Version) and Namespace got changed to http://my-labs/ (instead of localhost)

 

using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Serialization;

//
// This source code was auto-generated by wsdl, Version=2.0.50727.3038.
//


///
// CODEGEN: No methods were found in the WSDL for this protocol.
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="GetDemographicDataSoap", Namespace="<a href="http://csi-labs/" )]"="" rel="nofollow">http://csi-labs/")]
public partial class GetDemographicData : System.Web.Services.Protocols.SoapHttpClientProtocol {

///
public GetDemographicData() {
this.Url = "http://localhost/CSI_HL7_Interface/GetDemographicData.asmx";
}
}

 

What am I doing wrong?
1.why does the auto generated cs (proxy) get the function: public DataSet Get_GetDemographicData(string CaseNum, int Version)
2. why is the namespace changing?