首页 > 开发 > 综合 > 正文

使用WINDOWS脚本访问WEB SERVICES

2024-07-21 02:21:19
字体:
来源:转载
供稿:网友

商业源码热门下载www.html.org.cn

'''''''''''''''''''''''''''''''''''''''''''''''
'modiay by x
' 2003-12-30
'''''''''''''''''''''''''''''''''''''''''''''''
const forreading = 1, forwriting = 2, forappending = 8 '文件操作常量
'''''''''''''''''''''''''''''''''''''''''''''''
webserviceurl = "http://www.chefbj.net/webservices/school.asmx" '调用url(uri)
webmethodname = "http://www.chefbj.com/show_school" '调用方法名

'soap请求,需要根据具体web services web方法更改
sentrequest="<?xml version='1.0' encoding='utf-8'?>"_
& "<soap:envelope xmlns:xsi='http://www.w3.org/2001/xmlschema-instance' "_
& "xmlns:xsd='http://www.w3.org/2001/xmlschema' "_
& "xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>"_
& "<soap:body>"_
& "<show_school xmlns='http://www.chefbj.com'>"_
& "<password>chef</password>"_
& "</show_school>"_
& "</soap:body>"_
& "</soap:envelope>"

responsefile="request.xml" '应答文件
'''''''''''''''''''''''''''''''''''''''''''''''

set requesthttp = createobject("microsoft.xmlhttp")

requesthttp.open "post", webserviceurl, false

requesthttp.setrequestheader "content-type", "text/xml"
requesthttp.setrequestheader "charset", "utf-8"
requesthttp.setrequestheader "soapaction", webmethodname

requesthttp.send sentrequest

msgbox("请求已经送出. http request status= " & requesthttp.status)


'将应答记录入文件
set objfso = createobject("scripting.filesystemobject")
set objtextfile = objfso.createtextfile(responsefile, true,true)


objtextfile.write(requesthttp.responsexml.xml)

objtextfile.close


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表