Stine
Stine

Reputation: 9

Classic asp - only receiving part of soap response

I am trying to call a soap request from classic asp (it will be updated at some later point, but for now it stays classic asp), but I'm only getting half of the response?
When I use the request string in SoapUI, I get the response I'm looking for, but in asp I only receive part of the response??


ASP Request:

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 Response:

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

SoapUI response

(made from same request - contains "SearchVisitation" which is the result I need!)

<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>

What am I doing wrong?

Upvotes: 0

Views: 306

Answers (1)

Stine
Stine

Reputation: 9

Turns out that

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

was the part that would cause the request to error (I've - again - triple checked that the urn:action was correct).

Removing it gave me the correct response.

Upvotes: 0

Related Questions