ISAPI如何处理Msxml2.ServerXMLHTTP的post请求!
请问使用那种方法可以处理下面的这些请求,现在已经使用ISAPI接受到post的数据了,但是如何发送数据才能让他的resultStr=BytesToBstr(Http.responseBody, "GB2312 ")的结果!
<SCRIPT LANGUAGE=VBSCRIPT RUNAT=server>
Class NPOSTXML
private StrMyPhoNum
private MOTOUrl
private byttStream
private strUID
private strPWD
Public Property Let MyPhoNum(vData)
strMyPhoNum=Trim(vData)
End Property
Public Property Let UID(vData)
strUID=Trim(vData)
End Property
Public Property Let Url(vData)
MOTOUrl=Trim(vData)
End Property
Public Property Let SendXML(vData)
byttStream=Trim(vData)
End Property
public Function Send()
Dim Http
Dim resultStr
Set Http = Server.CreateObject( "Msxml2.ServerXMLHTTP ")
Dim lResolve, lConnect, lSend, lReceive
lResolve = 5 * 1000
lConnect = 5 * 1000
lSend = 45 * 1000
lReceive = 45 * 1000
Http.setTimeouts lResolve, lConnect, lSend, lReceive
Http.Send(byttStream)
if Http.readystate = 4 then
resultStr=Http.responseBody
End if
resultStr=BytesToBstr(Http.responseBody, "GB2312 ")
set Http=nothing
Send = resultStr
End Function
public Function length()
Set Http=Server.CreateObject( "Msxml2.ServerXMLHTTP ")
lResolve=5 * 1000
lConnect=5 * 1000
lSend=45 * 1000
lReceive=45 * 1000
Http.setTimeouts lResolve, lConnect, lSend, lReceive
Http.open "POST ",MOTOUrl,false
Http.Send(byttStream)
If Http.readystate=4 Then
'length=Http.getAllResponseHeaders '全部HTTP头内容
length=Http.getResponseHeader( "Content-Length ")
End if
Set Http=Nothing
length=length
End Function
public Function BytesToBstr(body,Cset)
Dim objStream
Set objStream=Server.CreateObject( "Adodb.stream ")
objStream.Type=1
objStream.Mode=3
objStream.Open
objStream.Write body
objStream.Position=0
objStream.Type=2
objstream.Charset = Cset
BytesToBstr=objstream.ReadText
objStream.Close
Set objStream=nothing
End Function
End Class
</SCRIPT>
<%
strUrl = "http://127.0.0.1/rmsc/rmsc.dll? "
SendXML= " <?xml version = " "1.0 " " encoding= " "GB2312 " "?> <route type= " "0x00 " "
flag= " "0x0003 " "> <startpoint> <x> 116.308116 </x> <y> 39.908739 </y> </startpoint> <endpoint> <x> 116.398600 </x> <y> 39.909100 </y> </endpoi
nt> </route> "
%>
<%
On Error Resume Next
'Response.Write ( "343535 ")
Set SendMyself=new NPOSTXML
SendMyself.Url=strUrl
SendMyself.SendXML=SendXML
length=SendMyself.length
Sendnote=SendMyself.Send
Set SendMyself=Nothing
'Response.Write SendXML
Response.Write Sendnote
'Response.Write ( "gjgrtiortgithiht ")
Response.End
%>
<html>
<head> <title> asdfasdfasdf </title> </head>
<body>
adfasdfasdf
</body>
</html>
[解决办法]
帮你顶一下
[解决办法]
头大中.
post一个xml文件过去吗?
[解决办法]
帮顶