Code Reference A collection of code for my reference (and perhaps other people too)

31May/100

POST using ASP

A more simple way to to a POST. This is cleaner than the last example I created.

I used a nice function at http://www.secretgeek.net/XMLSendReceive.shtml.

' First load the XML to send off
Set SendDoc = server.createobject("Microsoft.XMLDOM")
SendDoc.ValidateOnParse= True
SendDoc.LoadXML(sTrData) 

' Then call the POST function and get a nice object back
set SourceObj = xmlSend (sURL, SendDoc)

Reading the XML:

set oUid = SourceObj.documentElement.selectSingleNode("//UserId")
set oHtml = SourceObj.documentElement.selectSingleNode("//User/Name")

Here is the nifty little function

    private function xmlsend(url, docSubmit)
        Set poster = Server.CreateObject("MSXML2.ServerXMLHTTP")
        poster.open "POST", url, false
        poster.setRequestHeader "CONTENT_TYPE", "text/xml"
        poster.send docSubmit
        Set NewDoc = server.createobject("Microsoft.XMLDOM")
        newDoc.ValidateOnParse= True
        newDoc.LoadXML(poster.responseTEXT)

        Set XMLSend = NewDoc
        Set poster = Nothing
    end function
Tagged as: Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

No trackbacks yet.