首页 > 学院 > 开发设计 > 正文

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

2019-11-17 04:10:34
字体:
来源:转载
供稿:网友
<%
 '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
 
%>
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表