【问题标题】:ASP Classic, SOAP / XML Request and responseASP Classic、SOAP/XML 请求和响应
【发布时间】:2016-02-11 05:33:29
【问题描述】:

对这个比较陌生,所以请多多包涵。

我已收到此请求

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> 

来自服务提供商,这是一个响应

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'

完成此操作所需的数据尚不可用。

请各位专家帮忙

【问题讨论】:

    标签: xml soap vbscript asp-classic xmlhttprequest


    【解决方案1】:

    想通了

    主机:weblord-test.toshiba-tro.de

    是给的,我在发帖

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

    一旦我在其中添加了-test,它现在就可以工作了。

    【讨论】:

      【解决方案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
      

      【讨论】:

      • 谢谢约翰,我已经尝试过异步和同步,同步状态显示为 403。
      • 需要同步。 403状态未授权,表示您连接的凭据无效,或者您正在访问的计算机需要列入白名单。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多