Ich versuche, eine Antwort von einem ASP.NET-Webservice zu erhalten, ohne die GET-Parameter zu verwenden. Ich habe den folgenden Code.
strBarcode = "ABC123"
strURL ="http://serverName/BarcodeGenerator.asmx"
Set xmlReq = Server.CreateObject("Msxml2.DOMDocument.3.0")
Set xmlResp = Server.CreateObject("Msxml2.DOMDocument.3.0")
Set httpReq = Server.CreateObject("MSXML2.ServerXMLHTTP")
xmlReq.async = false
strXML = CStr(CreateRequest(strBarcode))
xmlReq.loadXML(CStr(strXML))
//Öffnen, asynchron
httpReq.open "POST", CStr(strURL), true
httpReq.setRequestHeader "Host", "serverName"
httpReq.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
httpReq.setRequestHeader "SOAPAction", "http://tempuri.org/GetBarcode"
httpReq.send(xmlReq)
strDone = "0"
bTimeout = false
dStart = Now()
dEnd = Now()
lCounter = 0
lCounterPrev = -1
intStatus = 0
Do while intStatus <> 4 and (Not bTimeout)
dEnd = Now()
lCounter = DateDiff("s",dStart,dEnd)
if lCounter > 30 then bTimeout = True
%>. <%
'Warte eine Sekunde
httpReq.waitForResponse 1000
intStatus = httpReq.readyState
Loop
If httpReq.readyState = 4 Then
bTimeout = false
Set xmlResp = httpReq.responseXML
%>
Status: <%=httpReq.statusText%>
Response: <%=httpReq.responseText%>
<%
Set nodes = xmlResp.getElementsByTagName("GetBarcodeResult")
If (nodes is nothing) THen
%>Nodes is NULL<%
Else
%>Anzahl der Knoten: <%=nodes.length%><%
End IF
Set node = nodes(0)
url = node.nodeValue
End If
Der Status lautet:
Status: Bad Request
und die Antwort lautet:
Response: Bad Request (Ungültiger Hostname)
Was mache ich falsch?