logo

Response

« Return to the main article

You are viewing this page out of context. To see it in the context it is intended please click here.

About This Page

Reply posted by David Frahm on Tue 29 Jan 2002 in response to Putting Domino's XML to use

Using MSXML Parser securely

I have been working with MSXML Parser in LotusScript agent for weeks now.
Works great except with secure data. By that I mean that when the MSXML object
requests a url from the domino server, it does not pass the userid/password and
all I get back are documents that an Anonymous user would.


Has anyone found this to be true?


Would you mind posting and/or sending me the code you use for MSXML object
related processing? Here is mine:


Sub Initialize
'This agent uses the MS xml parser and the domino readviewentries url, styled
by xsl, to create html on the server and send it to the browser

' setup error handling
On Error Goto errorHandler
Dim msxmlErrorNumber As Integer
Dim msxmlErrorText As String

' setup variables
Dim source As Variant
Dim style As Variant
Dim sourceURL As String
Dim styleURL As String
Dim result As String

Dim s As New NotesSession
Dim db As NotesDatabase
Dim dbServerNotesName As NotesName
Dim dbServerName As String
Dim dbFilename As String
Dim dbFilePath As String
Dim dbFolderPath As String
Dim dbFilePathURL As String
Dim dbFolderPathURL As String

Set db = s.CurrentDatabase
Set dbServerNotesName = New NotesName(s.CurrentDatabase.Server)
dbServerName = dbServerNotesName.Common

dbFilename = s.CurrentDatabase.FileName
dbFilePath = s.CurrentDatabase.FilePath
dbFolderPath = Left$(dbFilePath , Len(dbFilePath) - Len(dbFileName) )
dbFilePathURL = replaceSubstring(dbFilePath, "\", "/")
dbFolderPathURL = replaceSubstring(dbFolderPath, "\", "/")

' parameters
' these can be either files or urls, however relative URL's don't seem
to work so use absolute URL's
' sourceURL="http://" & dbServerName & "/" & dbFilePathURL &
"/ExampleViewForXMLCategorized?ReadViewEntries&ExpandView&Count=10000"
' styleURL = "http://" & dbServerName & "/" & dbFilePathURL &
"/(XSL_View_Generic)?OpenPage"
' styleURL = "http://" & dbServerName & "/" & dbFilePathURL &
"/(XSL_View_Specific)?OpenPage"


sourceURL="http://localhost/zip/work/xmlenglish.nsf/(ViewForXML)?ReadViewEntries
&ExpandView&Count=10000"
styleURL =
"http://localhost/zip/work/xmlenglish.nsf/(XSL_CategorizedView)?OpenPage"

' load the XML
Set source = CreateObject("Microsoft.XMLDOM")
source.async = False
source.load(sourceURL)

' load the XSL
Set style = CreateObject("Microsoft.XMLDOM")
style.async = False
style.load(styleURL)

' url is property of DOMDocument that shows last successfully loaded
document
' Print "source = " & source.url & "<br />" ' debug
' Print "style = " & style.url & "<br />" ' debug

' minor error checking...
If Not(source.parseError.errorCode = 0) Then
msxmlErrorNumber = source.parseError.errorCode
msxmlErrorText = source.parseError.reason
Error msxmlErrorNumber , msxmlErrorText
Else
' transform source
result = source.transformNode(style)
End If

Stop

' output transformed result
Print "content-type: text/html"
Print result
' Print "end" ' debug

Exit Sub

errorHandler:
' no context doc, so just print to the screen/browser
Print "Line# " & Erl() ", Error # " & Err() & ": """ & Error() & """"
Exit Sub

End Sub