When using ASP to call WebService, the field Name in the database cannot be used
Source: Internet
Author: User
After a test today, it is found that when the "Name" keyword is used as the key value in the XML data returned by WebService, the ASP page cannot read the entire XML document, and the following error occurs:
The XML page cannot be displayed.
XML input cannot be viewed using the XSL style sheet. Correct the error and click refresh or try again later.
--------------------------------------------------------------------------------
Invalid characters are found in the text. An error occurred while processing the resource 'http: // 192.168.0.41/aspServer/server. asp. Row 56th, location: 11
<Name>
// The server ASP code is as follows. The WebService code is omitted. You only need to return a DataSet value.
<%
Set objHTTP = Server. CreateObject ("MSXML2.XMLHTTP ")
Set xmlDOC = Server. CreateObject ("MSXML. DOMDocument ")
StrWebserviceURL = "http: // 192.168.0.41/WebService1/Service1.asmx/ds"
'Set parameters and their values
'Strrequest = "x = 2 & y = 3"
StrRequest = "fig = 123"
ObjHTTP. Open "POST", strWebserviceURL, False
'Setting this Content-Type is very important.
ObjHTTP. SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
ObjHTTP. Send (strRequest)
BOK = xmlDOC. load (objHTTP. responseXML)
'Look at the status value
If objHTTP. Status = 200 then
XmlStr = xmlDOC. xml
XmlStr = Replace (xmlStr, "& lt;", "<", 1,-1, 1)
XmlStr = Replace (xmlStr, "& gt;", ">", 1,-1, 1)
Response. Write xmlStr
Else
Response. Write objHTTP. Status & "<br>"
Response. Write objHTTP. StatusText
End if
%>
'The keyword Name cannot be used in database design !!!!!!!!!!!!
'1970 note !!!
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service