webservice wsdl相关 我写了一个webservice,怎样返回一个wsdl文件让客户端调用 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 直接用浏览器访问,就能下载wsdl...专业点就用svcutil工具下载,svcutil也可以验证主机甚至直接生成客户端代理代码... 问题是访问的时候没有wsdl文件啊 在浏览器中访问http://*****/***.svc?wsdl .net webservice 的wsdl不是一个physical的文件,而是根据实现动态生成的。 谢谢你的回答,由于对webservice不明白,问题描述得不清楚按照你的建议,访问http://*****/***.svc?wsdl后,确实能返回一个wsdl现在的问题是怎样控制wsdl中返回的值我的webserice方法:[WebMethod] public UserInfo GetUserByAccount(string accountID) { UserInfo user = new UserInfo(); return user; }////UserInfo类: public class UserInfo { string SerialID; string FullName; string DeptID; string DeptName; public bool GetUser(string accountID) { string sql = "select FullName,DeptID,DeptName from ACCOUNT_TITLE_VIEW where AccountID='" + accountID + "'"; DataTable dt = GetDataTable(sql); FullName = dt.Rows[0]["FullName"].ToString(); DeptID = dt.Rows[0]["DeptID"].ToString(); DeptName = dt.Rows[0]["DeptName"].ToString(); string TheYear = DateTime.Now.Year.ToString(); string TheMonth = DateTime.Now.Month.ToString(); string TheDay = DateTime.Now.Day.ToString(); string TheHour = DateTime.Now.Hour.ToString(); string TheMinute = DateTime.Now.Minute.ToString(); string TheSecond = DateTime.Now.Second.ToString(); SerialID = TheYear + TheMonth + TheDay + TheHour + TheMinute + TheSecond + accountID; return true; } public DataTable GetDataTable(string sql) { SqlConnection sqlCon = new SqlConnection(ConfigurationSettings.AppSettings["sql"].ToString()); sqlCon.Open(); DataSet ds = new DataSet(); SqlCommand cmd = new SqlCommand(sql, sqlCon); try { cmd.CommandTimeout = 20; SqlDataAdapter adapter = new SqlDataAdapter(cmd); adapter.Fill(ds, "tempTable"); } catch (Exception e) { ds = null; } finally { cmd.Dispose(); sqlCon.Dispose(); sqlCon.Close(); } return ds.Tables[0]; } }wsdl返回的值:<?xml version="1.0" encoding="utf-8" ?> <UserInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/" /> 我想要的wsdl结果是:<?xml version="1.0" encoding="utf-8" ?> <UserInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/" /> <SerialID>20113810492690001</SerialID> <FullName>傅文彪</FullName> <DeptID>CEO</DeptID> <DeptName>CEO</DeptName> </UserInfo> 你的UserInfo不是实体类...字段不会被序列化,更何况你还都是私有字段...也就是说你的UserInfo本来就没有元数据,wsdl当然是空的...把SerialID神马的都改成属性...另外,方法是不会被传递的,soap传递的对象是xml,只有数据能被传递... 你要的那个叫soap message。wsdl是描述web service的。 对...wsdl实际上是个xsd,是xml的结构,是没有“值”的...你“想要的wsdl结果”是不可能的... 你想要的结果是用HttpRequest方式返回的结果,比如:http://localhost:4132/Service1.asmx/GetUserByAccount fullscreen=1,本地全屏没问题,发布到服务器上后,访问时有标题栏和地址栏。在线等◎◎◎◎ 额。。又遇到问题了。。 想做个针对博客更新的提醒工具,求点建议~ 关于三角形角度计算的问题(数学知识不行啊) 求救!! 正则表达式替换的问题 关于结构赋值的问题,高手进 有没有VS2005BETA2 关于实体数据模型并发冲突的问题 vs.net安装不上,怎办 怎么做到象Flastget 或者 Netants那样点击右键获取当前页面的所有链接? 速求高手,字节压缩的算法问题 帮我把这句sql翻译成Linq
在浏览器中访问http://*****/***.svc?wsdl
.net webservice 的wsdl不是一个physical的文件,而是根据实现动态生成的。
按照你的建议,访问http://*****/***.svc?wsdl后,确实能返回一个wsdl
现在的问题是怎样控制wsdl中返回的值我的webserice方法:
[WebMethod]
public UserInfo GetUserByAccount(string accountID)
{
UserInfo user = new UserInfo();
return user;
}
////
UserInfo类:
public class UserInfo
{
string SerialID;
string FullName;
string DeptID;
string DeptName;
public bool GetUser(string accountID)
{
string sql = "select FullName,DeptID,DeptName from ACCOUNT_TITLE_VIEW where AccountID='" + accountID + "'";
DataTable dt = GetDataTable(sql);
FullName = dt.Rows[0]["FullName"].ToString();
DeptID = dt.Rows[0]["DeptID"].ToString();
DeptName = dt.Rows[0]["DeptName"].ToString();
string TheYear = DateTime.Now.Year.ToString();
string TheMonth = DateTime.Now.Month.ToString();
string TheDay = DateTime.Now.Day.ToString();
string TheHour = DateTime.Now.Hour.ToString();
string TheMinute = DateTime.Now.Minute.ToString();
string TheSecond = DateTime.Now.Second.ToString();
SerialID = TheYear + TheMonth + TheDay + TheHour + TheMinute + TheSecond + accountID;
return true;
} public DataTable GetDataTable(string sql)
{
SqlConnection sqlCon = new SqlConnection(ConfigurationSettings.AppSettings["sql"].ToString());
sqlCon.Open();
DataSet ds = new DataSet();
SqlCommand cmd = new SqlCommand(sql, sqlCon);
try
{
cmd.CommandTimeout = 20;
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
adapter.Fill(ds, "tempTable");
}
catch (Exception e)
{
ds = null;
}
finally
{
cmd.Dispose();
sqlCon.Dispose();
sqlCon.Close(); }
return ds.Tables[0];
}
}wsdl返回的值:
<?xml version="1.0" encoding="utf-8" ?>
<UserInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/" /> 我想要的wsdl结果是:
<?xml version="1.0" encoding="utf-8" ?>
<UserInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/" />
<SerialID>20113810492690001</SerialID>
<FullName>傅文彪</FullName>
<DeptID>CEO</DeptID>
<DeptName>CEO</DeptName>
</UserInfo>