调用Web方法时发生错误.“在Windows Mobile应用程序开发中调用Web方法时发生错误". [英] Error occurs on calling a web method."Error occurs on calling a web method in Windows Mobile Application Development"
本文介绍了调用Web方法时发生错误.“在Windows Mobile应用程序开发中调用Web方法时发生错误".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我正在开发可与Web服务一起使用的Windows Mobile应用程序.
在我的应用程序中,我正在调用一个WebMethod,它将数据集作为参数并返回一个整数值.
但是当我调用Web方法时,出现此错误
Hi All,
I am developing a windows mobile application which works with web service.
In my application i am calling a WebMethod which takes dataset as parameter and returns a integer value.
but when i make a call to web method i am getting this error
Error occurs on calling the WebMethod "Client found response content type of 'text/html; charset=us-ascii', but expected 'text/xml'.
这是网络方法代码
here is the webmethod code
[WebMethod]
public int GetServices(DataSet ds)
{
SqlConnection con = new SqlConnection(constring);
int rows = ds.Tables[0].Rows.Count;
int srows = 0;
foreach(DataRow dr in ds.Tables[0].Rows)
{
string query = "insert into Services(tckid,dscr,lngdesc,loc,asset,rptdt,crdt) values('"+dr[0].ToString()+"','"+dr[1].ToString()+"','"+dr[2].ToString()+"','"+dr[3].ToString()+"','"+dr[4].ToString()+"','"+dr[5].ToString()+"')";
SqlCommand cmd = new SqlCommand(query, con);
con.Open();
int r = cmd.ExecuteNonQuery();
if (r == 1)
{
srows = srows + 1;
}
}
return srows;
}
有人对此有想法吗?如果是,请与我分享.
谢谢,Balu
can any one have idea about this?if yes please share with me.
Thanks,Balu
推荐答案
使用类似TCP Monitor的工具调试请求/响应,并确保您正确地传递/接收值.
Use a tool like TCP Monitor to debug the request/response and ensure you are passing / receiving values correctly.
这篇关于调用Web方法时发生错误.“在Windows Mobile应用程序开发中调用Web方法时发生错误".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文