0

I am trying to post a xml to bank. it returns me xml response.

i am using this code:

Function HTTPPost(sUrl, sRequest)
  set oHTTP = CreateObject("Microsoft.XMLHTTP")
  oHTTP.open "POST", sUrl,false
  oHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
  oHTTP.setRequestHeader "Content-Length", Len(sRequest)
  oHTTP.send sRequest
  HTTPPost = oHTTP.responseText  
End Function

sonuc = HTTPPost(serviceUrl, requestXML)
Dim objXMLDoc
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False
objXMLDoc.load(sonuc)           
Dim Node
Set Node = objXMLDoc.documentElement.selectSingleNode("//RRN")
Response.write Node.text

I am trying to retrieve

<RRN>218323000090</RRN>

This errors with Object Required: 'documentElement'

This is bank response:

 <?xml version="1.0" encoding="utf-16"?>
    <PosResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <Host>
        <AuthCode />
        <RRN>218323000090</RRN>
        <Date>0701</Date>
        <Time>230834</Time>
        <RC>58</RC>
      </Host>
      <Result>
        <Code>58</Code>
        <Text />
        <ErrorMessage />
      </Result>
      <TrnxID>842c0d26-3abd-4597-ba10-d92674e16303</TrnxID>
      <TrnxType>Sale</TrnxType>
      <CustomData>
        <Item Name="KazanilanPuan" Value="0" />
        <Item Name="KalanPuan" Value="0" />
        <Item Name="HarcananPuan" Value="0" />
        <Item Name="HarcananPara" Value="0" />
      </CustomData>
    </PosResponse>
user510886
  • 19
  • 1
  • 4

1 Answers1

2

You should use loadXML instead load to load an xml of string.
In addition check out these also :

Which version of MSXML should I use?

difference between server.createObject and createobject in asp classic

Community
  • 1
  • 1
Kul-Tigin
  • 16,728
  • 1
  • 35
  • 64