Y
ywan
Unregistered / Unconfirmed
GUEST, unregistred user!
我建立一个WEBSERVICE 方法save(sqlst)写在 aa.asmx 文件中然后在asp页面中调用该WEBSERVICE.代码如下:
Function srSave(sqlStr,asmxURL)
Dim webServiceUrl, httpReq
str=covertion(sqlStr)
webServiceUrl ="http://10.50.0.231/aa.asmx/Save" &
"?strSql=" &
str
Set httpReq = Server.CreateObjec("MSXML2.ServerXMLHTTP") httpReq.Open "GET", webServiceUrl, False
httpReq.Send
consumeWebService=httpReq.responseText
End Function
function covertion(str)
str=replace(str,"%","%25")
str=replace(str,"+","%2B")
str=replace(str," ","+")
str=replace(str,"&", "%26")
str=replace(str,"!", "%EF%BC%81")
str=replace(str,"、", "%E3%80%81")
str=replace(str,"¥", "%EF%BC%81")
str=replace(str,"?", "%EF%BC%9F")
str=replace(str,"……", "%E2%80%A6%E2%80%A6")
str=replace(str,"—", "%E2%80%94")
str=replace(str,"(", "%EF%BC%88")
str=replace(str,")", "%EF%BC%89")
str=replace(str,":", "%EF%BC%9A")
str=replace(str,";", "%EF%BC%9B")
str=replace(str,"“", "%E2%80%9C")
str=replace(str,"”", "%E2%80%9D")
str=replace(str,"〈", "%E3%80%8A")
str=replace(str,"〉", "%E3%80%8B")
str=replace(str,",", "%EF%BC%8C")
str=replace(str,"。", "%E3%80%82")
str=replace(str,"?", "%EF%BC%9F")
str=replace(str,"(","%28")
str=replace(str,")","%29")
str=replace(str,",","%2C")
str=replace(str,"'","%27")
covertion=str
end function
当传送的字符串为中文时,WEBSERVICE 收到的字符串出现乱码(我已将部分符号转换了),请高手不吝赐教!!
Function srSave(sqlStr,asmxURL)
Dim webServiceUrl, httpReq
str=covertion(sqlStr)
webServiceUrl ="http://10.50.0.231/aa.asmx/Save" &
"?strSql=" &
str
Set httpReq = Server.CreateObjec("MSXML2.ServerXMLHTTP") httpReq.Open "GET", webServiceUrl, False
httpReq.Send
consumeWebService=httpReq.responseText
End Function
function covertion(str)
str=replace(str,"%","%25")
str=replace(str,"+","%2B")
str=replace(str," ","+")
str=replace(str,"&", "%26")
str=replace(str,"!", "%EF%BC%81")
str=replace(str,"、", "%E3%80%81")
str=replace(str,"¥", "%EF%BC%81")
str=replace(str,"?", "%EF%BC%9F")
str=replace(str,"……", "%E2%80%A6%E2%80%A6")
str=replace(str,"—", "%E2%80%94")
str=replace(str,"(", "%EF%BC%88")
str=replace(str,")", "%EF%BC%89")
str=replace(str,":", "%EF%BC%9A")
str=replace(str,";", "%EF%BC%9B")
str=replace(str,"“", "%E2%80%9C")
str=replace(str,"”", "%E2%80%9D")
str=replace(str,"〈", "%E3%80%8A")
str=replace(str,"〉", "%E3%80%8B")
str=replace(str,",", "%EF%BC%8C")
str=replace(str,"。", "%E3%80%82")
str=replace(str,"?", "%EF%BC%9F")
str=replace(str,"(","%28")
str=replace(str,")","%29")
str=replace(str,",","%2C")
str=replace(str,"'","%27")
covertion=str
end function
当传送的字符串为中文时,WEBSERVICE 收到的字符串出现乱码(我已将部分符号转换了),请高手不吝赐教!!