473,408 Members | 1,960 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

XML Nightmare from C# to ASP

Cannot read the XML response from my C# app with regular ASP unless I save it to a file first. The workaround is not acceptable. I should be able to load, read, and extract the data from the XML response.

Error received = “424 Object required” whenever I try performing “selectSingleNode" against the XML Dom Document in my ASP.

I've heard mentioned that the C# HTTP header is included in the XML response, and I’ve sense tried changing it but with no improvement.

I’ve spent what seems like months trying to find a solution. I’ve tried every type of Google search imaginable. Microsoft won’t help me. Can you see anything wrong, or do you know an XML guru who can? The code is so simple.

Expand|Select|Wrap|Line Numbers
  1. (C#)
  2. try {
  3.     Response.ClearContent();
  4.     Response.ContentType = "text/xml";
  5.     XmlTextWriter xtWriter = new XmlTextWriter(Response.Output);
  6.     xtWriter.WriteStartDocument();
  7.     xtWriter.WriteStartElement("DocMergeResponse");
  8.     xtWriter.WriteStartElement("Document");
  9.     xtWriter.WriteAttributeString("dt:dt", "bin.base64");
  10.     xtWriter.WriteAttributeString("LoanNumber", gsLoanNumber); //Global string
  11.     xtWriter.WriteAttributeString("xmlns:dt", "urn:schemas-microsoft-com:datatypes");
  12.     xtWriter.WriteBase64(gBinaryData, 0, gBinaryData.Length); //Global byte array
  13.     xtWriter.WriteEndElement();
  14.     xtWriter.WriteEndElement();
  15.     xtWriter.WriteEndDocument();
  16.     xtWriter.Close();            
  17. }
  18. catch(Exception xmlErr) {
  19.     ProcessProgError("Failed to create XML response" + CRLF + xmlErr.ToString());
  20.     return;
  21. }
  22. (/C#)
  23.  
  24. (ASP)
  25. '// POST the XML document on the my C# app.
  26. Set objSXH = server.createobject("msxml2.serverxmlhttp")
  27. objSXH.open "POST", serverString & "/DocMerge/Default.aspx", False
  28. objSXH.SetRequestHeader "Content-Type", "text/xml"
  29. objSXH.send objXMLRequest.xml   '// XML post 
  30.  
  31. 'XML IS NOW POSTED - LOOK FOR RESPONSE
  32. strResponse = ""
  33. strResponse = objSXH.ResponseText    '// Get the response.
  34. objXMLDoc.load (strResponse)            ‘//LOAD XML from .NET app.
  35.  
  36. ‘//ERROR TRAPPED ON NEXT STATEMENT
  37. Response.Write objXMLDoc.selectSingleNode("/DocMergeResponse/Document/@LoanNumber").nodeTypedValue
  38. If Err <> 0 then
  39.   Response.Write "ERROR: " & sProgramName & " - TEST failed - " & Err.Number & " " & Err.Description
  40.   Response.End
  41. End If
  42. (/ASP)
Thanks again for your help.
Mar 7 '07 #1
1 1416
kenobewan
4,871 Expert 4TB
I believe that you have an ASP problem using your selectSingleNode. What happens if you try:
Expand|Select|Wrap|Line Numbers
  1. Response.Write objXMLDoc.selectSingleNode("LoanNumber").nodeTypedValue
Mar 8 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Drisco | last post by:
Hello, I realy need help,Searched the NG for a days with no vail. Sorry for the long script. I am trying to get a variable from php to flash. I have the following code in php <a...
0
by: Deena | last post by:
Hi Windows forms layout is turning to be a nightmare. I add my controls to a form and then save it and then it just get's all messed up. I'm using inheritance if this makes any difference. Also...
4
by: Dave | last post by:
Hello All, I am having a nightmare trying to add a new row to my Datagrid. When I use the code below I get the error: 'Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount. Can...
6
by: Jim Mirra | last post by:
Hey, I have been working on this for a while now and I keep getting the same error. here is my code: ------- start code --------- Dim strSQL = "Select tagid,itemid,description,status,...
2
by: Afshar | last post by:
Dear nice people around the world! Please help ending this nightmare, I have 2 problem with ASP.NET Menu control First: I have a horizontal menu at top of my page, each item have some sub-items...
3
by: Samuel Shulman | last post by:
I get the following error Error 2 Could not load file or assembly 'RusticiSoftware.ScormContentPlayer.Logic, Version=2006.1.2576.40320, Culture=neutral,...
10
by: Andrew Wan | last post by:
I have been having a nightmare with ASP/ASP.NET & IIS6. We use Msxml2.DOMDocument.4.0 object to create a XML object in ASP. The Msxml2.DOMDocument.4.0 is from the Windows Platform SDK Feb 2003...
1
by: =?Utf-8?B?TWVyZGFhZA==?= | last post by:
I am using ASP.NET 2.0 C# I am getting errors when I publish my site. It works fine on our local server. Pages that have maintainscrollpositiononpostback=true set, get errors such as:...
2
by: Phillip Taylor | last post by:
I'm having an absolute nightmare with regular diff tools which is making it really hard to manage changes etc in CVS. Tools such as WinMerge and ViewCVS really have really poor matching results...
6
by: Widge | last post by:
I'm having a nightmare. I've used this technique before and can't understand why I'm getting an error using it now. Basically I have a form, on that is a sub form datasheet. What I am eventually...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.