webservice如何让其它语言进行调用?(例如c++)
我写了一个webservice
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using System.Data.SqlClient;
using System.Configuration;
namespace WebService
{
/// <summary>
/// Service1 的摘要说明。
/// </summary>
public class OneService : System.Web.Services.WebService
{
private string connStr;
private SqlConnection conn;
public OneService()
{
//CODEGEN: 该调用是 ASP.NET Web 服务设计器所必需的
InitializeComponent();
}
#region 组件设计器生成的代码
//Web 服务设计器所必需的
private IContainer components = null;
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if(disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}
#endregion
// WEB 服务示例
// HelloWorld() 示例服务返回字符串 Hello World
// 若要生成,请取消注释下列行,然后保存并生成项目
// 若要测试此 Web 服务,请按 F5 键
// [WebMethod]
// public string HelloWorld()
// {
// return "Hello World";
// }
[WebMethod]
public string getUserPassWord(string UserID)
{
connStr = ConfigurationSettings.AppSettings["connStr"];
conn = new SqlConnection(connStr);
conn.Open();
string sqlStr = "select PassWord from User_BaseInfo where UserID = '"+UserID+"'";
SqlCommand comm = new SqlCommand(sqlStr, conn);
SqlDataReader dr = comm.ExecuteReader();
string pwd = "";
if(dr.Read())
{
pwd = dr.GetString(0);
}
dr.Close();
conn.Close();
return pwd;
}
}
}
并通过
wsdl /l:cs /n:WebService /out:e\OneService.cs e:\OneService.wsdl
和
csc /t:library /r:System.dll,System.Web.dll,System.Data.dll /out:e:\OneService.dll e:\OneService.cs
生成OneService.dll
如在asp.net下进行调用,是没有问题的,但如何使其能在C++等其它语言进行调用呢?
webservice是这样用吗?请指教!