·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> 网站建设开发 >> ASP网站建设 >> ASP调用带验证的XFire(soap Header)

ASP调用带验证的XFire(soap Header)

作者:佚名      ASP网站建设编辑:admin      更新时间:2022-07-23
<%
 'response.ContentType = "text/html"
 'Response.Charset = "utf-8"
 
 url = "http://172.17.99.94:8080/rishis/services/QueryService"
 soapUserName = "ris"
 soapPassWord = "tzyyage542"
 
 SoaPRequest="<?xml version="&CHR(34)&"1.0"&CHR(34)&" encoding="&CHR(34)&"gbk"&CHR(34)&"?>"& _
 "<soap:Envelope xmlns:xsi="&CHR(34)&"http://www.w3.org/2001/XMLSchema-instance"&CHR(34)&" "& _
 "xmlns:xsd="&CHR(34)&"http://www.w3.org/2001/XMLSchema"&CHR(34)&" "& _
 "xmlns:soap="&CHR(34)&"http://schemas.xmlsoap.org/soap/envelope/"&CHR(34)&">"& _
 "<soap:Header>"& _
 "<AuthenticationToken xmlns="&CHR(34)&"http://spring.com"&CHR(34)&">"&_
 "<Username>"& soapUserName &_
 "</Username>"&_
 "<Password>" & soapPassword &_
 "</Password>"&_
 "</AuthenticationToken>"&_
 "</soap:Header>"& _
 "<soap:Body>"& _
 "<GetYjSqd_All xmlns="&CHR(34)&"http://spring.com"&CHR(34)&">"& _
 "<in0>1</in0>"& _
 "<in1>2007-06-01 00:00:00</in1>"& _
 "<in2>2007-06-06 00:00:00</in2>"& _
 "</GetYjSqd_All>"& _
 "</soap:Body>"& _
 "</soap:Envelope>"
 
 
 Set xmlhttp = server.CreateObject("Msxml2.XMLHTTP")
 xmlhttp.Open "POST",url,false
 xmlhttp.setRequestHeader "Content-Type", "text/xml;charset=gbk"
 xmlhttp.setRequestHeader "HOST","172.17.99.94:8080"
 xmlhttp.setRequestHeader "Content-Length",LEN(SoapRequest)
 xmlhttp.setRequestHeader "SOAPAction", "http://spring.com/GetYjSqd_All"
 xmlhttp.Send(SoapRequest)
 
 If xmlhttp.Status = 200 Then
 
 Set xmlDOC =server.CreateObject("MSXML.DOMDocument")
 Response.write xmlhttp.getResponseHeader("Content-Type")
 xmlDOC.load(xmlhttp.responseXML)
 xmlDOC.save("C:\1.xml")
 
 Else
 Response.Write xmlhttp.Status&"&nbsp;"
 Response.Write xmlhttp.StatusText
 End if
 
 Set xmlDOC = nothing
 Set xmlhttp = Nothing
 
%>