使用ASP调用WebService时不能以Name为数据库中的字段 - 中国WEB开发者网络 (http://www.webasp.net) -- 技术教程 (http://www.webasp.net/article/) --- 使用ASP调用WebService时不能以Name为数据库中的字段 (http://www.webasp.net/article/15/14543.htm) |
| -- 作者:未知 -- 发布日期: 2004-11-04 |
| 今天做了一下试验,发现当WebService返回的XML数据中使用了”Name”关键字作为健值时,ASP页面将无法读取整个XML文档,而出现以下错误:
无法显示 XML 页。 使用 XSL 样式表无法查看 XML 输入。请更正错误然后单击 刷新按钮,或以后重试。 -------------------------------------------------------------------------------- 文本内容中发现无效字符。处理资源 'http://192.168.0.41/aspServer/server.asp' 时出错。第 56 行,位置: 11 <Name> //服务器端ASP代码如下,WebService代码略,只要返回一个DataSet的值即可 <% Set objHTTP = Server.CreateObject("MSXML2.XMLHTTP") Set xmlDOC =Server.CreateObject("MSXML.DOMDocument") strWebserviceURL = "http://192.168.0.41/WebService1/Service1.asmx/ds" '设置参数及其值 'strRequest = "x=2&y=3" strRequest = "tbname=123" objHTTP.Open "POST", strWebserviceURL, False '设置这个Content-Type很重要 objHTTP.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded" objHTTP.Send(strRequest) bOK = xmlDOC.load(objHTTP.responseXML) '看看状态值 if objHTTP.Status=200 then xmlStr = xmlDOC.xml xmlStr = Replace(xmlStr,"<","<",1,-1,1) xmlStr = Replace(xmlStr,">",">",1,-1,1) Response.Write xmlStr else Response.Write objHTTP.Status&"<br>" Response.Write objHTTP.StatusText end if %> '关键字Name不能用在数据库设计中!!!!!!!!!!!! '十万个注意!!! |
| webasp.net |