28,391
社区成员
发帖
与我相关
我的任务
分享
Set xmldoc = server.createObject("Msxml2.DOMDocument")
xmldoc.async = false
Set soapclient = server.CreateObject("MSSOAP.SoapClient30")
soapclient.ClientProperty("ServerHTTPRequest") = True
soapclient.mssoapinit "http://220.250.64.122/UIP/services/MgPUBTicketRetireService?wsdl","http://schemas.xmlsoap.org/soap/http","",""
str = soapclient.retireTicket(retireTicket)
response.Write str
Url="http://220.250.64.122/UIP/services/MgPUBTicketRetireService?wsdl"
SoapRequest1="<soapenv:Envelope "& _
"xmlns:soapenv="&CHR(34)&"http://schemas.xmlsoap.org/soap/envelope/"&CHR(34)&" "& _
"xmlns:soapenv="&CHR(34)&"http://www.w3.org/2001/XMLSchema"&CHR(34)&" "& _
"xmlns:XI="&CHR(34)&"http://www.w3.org/2001/XMLSchema-instance"&CHR(34)&" "& _
"xmlns:a="&CHR(34)&"urn:veSWScnService"&CHR(34)&">"& _
"<S:Body>"& _
"<a:retireTicket XI:type="&CHR(34)&"XS:string"&CHR(34)&">str</a:retireTicket>"& _
"</S:Body>"& _
"</S:Envelope>"
SoapRequest1="<soapenv:Envelope xmlns:soapenv="&CHR(34)&"http://schemas.xmlsoap.org/soap/envelope/"&CHR(34)&">"& _
"<soapenv:Header xmlns:wsa="&CHR(34)&"http://www.w3.org/2005/08/addressing"&CHR(34)&">"& _
"<wsa:Action>"&CHR(34)&"http://www.w3.org/2005/08/addressing/soap/fault"&CHR(34)&"</wsa:Action></soapenv:Header>"& _
"<soapenv:Body>"& _
"<a:retireTicket xmlns:type="&CHR(34)&"XS:string"&CHR(34)&">str</a:retireTicket>"& _
"</soapenv:Body>"& _
"</soapenv:Envelope>"
Set xmlhttp = server.CreateObject("Msxml2.XMLHTTP")
xmlhttp.Open "POST",url,false
xmlhttp.setRequestHeader "Content-Type", "text/xml;charset=utf-8"
xmlhttp.setRequestHeader "HOST","localhost"
xmlhttp.setRequestHeader "Content-Length",LEN(SoapRequest1)
xmlhttp.setRequestHeader "SOAPAction", "http://schemas.xmlsoap.org/soap/http/retireTicket" '一定要与WEBSERVICE的命名空间相同,否则服务会拒绝
xmlhttp.Send(SoapRequest1)
response.Write(xmlhttp.status)
response.Write("<br>"&xmlhttp.responseText)
response.End()
url = "http://220.250.64.122/UIP/services/MgPUBTicketRetireService?wsdl"
Set xmlhttp = server.CreateObject("Msxml2.XMLHTTP")
xmlhttp.Open "GET",url,false
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"'注意
xmlhttp.setRequestHeader "HOST","220.250.64.122"
xmlhttp.setRequestHeader "Content-Length",LEN(url)
xmlhttp.Send(url)
'这样就利用XMLHTTP成功发送了与HTTP POST示例所符的POST请求.
'检测一下是否成功:
If xmlhttp.Status = 200 Then '调用成功
Set xmlDOC = server.CreateObject("MSXML.DOMDocument")
xmlDOC.load(xmlhttp.responseXML)'使用xml文档的格式
response.Write xmlDOC.childNodes(1).Text
Set xmlDOC=nothing
Else
Response.Write xmlhttp.Status&" "
Response.Write xmlhttp.StatusText
End if
可以转成xml的读取各节点url = "http://220.250.64.122/UIP/services/MgPUBTicketRetireService?wsdl"
Set xmlhttp = server.CreateObject("Msxml2.XMLHTTP")
xmlhttp.Open "GET",url,false
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"'注意
xmlhttp.setRequestHeader "HOST","220.250.64.122"
xmlhttp.setRequestHeader "Content-Length",LEN(url)
xmlhttp.Send(url)
'这样就利用XMLHTTP成功发送了与HTTP POST示例所符的POST请求.
'检测一下是否成功:
Response.Write bytesToBSTR(xmlhttp.responseBody,"GB2312")
Set xmlhttp = Nothing
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