About This Code
Brief Description:
XML Over Http
Contributor:
Andrew Jones
Last Modified:
17 Jun 2002
OpenNTF Disclaimer
All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.
Code / Description
Dim wk As New NotesUIWorkSpace
Dim uidoc As NotesUIDocument
Dim txtURN As String
Set uidoc = wk.CurrentDocument
Dim objSendXMLDOM As Variant
Dim objReceiveXMLDOM As Variant
Dim objXMLHTTP As Variant
Dim objXMLNode As Variant
Dim sentXML As String
Set objSendXMLDOM = CreateObject("Microsoft.FreeThreadedXMLDOM")
Set objXMLHTTP = CreateObject("Microsoft.XMLHTTP")
Set objReceiveXMLDOM = CreateObject("Microsoft.FreeThreadedXMLDOM")
txtURN = "http://testserver/palindrome.asp"
' Load the document using a string - rather than build it with the DOM
(sample shortcut)
sentXML = "<?xml version=""1.0""?><palindrome>" & uidoc.document.txtSend(0) &
"</palindrome>"
uidoc.document.txtSent = sentXML
With objSendXMLDOM
.async = False
.loadXML sentXML
End With
' Send the XML DOM using a POST - note async is OFF
With objXMLHTTP
.open "POST", txtURN, False
.send objSendXMLDOM
End With
' Receive the Document and Parse the Response
With objReceiveXMLDOM
.async = False
.loadXML objXMLHTTP.responseText
Set objXMLNode = .selectSingleNode("response")
End With
uidoc.document.XMLRet = objXMLHTTP.responseText
If objXMLNode.Text = "True" Then
uidoc.Document.IsPalidrome = "0"
Else
uidoc.Document.IsPalidrome = "1"
End If
uidoc.Refresh
Usage / Example