ASP Classic,SOAP / XML请求和响应

时间:2015-11-10 10:51:27

标签: xml soap vbscript asp-classic xmlhttprequest

相当新的,所以请耐心等待。

我已经将此作为请求

POST /weblordinterface/interface.asmx HTTP/1.1
Host: weblord-test.toshiba-tro.de
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <_getCaseById xmlns="http://weblord.toshiba-tro.de/">
      <sIdCase>string</sIdCase>
      <sUser>string</sUser>
      <sPassword>string</sPassword>
    </_getCaseById>
  </soap12:Body>
</soap12:Envelope> 

来自servicve提供商,这是一个回复

HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <_getCaseByIdResponse xmlns="http://weblord.toshiba-tro.de/">
      <_getCaseByIdResult>xml</_getCaseByIdResult>
    </_getCaseByIdResponse>
  </soap12:Body>
</soap12:Envelope>

我已经写了一个ASP页面,其中有IDcase /用户/密码转发给我,我知道这部分可以工作,因为我可以在屏幕上显示所有3个。

我的代码是: -

<%

dim sUser 
dim sPassword
dim sIdCase

sIdCase=Request.QueryString("sIdCase")
sPassword=Request.QueryString("sPassword")
sUser=Request.QueryString("sUser")

Dim objXMLHTTP 
set objXMLHTTP = server.Createobject("MSXML2.ServerXMLHTTP.3.0") 

Dim strRequest, strResult, 


strRequest ="<?xml version='1.0' encoding='utf-8'?><soap12:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'  xmlns:xsd='http://www.w3.org/2001/XMLSchema'  xmlns:soap12='http://www.w3.org/2003/05/soap-envelope'>" _
& "    <soap12:Body><_getCaseById xmlns='http://weblord.toshiba-tro.de/'><sIdCase>" & sIdCase & "</sIdCase>" _
& "            <sUser>" & sUser & "</sUser> <sPassword>" & sPassword & "</sPassword></_getCaseById></soap12:Body></soap12:Envelope>"
objXMLHTTP.open "POST", "http://weblord.toshiba-tro.de/weblordinterface/interface.asmx" , true
objXMLHTTP.setRequestHeader "User-Agent","HTTP/1.1"
objXMLHTTP.setRequestHeader "Host","weblord-test.toshiba-tro.de"
objXMLHTTP.setRequestHeader "Content-Type", "application/soap+xml; charset=utf-8"
objXMLHTTP.setRequestHeader "Content-Length", Len(strRequest)
'objXMLHTTP.setRequestHeader "SOAPAction", "http://weblord.toshiba-tro.de/"

objXMLHTTP.send(strRequest)


If objXMLHTTP.status = 200 Then
    TextResponse = objXMLHTTP.responseText
    XMLResponse = objXMLHTTP.responseXML
    StreamResponse = objXMLHTTP.responseStream
Else
    response.write("we have an error")
End If

Set objXMLHTTP = Nothing


%>

有人可以告诉我如何获得响应并显示它,我似乎在

时出错了
If objXMLHTTP.status = 200 Then

  

msxml3.dll错误'8000000a'

     

尚未提供完成此操作所需的数据。

你们其中一位专家可以帮忙吗

2 个答案:

答案 0 :(得分:2)

您在打开连接时指定了异步请求。因此,后续代码中尚未提供数据。改为将其更改为同步请求。

即。改变了......

objXMLHTTP.open "POST", "http://weblord.toshiba-tro.de/weblordinterface/interface.asmx" , true

......对此...

objXMLHTTP.open "POST", "http://weblord.toshiba-tro.de/weblordinterface/interface.asmx" , false

答案 1 :(得分:0)

想出来的人

主持人:weblord-test.toshiba-tro.de

是给出的,我发布到

objXMLHTTP.open&#34; POST&#34;,&#34; http://weblord.toshiba-tro.de/weblordinterface/interface.asmx&#34;

一旦我添加了-test,现在就可以了。