oibo8x / subsonicproject

Automatically exported from code.google.com/p/subsonicproject
0 stars 0 forks source link

Error Executing Stored Procedure through RESTHandler with JSON Title is required #45

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

What steps will reproduce the problem?
1. Create a stored procedure to return a dataset.
2. Execute the stored procedure via JSON call to get results to JSON.
3. Errors out on a XMLDocument.LoadXML call

What is the expected output? What do you see instead?
Expected output is stored procedure results to JSON.

Instead I receive an error:
"Name cannot begin with the '>' character, hexadecimal value 0x3E. Line 2, 
position 4."  RESTHandler LINE 165

What version of the product are you using? On what operating system?
Release 2.1 and Build 485 
Windows XP
Windows 2003 Server 
.NET Framework 3.5 SP1

Please provide any additional information below.

Using Build 485 I may have come across a bug in using the RESTHandler with 
a Stored Procedure and returning JSON.

I have set up and configured the RESTHandler correctly and test working 
against tables and views return JSON as expected (albeit with some issues 
like double escaping, but those can be overcome more easily). The .json 
extension is mapped properly through IIS.

I am making a call to the RESTHandler via a url such as : 
http://localhost/services/storedprocname/exec.json?parametername=value

The stored procedure executes and data is returned to the Dataset (that is 
then passed internally in Subsonic to the RESTHandler for additional 
processing).

Stepping through the source I get an error in the RESTHandler at line 165 
at the point the XML (returned from the DataSet.GetXML() call on line 189) 
is being read as XML via an XMLDocument.LoadXML() call. The error message 
is:

"Name cannot begin with the '>' character, hexadecimal value 0x3E. Line 2, 
position 4."

The offending XML returned by the dataset (a .NET Framework Dataset.GetXML
() call) looks like this: 

<S>
<>
<ID>43</ID>
<Code>000043</Code>
<First_name>firsttest</First_name>
<Middle_name>c</Middle_name>
<Last_name>lname</Last_name>
<Email>testemail@testaddress.com</Email>
<Initials>ABC</Initials>
<Username>testuser</Username>
<Password>XXXXXXXX</Password>
<created_Date>2008-10-03T09:16:19.09-05:00</created_Date>
<Last_Login>2008-11-09T18:51:49-06:00</Last_Login>
<Login_Count>57</Login_Count>
<Status>1</Status>
</>
</S>

The error is on the empty tag.

Please advise. 

Original issue reported on code.google.com by bc...@rocketmail.com on 20 Nov 2008 at 11:13

GoogleCodeExporter commented 9 years ago
I can't repro this - here's my test code:

            string result = Northwind.SPs.TenMostExpensiveProducts().GetDataSet
().GetXml();
            XmlDocument xdoc = new XmlDocument();
            xdoc.LoadXml(result);
            string json=SubSonic.Parser.XmlToJSONParser.XmlToJSON(xdoc);

            Assert.IsTrue(json.Length > 0);

I'm going to suggest it's a data-related error. From the looks of it you have 
an 
empty row returned that is choking the parser.

Original comment by robcon...@gmail.com on 9 Apr 2009 at 2:11

GoogleCodeExporter commented 9 years ago

Original comment by robcon...@gmail.com on 9 Apr 2009 at 2:11