首先让我说,到目前为止,我从未接触过经典ASP。我使用带有UserName身份验证的basicHttpBinding创建了一个WCF服务。客户说当他在NeoLoad上测试它时,下面的代码工作,但当他把它放在IIS服务器上时,他开始得到400错误请求错误。我环顾四周,现在已经打了2天了,我找不到这个问题的答案。任何帮助将不胜感激,并提前感谢。
<%
Dim SOAPResponse, SOAPRequest, serviceUrl, strResult
serviceUrl = ""
Response.Write "Creating XML Object<br>" & vbCrLf
Dim oXmlHTTP : Set oXmlHTTP = CreateObject("MSXML2.ServerXMLHTTP")
SOAPRequest = "<?xml version=""1.0"" encoding=""UTF-8""?>"
SOAPRequest = SOAPRequest & "<s:Envelope xmlns:s=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:u=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"">"
SOAPRequest = SOAPRequest & "<s:Header>"
SOAPRequest = SOAPRequest & "<o:Security s:mustUnderstand=""1"" xmlns:o=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"">"
SOAPRequest = SOAPRequest & "<u:Timestamp u:Id=""_0"">"
SOAPRequest = SOAPRequest & "<u:Created>2014-12-04T20:13:37.744Z</u:Created>"
SOAPRequest = SOAPRequest & "<u:Expires>2014-12-04T20:18:37.744Z</u:Expires>"
SOAPRequest = SOAPRequest & "</u:Timestamp>"
SOAPRequest = SOAPRequest & "<o:UsernameToken u:Id=""UsernameToken-5"">"
SOAPRequest = SOAPRequest & "<o:Username>"
SOAPRequest = SOAPRequest & ""
SOAPRequest = SOAPRequest & "</o:Username>"
SOAPRequest = SOAPRequest & "<o:Password>"
SOAPRequest = SOAPRequest & ""
SOAPRequest = SOAPRequest & "</o:Password>"
SOAPRequest = SOAPRequest & "</o:UsernameToken>"
SOAPRequest = SOAPRequest & "</o:Security>"
SOAPRequest = SOAPRequest & "<To s:mustUnderstand=""1"" xmlns=""http://schemas.microsoft.com/ws/2005/05/addressing/none"">""""</To>"
SOAPRequest = SOAPRequest & "<Action s:mustUnderstand=""1"" xmlns=""http://schemas.microsoft.com/ws/2005/05/addressing/none"">""http://tempuri.org/ISLAServiceSandbox/SaveEntry""</Action>"
SOAPRequest = SOAPRequest & "</s:Header>"
SOAPRequest = SOAPRequest & "<s:Body>"
SOAPRequest = SOAPRequest & "<SaveEntry xmlns=""http://tempuri.org/"">"
SOAPRequest = SOAPRequest & "<request xmlns:a=""http://schemas.datacontract.org/2004/07/IDOI.Ams.Taxes.Web.Domain"" xmlns:i=""http://www.w3.org/2001/XMLSchema-instance"">"
SOAPRequest = SOAPRequest & "</request>"
SOAPRequest = SOAPRequest & "</SaveEntry>"
SOAPRequest = SOAPRequest & "</s:Body>"
SOAPRequest = SOAPRequest & "/s:Envelope>"
oXmlHTTP.Open "POST", serviceUrl, False
oXmlHTTP.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
oXmlHTTP.setRequestHeader "Content-Length", Len(SOAPRequest)
oXmlHTTP.setRequestHeader "SOAPAction", "http://tempuri.org//SaveEntry"
'send the request and capture the result
Call oXmlHTTP.send(SOAPRequest)
Response.Write "Status: " & oXmlHTTP.Status & " - " & oXmlHTTP.statusText & "<br>" & vbCrLf
Response.Write strResult
%>
<%= strResult %>
答案 0 :(得分:1)
好的,所以写这段代码的顾问弄清楚了。事实证明这只是一些错位的代码。而不是
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"
应该是
<s:Envelope xmlns:s=""http://schemas.xmlsoap.org/soap/envelope/"
感谢任何人花时间看这个。