asp调用wcf服务、webservice

'//1、输入url目标网页地址,返回值getHTTPPage是目标网页的html代码

     Function getHTTPPage(url)

          url=cstr(url)

          dim Http

          set Http=server.createobject("MSXML2.ServerXMLHTTP")

         ' Response.write url

         ' Response.end

          Call Http.setTimeouts(90000,90000,90000,90000)

          Http.open "GET",url,false

          Http.send()

          if Http.readystate<>4 then 

           exit function

          end if

  

          getHTTPPage=bytesToBSTR(Http.responseBody,"utf-8")

          set http=nothing

          if err.number<>0 then err.Clear 

         End Function

         '//2、转换乱玛,直接用xmlhttp调用有中文字符的网页得到的将是乱玛,可以通过adodb.stream组件进行转换

         Function BytesToBstr(body,Cset)

          dim objstream

          set objstream = Server.CreateObject("adodb.stream")

          objstream.Type = 1

          objstream.Mode =3

          objstream.Open

          objstream.Position = 0

          objstream.Type = 2

          objstream.Charset = Cset

          BytesToBstr = objstream.ReadText 

          objstream.Close

          set objstream = nothing

         End Function 

你可能感兴趣的:(webservice)