因为要做移动梦网WAP的一些接口,所以要用到这种方式,这个是ASP版本的,利用了MSXML2.XMLHTTP对像

request.asp

  1. dim Https 
  2. set Https=server.createobject("MSXML2.XMLHTTP") 
  3. '定义一个XMLHTTP对像 
  4. Https.open "POST","http://127.0.0.1/testpost/response.asp",false 
  5. Https.send " echo 
  6. 123456 987654 
  7. 11111 22222 " 
  8. if Https.readystate=4 then 
  9.  response.write "提交成功" 
  10.  'readstate读取状态为4则成功,继续后面的,不成功当然就不用继续处理了 
  11.  dim objstream 
  12.  set objstream = Server.CreateObject("adodb.stream") 
  13.  '定义一个stream,因为读过来的直接拿出来是乱码的,所以得处理一下 
  14.  objstream.Type = 1 
  15.  objstream.Mode =3 
  16.  objstream.Open 
  17.  objstream.Write Https.responseBody 
  18.  objstream.Position = 0 
  19.  objstream.Type = 2 
  20.  objstream.Charset = "GB2312" 
  21.  html = objstream.ReadText 
  22.  '转好码,就放到html里,好关闭这些对像 
  23.  objstream.Close 
  24.  set objstream = nothing 
  25.  set https=nothing 
  26. end if 
  27. response.write html
  28. response.asp
  29. '创建DOMDocument对象 
  30. Set xml = Server.CreateObject ("msxml2.DOMDocument") 
  31. xml.async = False
  32. '装载POST数据 
  33. xml.Load Request 
  34. If xml.parseError.errorCode <> 0 Then 
  35.  response.write "不能正确接收数据" & "Description: " & xml.parseError.reason & "<br>Line: " & xml.parseError.Line 
  36. End If
  37. set blogchild=xml.getElementsByTagName("misc_command") 
  38. 'the_text=blogchild.item(0).childnodes(1).text 
  39. 'the_text=blogchild.item(0).text 
  40. 'for i=0 to blogchild.length-1 
  41. response.write the_text

利用这种方法,ASP里调用Servlet或Web Service都是很轻松的!