jillallynwilson
Programmer
I need to develop a way to send an XML Request to my application for testing. Currently, the application received the XML request from our customers e-Procecurement site. This works fine, however, I have to rely on them to initiate the request for testing. I would like to create an HTML form using the METHOD=Post option in the form. When I do this and paste in the same XML code that the customer has sent my application I receive the following error:
Parser Error: Invalid at the top level of the document.
If I debug my code I do see that I am getting the encoded XML Request but it will not load in the parser. I am using the Microsoft XMLDOM Parser. I am not sure why it works if the request is received from the customer but not from my test form. Does anyone have any idea what I am doing wrong?
Form code:
<html>
<head>
<title>
Submit XML
</title>
<SCRIPT LANGUAGE="JavaScript">
<!--
function _CF_checkCFForm_1(_CF_this)
{
return true;
}
// -->
</SCRIPT>
</head>
<body>
<div id="Content">
<h1>Submit XML</h1>
<form method="post" name="xmlform" action=" onSubmit="return _CF_checkCFForm_1(this);">
<table>
<tr>
<td valign="top">XML code:</td>
<td><textarea name="cxml-urlencoded" cols="60" rows="15"></textarea></td>
</tr>
</table>
<input type=submit value="Submit">
</form>
</div>
</body>
</html>
Parser code (this code is developed in Lotus Script and run by calling a Lotus Domino agent from the URL):
Sub Initialize
On Error Goto Errhandle
Dim ses As NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim logdoc As NotesDocument
Dim survey As NotesDocument
Dim qs As String
Dim unid As String
Set ses = New NotesSession
Set db = ses.CurrentDatabase
Set survey = ses.DocumentContext
qs = survey.getItemValue("REQUEST_CONTENT")(0)
' Save XML (HTTP POST REQUEST) to Notes database
Set doc = New NotesDocument (db)
doc.form = "RawXMLData"
doc.RawXMLData = qs
'Parse XML data ------------------------------------------------------------------------
Dim xmldoc As Variant
Dim ok As Integer
Dim strLSS As String
Set xmldoc = CreateObject("Microsoft.XMLDOM")
xmldoc.async = False
xmldoc.validateOnParse = False
xmldoc.resolveExternals = False
ok = xmldoc.loadXML(qs)
If ok = False Then
Print "Parser Error: " xmldoc.parseError.reason
Exit Sub
End If
..... more code
Parser Error: Invalid at the top level of the document.
If I debug my code I do see that I am getting the encoded XML Request but it will not load in the parser. I am using the Microsoft XMLDOM Parser. I am not sure why it works if the request is received from the customer but not from my test form. Does anyone have any idea what I am doing wrong?
Form code:
<html>
<head>
<title>
Submit XML
</title>
<SCRIPT LANGUAGE="JavaScript">
<!--
function _CF_checkCFForm_1(_CF_this)
{
return true;
}
// -->
</SCRIPT>
</head>
<body>
<div id="Content">
<h1>Submit XML</h1>
<form method="post" name="xmlform" action=" onSubmit="return _CF_checkCFForm_1(this);">
<table>
<tr>
<td valign="top">XML code:</td>
<td><textarea name="cxml-urlencoded" cols="60" rows="15"></textarea></td>
</tr>
</table>
<input type=submit value="Submit">
</form>
</div>
</body>
</html>
Parser code (this code is developed in Lotus Script and run by calling a Lotus Domino agent from the URL):
Sub Initialize
On Error Goto Errhandle
Dim ses As NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim logdoc As NotesDocument
Dim survey As NotesDocument
Dim qs As String
Dim unid As String
Set ses = New NotesSession
Set db = ses.CurrentDatabase
Set survey = ses.DocumentContext
qs = survey.getItemValue("REQUEST_CONTENT")(0)
' Save XML (HTTP POST REQUEST) to Notes database
Set doc = New NotesDocument (db)
doc.form = "RawXMLData"
doc.RawXMLData = qs
'Parse XML data ------------------------------------------------------------------------
Dim xmldoc As Variant
Dim ok As Integer
Dim strLSS As String
Set xmldoc = CreateObject("Microsoft.XMLDOM")
xmldoc.async = False
xmldoc.validateOnParse = False
xmldoc.resolveExternals = False
ok = xmldoc.loadXML(qs)
If ok = False Then
Print "Parser Error: " xmldoc.parseError.reason
Exit Sub
End If
..... more code