Link to home
Start Free TrialLog in
Avatar of videnda
videnda

asked on

Display a particular node in ASP(VBScript)

I am doing a server http post my code follows:  

Set XMLRequest = Server.CreateObject("MSXML2.ServerXMLHTTP")
XMLRequest.open "POST", "https://gateway.textforce.net/sendsms.cfm", False
XMLRequest.SetRequestHeader "Host", "gateway.textforce.net"      
XMLRequest.SetRequestHeader "Connection", "Keep-Alive"
XMLRequest.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
XMLRequest.send XMLString


The response XML, (XMLRequest.responseXML.XML) is loaded into the DOM.  My code displays all the child nodes values by using a loop:

Set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.loadXML(XMLRequest.responseXML.XML)
Set objNode = xmlDoc.documentelement
For i = 0 To (objNode.childNodes.length)-1
response.write objNode.childNodes.item(i).text & "<br>"
Next

How do I change this, so that I can store a particular node in a string?   I want to store response and transactionID.

This is the XMLRequest.responseXML.XML:

<?xml version="1.0"?>
<SMSMessage>
      <SMSAuthentication>
            <Username>aaaaa</Username>
            <Password>bbbbb</Password>
      </SMSAuthentication>
      <SMSMessageData>
            <Originator>test</Originator>
            <Recipient>447743888888</Recipient>
            <MessageType>0</MessageType>
            <MessageText>test</MessageText>
            <ControlData></ControlData>
      </SMSMessageData>
      <SMSGateway>
            <Response>99</Response>
            <TransactionID></TransactionID>
            <ErrorText>Incorrect Account Details (Username/Password)</ErrorText>
      </SMSGateway>
</SMSMessage>
ASKER CERTIFIED SOLUTION
Avatar of alambres
alambres

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial