dsoutherland
Programmer
- Feb 26, 2004
- 15
am so new to ASP I'm not sure I am breathing. A company one of my clients deals with provides information over the web. They provided the ASP code for a default web site that is used to communicate with them and I have installed it and coded a VB6 app to provide the interface. Here is the problem. The ASP gets an error "Exception occurred" message. When I respond to the error, the returned XML is not received. Also, the ASP stops via the debugger at the statement and stops the whole process. The guys who supplied the code don't know why and they have been less than helpful. Here is the complete code for the ASP:
<%
'& Response.Write("version 1.0.1" & vbcrlf)
Server.ScriptTimeout = 60000
Dim xmlDoc
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.preserveWhiteSpace = TRUE
IF len(Request("XML") & "" ) > 0 THEN ''*** Error occurs here ***"
' Validate the XML String
xmlDoc.loadXML(Request("XML"))
ELSE
' Validate the XML String
xmlDoc.load(Request)
END IF
IF xmlDoc.parsed THEN
' Send Valid XML to Processor
Dim NodeName
Set xNode = xmlDoc.firstChild
IF NOT xNode IS NOTHING THEN
NodeName = xNode.nodename
IF ucase(xNode.nodename) = "XML" THEN
Set xNode = xNode.NextSibling
END IF
END IF
IF NOT xNode IS NOTHING THEN
NodeName = xNode.nodename
SELECT CASE xNode.nodename
CASE "OrderStatusResponse"
Dim objFSO, intX, fname
set objFSO = Nothing
Set objFSO = CreateObject("Scripting.FileSystemObject")
intX = 0
Do
intX = intX + 1
fname = ("E:\dac\report_received_" & Cstr(intX) & ".xml")
Loop Until objFSO.FileExists(fname) = False
IF Request.TotalBytes > 0 then
Const ForAppending = 8
Set objTextFile = objFSO.OpenTextFile(fname, ForAppending, True)
objTextFile.WriteLine(xmlDoc.xml)
END IF
objTextFile.Close
Response.Write "<XML><Status>ACCEPTED</Status></XML>"
CASE ELSE
Response.Write "<OrderStatusResponse>"
Response.Write "<ErrorDescription>"
Response.Write "<Element>XML Root</Element>"
Response.Write "<Description>ERROR - INVALID TRANSACTION</Description>"
Response.Write "<Code>Posting CSD System - default.asp: Invalid Transaction</Code>"
Response.Write "<Help>Valid transactions are OrderStatusResponse or XML. Contact IT for Help.</Help>"
Response.Write "</ErrorDescription>"
Response.Write "</OrderStatusResponse>"
END SELECT
END IF
ELSE
' Return an Error
Response.Write "<OrderStatusResponse>"
Response.Write "<ErrorDescription>"
Response.Write "<Element>XML</Element><br>"
Response.Write "<Description>XML String could not be parsed:" & xmlDoc.parseError & "</Description><br>"
Response.Write "<Code>Posting CSD System - default.asp: XML not Valid</Code><br>"
Response.Write "<Help>Make sure all tags match and are of the same case.</Help><br>"
Response.Write "</ErrorDescription>"
Response.Write "</OrderStatusResponse>"
Response.Write "<ErrorDescription>"
Response.Write "<Element>XML</Element>"
Response.Write "<Description>XML String could not be parsed:" & xmlDoc.parseError & "</Description>"
Response.Write "<Code>Customer to USIS-CSD System - default.asp: XML not Valid</Code>"
Response.Write "<Help>Make sure all tags match and are of the same case.</Help>"
Response.Write "</ErrorDescription>"
Response.Write "</OrderStatusResponse>"
END IF
%>
Any ideas?????
<%
'& Response.Write("version 1.0.1" & vbcrlf)
Server.ScriptTimeout = 60000
Dim xmlDoc
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.preserveWhiteSpace = TRUE
IF len(Request("XML") & "" ) > 0 THEN ''*** Error occurs here ***"
' Validate the XML String
xmlDoc.loadXML(Request("XML"))
ELSE
' Validate the XML String
xmlDoc.load(Request)
END IF
IF xmlDoc.parsed THEN
' Send Valid XML to Processor
Dim NodeName
Set xNode = xmlDoc.firstChild
IF NOT xNode IS NOTHING THEN
NodeName = xNode.nodename
IF ucase(xNode.nodename) = "XML" THEN
Set xNode = xNode.NextSibling
END IF
END IF
IF NOT xNode IS NOTHING THEN
NodeName = xNode.nodename
SELECT CASE xNode.nodename
CASE "OrderStatusResponse"
Dim objFSO, intX, fname
set objFSO = Nothing
Set objFSO = CreateObject("Scripting.FileSystemObject")
intX = 0
Do
intX = intX + 1
fname = ("E:\dac\report_received_" & Cstr(intX) & ".xml")
Loop Until objFSO.FileExists(fname) = False
IF Request.TotalBytes > 0 then
Const ForAppending = 8
Set objTextFile = objFSO.OpenTextFile(fname, ForAppending, True)
objTextFile.WriteLine(xmlDoc.xml)
END IF
objTextFile.Close
Response.Write "<XML><Status>ACCEPTED</Status></XML>"
CASE ELSE
Response.Write "<OrderStatusResponse>"
Response.Write "<ErrorDescription>"
Response.Write "<Element>XML Root</Element>"
Response.Write "<Description>ERROR - INVALID TRANSACTION</Description>"
Response.Write "<Code>Posting CSD System - default.asp: Invalid Transaction</Code>"
Response.Write "<Help>Valid transactions are OrderStatusResponse or XML. Contact IT for Help.</Help>"
Response.Write "</ErrorDescription>"
Response.Write "</OrderStatusResponse>"
END SELECT
END IF
ELSE
' Return an Error
Response.Write "<OrderStatusResponse>"
Response.Write "<ErrorDescription>"
Response.Write "<Element>XML</Element><br>"
Response.Write "<Description>XML String could not be parsed:" & xmlDoc.parseError & "</Description><br>"
Response.Write "<Code>Posting CSD System - default.asp: XML not Valid</Code><br>"
Response.Write "<Help>Make sure all tags match and are of the same case.</Help><br>"
Response.Write "</ErrorDescription>"
Response.Write "</OrderStatusResponse>"
Response.Write "<ErrorDescription>"
Response.Write "<Element>XML</Element>"
Response.Write "<Description>XML String could not be parsed:" & xmlDoc.parseError & "</Description>"
Response.Write "<Code>Customer to USIS-CSD System - default.asp: XML not Valid</Code>"
Response.Write "<Help>Make sure all tags match and are of the same case.</Help>"
Response.Write "</ErrorDescription>"
Response.Write "</OrderStatusResponse>"
END IF
%>
Any ideas?????