我正在尝试从经典asp调用soap请求(稍后会更新,但现在仍然是经典asp),但是我只得到了一半的响应?
当我在SoapUI中使用请求字符串时,得到了我正在寻找的响应,但是在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
2018-06-25T09:56:36.016 + 02:00server_ID {bla bla} 5
(根据相同的请求进行-包含“ 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>
我在做什么错了?
答案 0 :(得分:0)
证明
oXmlHTTP.setRequestHeader "SOAPAction", "urn:action"
是会导致请求出错的部分(我-再次-三次检查urn:action
是正确的)。
删除它会给我正确的答案。