我用下面的代码,不管strXML的内容是什么,都返回通过浏览器直接访问接口地址所显示的内容
通过测试工具能链接成功,请问各位,我的程序什么地方有问题
<%
dim strHost,strURL,strAction,strXML,strRequest
strHost="172.22.31.29"
strURL="http://"&strHost&":80/csp/I-PAY//DHC.PAY.BS.PAYHisWebservice.cls?wsdl"'
strAction="http://tempuri.org/DHC.PAY.BS.PAYHisWebservice.GetPatInfo"
strRequest=""
'strRequest="Input="
strRequest=strRequest&"<Request><TradeCode>3300</TradeCode><PatientCard>0120781244</PatientCard><CardType>01</CardType><HospitalId>2</HospitalId>"
strRequest=strRequest&"<ExtUserID>cs001</ExtUserID><TerminalID>hj0001</TerminalID></Request>"
strXML=""
strXML=strXML&"<?xml version='1.0' encoding='utf-16'?>"
strXML=strXML&"<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>"
strXML=strXML&"<soap:Body>"
strXML=strXML&"<GetPatInfo xmlns='http://tempuri.org'>"
strXML=strXML&"<Input>"&strRequest&"</Input>"
strXML=strXML&"</GetPatInfo>"
strXML=strXML&"</soap:Body>"
strXML=strXML&"</soap:Envelope>"
strXML=strRequest
Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
objHTTP.open "POST", strURL, False
objHTTP.setOption 2, 13056
objHTTP.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
objHTTP.setRequestHeader "Content-Length",LEN(strURL)
objHTTP.setRequestHeader "SOAPAction", strAction
objHTTP.send (strXML)
If objHTTP.Status=200 Then
Dim PageResponseTime
Set objXML = CreateObject("MSXML2.DOMDocument")
objXML.async=False
objXML.Load(objHttp.responseXML)
'这里是返回的是错误信息
If objXML.parseError.errorCode <> 0 Then
'错误
Response.Write objXML.parseError.errorCode &vbcrlf
Response.Write objXML.parseError.filepos &vbcrlf
Response.Write "Line: "&objXML.parseError.Line&": "&objXML.parseError.linepos &vbcrlf
Response.Write "Reason: "&objXML.parseError.reason&vbcrlf
Response.Write "Error Data: "&objXML.parseError.srcText
Else
'--Nback以下是测试信息
Set objFlight=objXML.getElementsByTagName("input")
Response.Write(objFlight.length&"<br>")
Set objFlight=objXML.getElementsByTagName("Response")
Response.Write(objFlight.length&"<br>")
xmlStr = objXML.xml
xmlStr = Replace(xmlStr,"<","<")'--Nback
xmlStr = Replace(xmlStr,">",">")'--Nback
xmlStr = Replace(xmlStr,"<","<")'--Nback
xmlStr = Replace(xmlStr,">",">")'--Nback
Response.Write "<pre>"&xmlStr&"</pre>"'--Nback
End If
Else
Response.Write "调用webservice失败"
End If
%>
通过测试工具WebServiceStudio传送的XML
<?xml version="1.0" encoding="utf-16"?>
soap:Body
<Request><TradeCode>3300</TradeCode><PatientCard>0120781244</PatientCard><CardType>01</CardType><HospitalId>2</HospitalId><ExtUserID>cs001</ExtUserID><TerminalID>hj0001</TerminalID></Request>
/soap:Body
/soap:Envelope
通过测试工具WebServiceStudio传送的相关参数