首页 > 解决方案 > 经典的 asp - 只接收肥皂响应的一部分

问题描述

我正在尝试从经典 asp 调用一个肥皂请求(它将在稍后更新,但现在它仍然是经典 asp),但我只得到了一半的响应?
当我在 SoapUI 中使用请求字符串时,我得到了我正在寻找的响应,但在 asp 中我只收到了部分响应?


ASP 请求:

Set oXmlHTTP = CreateObject("Microsoft.XMLHTTP")

oXmlHTTP.Open "POST", "http://webservice-string?wsdl", False 
oXmlHTTP.setRequestHeader "Content-Type", "text/xml; charset=utf-8" 
oXmlHTTP.setRequestHeader "SOAPAction", "urn:action"


SOAPRequest = _
"<?xml version=""1.0"" encoding=""utf-8""?>" &_
"<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:head=""http://header.com"" xmlns:ser=""http://service.com"" xmlns:add=""http://service.com/domain/address"">" &_
   "<soapenv:Header>" &_
      "<head:OnBehalfOfUserId>stine</head:OnBehalfOfUserId>" &_
      "<head:RequestId>?</head:RequestId>" &_
      "<head:AuthenticationHeader>" &_
         "<head:SessionID>?</head:SessionID>" &_
      "</head:AuthenticationHeader>" &_
   "</soapenv:Header>" &_
   "<soapenv:Body>" &_
      "<ser:searchVisitationRequest>" &_
         "<ser:UserId>Stine</ser:UserId>" &_
         "<ser:RequestId>?</ser:RequestId>" &_
         "<add:SomeId>1234</add:SomeId>" &_
      "</ser:searchVisitationRequest>" &_
   "</soapenv:Body>" &_
"</soapenv:Envelope>"


On Error Resume Next
oXmlHTTP.send SOAPRequest   


If Err.Number Then 
    Err.Clear 
Else 
    SOAPResponse = oXmlHTTP.responseXML.text
End If 
On Error Goto 0 

if len(SOAPResponse) > 0 then         
    Response.Write SOAPResponse 
end if

ASP 响应:

2018-06-25T09:56:36.016+02:00server_ID{bla bla}5

SoapUI 响应

(根据相同的请求 - 包含“ SearchVisitation ”,这是我需要的结果!)

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <searchVisitationResponse xmlns="http://service.com">
         <ReplyInfo>
            <ReplyTimestamp>2018-06-25T08:47:48.204+02:00</ReplyTimestamp>
            <ServerId>server_ID</ServerId>
            <StatusMessage>{bla bla}</StatusMessage>
            <TransactionDuration>3</TransactionDuration>
         </ReplyInfo>
         <SearchVisitation>
            <OtherID>12345678</OtherID>
            <SearchVisitationID>
               <SubscriptionNo>Test1</SubscriptionNo> 
            </SearchVisitationID>
         </SearchVisitation>
      </searchVisitationResponse>
   </S:Body>
</S:Envelope>

我究竟做错了什么?

标签: soapasp-classic

解决方案


结果是

oXmlHTTP.setRequestHeader "SOAPAction", "urn:action"

是导致请求出错的部分(我已经 - 再次 - 三重检查urn:action是否正确)。

删除它给了我正确的回应。


推荐阅读