Prev: Pure ASP Upload - script unable to redirect for larger files
Next: ASP access to Data on Remote devices
From: c676228 on 25 Aug 2008 22:16 Hi Anthony, >Do you have > other code prior to the above which reads the Request object? Thank you, thank you, thank you!!!!! It is all because my cut and paste problems and I have the following code in different files --->meaning I have xmlDoc.Load Request statement two times. And I never know this will cause this deadly error. Besides I never know that Request stream doesn't support reset position. You are my life saver. I have been pulling my hair for 3 days and don't know what to do. :=))) Set xmlDoc=Server.CreateObject("MSXML2.DOMDocument.3.0") '8/23/2008 xmlDoc.async = false xmlDoc.Load Request '--this is for xml sent via body 'xmlDoc.LoadXML Request("xml") '--this is for xml sent via form field xml="xml string", squreMouth production version Response.ContentType = "text/xml" '--for testing program If xmlDoc.parseError.errorCode <> 0 Then 'Response.write("Error code: " + xmlDoc.parseError.errorCode) 'Response.write("<br />Error reason: " + xmlDoc.parseError.reason) 'Response.write("<br />Error line: " + xmlDoc.parseError.line) Call UpdateXMLResponse(orderID, "False", "XML", "error code: " &xmlDoc.parseError.errorCode & " reason: " &xmlDoc.parseError.reason &" line #: " &xmlDoc.parseError.line , "") End If IF isNULL(xmlDoc) Then Set InstreamXMLRoot=Nothing Call UpdateXMLResponse(orderID, "False", "XML", "The server didn't receive the XML stream", "") END IF Betty "Anthony Jones" wrote: > "c676228" <betty(a)newsgroup.nospam> wrote in message > news:F2E0D6F8-0B62-4252-AF14-96D22F4DAA86(a)microsoft.com... > > Anthony, > > > > Yes, I followed your directions and here is the new code. The funny part > is > > I think i used the same way as I coded before and how come it suddenly > > doesn't work any more. > > Now I tried to debug the xml file step by step. so my xml file first will > > look like this: > > > > <?xml version="1.0" encoding="UTF-8" ?> > > <enrollment orderID="200808251114527143" PONumber="50000" > marketingCode="E" > > productName="adventureCenter"> > > </enrollment> > > > > Ok, no xml needs a top element error message. > > > > so I changed the xml file to: > > > > <?xml version="1.0" encoding="UTF-8" ?> > > <enrollment orderID="200808251114527143" PONumber="50000" > marketingCode="E" > > productName="adventureCenter"> > > <test>Y</test> > > </enrollment> > > > > Only one extra line: <test>Y</test> besides the top element. > > Now it complains again: > > <xmlResponse> > > <isSuccess>False</isSuccess> > > <errorField>XML</errorField> > > ? > > <errorMessage> > > error code: -1072896680 reason: XML document must have a top level > element. > > line #: 0 > > </errorMessage> > > <policyNumber/> > > </xmlResponse> > > > > > > It seems it only takes a top level element xml file, as soon as I add one > > more line to the xml file, it starts to complain. I don't get it. > > > > '************************************* > > Server side: > > '************************************* > > Dim xmlDoc, InstreamXMLRoot, TestFlag > > Set xmlDoc=Server.CreateObject("MSXML2.DOMDocument.3.0") '8/23/2008 > > xmlDoc.async = false > > xmlDoc.Load Request '--this is for xml sent via body > > > > Response.ContentType = "text/xml" '--for testing program > > > > If xmlDoc.parseError.errorCode <> 0 Then > > Call UpdateXMLResponse(orderID, "False", "XML", "error code: " > > &xmlDoc.parseError.errorCode & " reason: " &xmlDoc.parseError.reason &" > line > > #: " &xmlDoc.parseError.line , "") > > End If > > > > IF isNULL(xmlDoc) Then > > Set InstreamXMLRoot=Nothing > > Call UpdateXMLResponse(orderID, "False", "XML", "The server didn't receive > > the XML stream", "") > > > > END IF > > > > Set InstreamXMLRoot=xmlDoc.documentElement > > IF isNULL(InstreamXMLRoot) Then > > Set InstreamXMLRoot=Nothing > > Call UpdateXMLResponse(orderID, "False", "XML", "The server didn't receive > > the XML stream", "") > > > > END IF > > 'Save all info before any transaction > > xmlDoc.Save(Server.MapPath("B2BResponse/" & hour(now) & "_" & minute(now) > & > > "_" & RandomNumber(1000000) & "_" & month(now) & "_" & day(now) & "_" & > > year(now) &"_B2BResponse.xml")) > > 'check if this is production transaction > > Call UpdateXMLResponse(orderID, "False", "XML", "The server received the > XML > > stream", "") > > > > > Hmm... perplexing. Are we seeing all the Server code here? Do you have > other code prior to the above which reads the Request object? Note the > Request stream doesn't support reseting position to the beginning, therefore > once read, it cannot be read again. If you have already consumed the > request stream elsewhere I suspect your code would respond in the way you > are seeing. > > > -- > Anthony Jones - MVP ASP/ASP.NET > > >
First
|
Prev
|
Pages: 1 2 3 Prev: Pure ASP Upload - script unable to redirect for larger files Next: ASP access to Data on Remote devices |