473,396 Members | 2,039 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,396 software developers and data experts.

Repost: Problem Retrieving DataSet Returned By A WebService

Hi,

I'm working on a project which includes WebServices and Windows Form
application.

The Windows Form application will call the WebServices to retrieve data from
database. The data will be returned as DataSet.

Now, here's the problem. On .NET Framework 1.1, if any rows in the dataset
returned contain errors (marked by calling the SetColumnError() method or
setting the RowError property of the DataRow), I get the following error
message in the Windows Form application,

"There is an error in XML doument (1,xxxxxxx)"

If I forced the Windows Form application to run on .NET Framework 1.0,
everything works fine.

Is this a bug? Or I need to make some code adjustment because of changes to
the Framework?

Here's the partial code for the WebService project

Code:

<WebMethod()> _
Public Function RetrieveDataSet() As DataSet
Dim ds As New DataSet
Dim dt As New DataTable
Dim row As DataRow
Dim i As Integer

dt.TableName = "TestTable"
dt.Columns.Add("TestColumn1", GetType(String))
dt.Columns.Add("TestColumn2", GetType(Integer))

ds.DataSetName = "TestDataSet"
ds.Tables.Add(dt)

For i = 0 To 10
row = dt.NewRow
row("TestColumn1") = "This is row " & i
row("TestColumn2") = i
dt.Rows.Add(row)

' The following code trigger the error after the DataSet
' is returned to the calling Window Form application
row.SetColumnError("TestColumn1", "Error message here")
Next

Return ds
End Function

For the Windows Form application, you need to insert a datagrid control
(assumed as datagrid1). It will look something like this,

Code:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim ws As localhost.Service1
Dim ds As DataSet

Try
ws = New localhost.Service1
ds = ws.RetrieveDataSet

Me.DataGrid1.SetDataBinding(ds.Tables(0), "")
Catch ex As Exception
MsgBox(ex.Message)
Finally
If (Not (ws Is Nothing)) Then
ws.Dispose()
End If
End Try
End Sub

I really hope someone could help me out with this one.

Thanks in advance.

Jul 19 '05 #1
6 2210
I am interested in this also as I saw the same behaviour when I was trying
to utilize rowerrors to set/retrieve error codes/messages from procedures in
the database. Dataset worked fine as long as it was not returned through a
web service. When used in a web service, if I cleared all row errors, then
no problem but if I set one, then I got the same basic problem you have
mentioned (error in xml). It almost has to be a serialization issue.

Roger

"Programatix" <pr*********@nospam.com> wrote in message
news:Oz**************@tk2msftngp13.phx.gbl...
Hi,

I'm working on a project which includes WebServices and Windows Form
application.

The Windows Form application will call the WebServices to retrieve data from database. The data will be returned as DataSet.

Now, here's the problem. On .NET Framework 1.1, if any rows in the dataset
returned contain errors (marked by calling the SetColumnError() method or
setting the RowError property of the DataRow), I get the following error
message in the Windows Form application,

"There is an error in XML doument (1,xxxxxxx)"

If I forced the Windows Form application to run on .NET Framework 1.0,
everything works fine.

Is this a bug? Or I need to make some code adjustment because of changes to the Framework?

Here's the partial code for the WebService project

Code:

<WebMethod()> _
Public Function RetrieveDataSet() As DataSet
Dim ds As New DataSet
Dim dt As New DataTable
Dim row As DataRow
Dim i As Integer

dt.TableName = "TestTable"
dt.Columns.Add("TestColumn1", GetType(String))
dt.Columns.Add("TestColumn2", GetType(Integer))

ds.DataSetName = "TestDataSet"
ds.Tables.Add(dt)

For i = 0 To 10
row = dt.NewRow
row("TestColumn1") = "This is row " & i
row("TestColumn2") = i
dt.Rows.Add(row)

' The following code trigger the error after the DataSet
' is returned to the calling Window Form application
row.SetColumnError("TestColumn1", "Error message here")
Next

Return ds
End Function

For the Windows Form application, you need to insert a datagrid control
(assumed as datagrid1). It will look something like this,

Code:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim ws As localhost.Service1
Dim ds As DataSet

Try
ws = New localhost.Service1
ds = ws.RetrieveDataSet

Me.DataGrid1.SetDataBinding(ds.Tables(0), "")
Catch ex As Exception
MsgBox(ex.Message)
Finally
If (Not (ws Is Nothing)) Then
ws.Dispose()
End If
End Try
End Sub

I really hope someone could help me out with this one.

Thanks in advance.

Jul 19 '05 #2
At last, I'm not alone. So far, you're the third person I've known to notice
this problem.

Do you think it's a bug?

"RogerS" <no****@hotmail.com> wrote in message
news:OC**************@tk2msftngp13.phx.gbl...
I am interested in this also as I saw the same behaviour when I was trying
to utilize rowerrors to set/retrieve error codes/messages from procedures in the database. Dataset worked fine as long as it was not returned through a
web service. When used in a web service, if I cleared all row errors, then
no problem but if I set one, then I got the same basic problem you have
mentioned (error in xml). It almost has to be a serialization issue.

Roger

"Programatix" <pr*********@nospam.com> wrote in message
news:Oz**************@tk2msftngp13.phx.gbl...
Hi,

I'm working on a project which includes WebServices and Windows Form
application.

The Windows Form application will call the WebServices to retrieve data

from
database. The data will be returned as DataSet.

Now, here's the problem. On .NET Framework 1.1, if any rows in the dataset returned contain errors (marked by calling the SetColumnError() method or setting the RowError property of the DataRow), I get the following error
message in the Windows Form application,

"There is an error in XML doument (1,xxxxxxx)"

If I forced the Windows Form application to run on .NET Framework 1.0,
everything works fine.

Is this a bug? Or I need to make some code adjustment because of changes

to
the Framework?

Here's the partial code for the WebService project

Code:

<WebMethod()> _
Public Function RetrieveDataSet() As DataSet
Dim ds As New DataSet
Dim dt As New DataTable
Dim row As DataRow
Dim i As Integer

dt.TableName = "TestTable"
dt.Columns.Add("TestColumn1", GetType(String))
dt.Columns.Add("TestColumn2", GetType(Integer))

ds.DataSetName = "TestDataSet"
ds.Tables.Add(dt)

For i = 0 To 10
row = dt.NewRow
row("TestColumn1") = "This is row " & i
row("TestColumn2") = i
dt.Rows.Add(row)

' The following code trigger the error after the DataSet
' is returned to the calling Window Form application
row.SetColumnError("TestColumn1", "Error message here")
Next

Return ds
End Function

For the Windows Form application, you need to insert a datagrid control
(assumed as datagrid1). It will look something like this,

Code:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim ws As localhost.Service1
Dim ds As DataSet

Try
ws = New localhost.Service1
ds = ws.RetrieveDataSet

Me.DataGrid1.SetDataBinding(ds.Tables(0), "")
Catch ex As Exception
MsgBox(ex.Message)
Finally
If (Not (ws Is Nothing)) Then
ws.Dispose()
End If
End Try
End Sub

I really hope someone could help me out with this one.

Thanks in advance.


Jul 19 '05 #3
I believe that it is a bug. As I mentioned, I think it is a problem with
serialization when the typed dataset contains row errors and is being
returned by a web service method. If I cleared the errors, then the same
function works fine.
Roger

"Programatix" <pr*********@nospam.com> wrote in message
news:OW**************@TK2MSFTNGP10.phx.gbl...
At last, I'm not alone. So far, you're the third person I've known to notice this problem.

Do you think it's a bug?

"RogerS" <no****@hotmail.com> wrote in message
news:OC**************@tk2msftngp13.phx.gbl...
I am interested in this also as I saw the same behaviour when I was trying
to utilize rowerrors to set/retrieve error codes/messages from procedures
in
the database. Dataset worked fine as long as it was not returned through

a web service. When used in a web service, if I cleared all row errors, then no problem but if I set one, then I got the same basic problem you have
mentioned (error in xml). It almost has to be a serialization issue.

Roger

"Programatix" <pr*********@nospam.com> wrote in message
news:Oz**************@tk2msftngp13.phx.gbl...
Hi,

I'm working on a project which includes WebServices and Windows Form
application.

The Windows Form application will call the WebServices to retrieve data
from
database. The data will be returned as DataSet.

Now, here's the problem. On .NET Framework 1.1, if any rows in the dataset returned contain errors (marked by calling the SetColumnError() method or setting the RowError property of the DataRow), I get the following

error message in the Windows Form application,

"There is an error in XML doument (1,xxxxxxx)"

If I forced the Windows Form application to run on .NET Framework 1.0,
everything works fine.

Is this a bug? Or I need to make some code adjustment because of changes to
the Framework?

Here's the partial code for the WebService project

Code:

<WebMethod()> _
Public Function RetrieveDataSet() As DataSet
Dim ds As New DataSet
Dim dt As New DataTable
Dim row As DataRow
Dim i As Integer

dt.TableName = "TestTable"
dt.Columns.Add("TestColumn1", GetType(String))
dt.Columns.Add("TestColumn2", GetType(Integer))

ds.DataSetName = "TestDataSet"
ds.Tables.Add(dt)

For i = 0 To 10
row = dt.NewRow
row("TestColumn1") = "This is row " & i
row("TestColumn2") = i
dt.Rows.Add(row)

' The following code trigger the error after the DataSet
' is returned to the calling Window Form application
row.SetColumnError("TestColumn1", "Error message here")
Next

Return ds
End Function

For the Windows Form application, you need to insert a datagrid

control (assumed as datagrid1). It will look something like this,

Code:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim ws As localhost.Service1
Dim ds As DataSet

Try
ws = New localhost.Service1
ds = ws.RetrieveDataSet

Me.DataGrid1.SetDataBinding(ds.Tables(0), "")
Catch ex As Exception
MsgBox(ex.Message)
Finally
If (Not (ws Is Nothing)) Then
ws.Dispose()
End If
End Try
End Sub

I really hope someone could help me out with this one.

Thanks in advance.



Jul 19 '05 #4
Since marking the rows with error is important to me. Do you have any
solution? I need to receive the rows with errors.

"RogerS" <no****@hotmail.com> wrote in message
news:O5****************@TK2MSFTNGP12.phx.gbl...
I believe that it is a bug. As I mentioned, I think it is a problem with
serialization when the typed dataset contains row errors and is being
returned by a web service method. If I cleared the errors, then the same
function works fine.
Roger

"Programatix" <pr*********@nospam.com> wrote in message
news:OW**************@TK2MSFTNGP10.phx.gbl...
At last, I'm not alone. So far, you're the third person I've known to notice
this problem.

Do you think it's a bug?

"RogerS" <no****@hotmail.com> wrote in message
news:OC**************@tk2msftngp13.phx.gbl...
I am interested in this also as I saw the same behaviour when I was trying to utilize rowerrors to set/retrieve error codes/messages from procedures
in
the database. Dataset worked fine as long as it was not returned through a web service. When used in a web service, if I cleared all row errors, then no problem but if I set one, then I got the same basic problem you
have mentioned (error in xml). It almost has to be a serialization issue.

Roger

"Programatix" <pr*********@nospam.com> wrote in message
news:Oz**************@tk2msftngp13.phx.gbl...
> Hi,
>
> I'm working on a project which includes WebServices and Windows Form
> application.
>
> The Windows Form application will call the WebServices to retrieve data from
> database. The data will be returned as DataSet.
>
> Now, here's the problem. On .NET Framework 1.1, if any rows in the

dataset
> returned contain errors (marked by calling the SetColumnError() method or
> setting the RowError property of the DataRow), I get the following error > message in the Windows Form application,
>
> "There is an error in XML doument (1,xxxxxxx)"
>
> If I forced the Windows Form application to run on .NET Framework
1.0, > everything works fine.
>
> Is this a bug? Or I need to make some code adjustment because of

changes to
> the Framework?
>
> Here's the partial code for the WebService project
>
> Code:
>
> <WebMethod()> _
> Public Function RetrieveDataSet() As DataSet
> Dim ds As New DataSet
> Dim dt As New DataTable
> Dim row As DataRow
> Dim i As Integer
>
> dt.TableName = "TestTable"
> dt.Columns.Add("TestColumn1", GetType(String))
> dt.Columns.Add("TestColumn2", GetType(Integer))
>
> ds.DataSetName = "TestDataSet"
> ds.Tables.Add(dt)
>
> For i = 0 To 10
> row = dt.NewRow
> row("TestColumn1") = "This is row " & i
> row("TestColumn2") = i
> dt.Rows.Add(row)
>
> ' The following code trigger the error after the DataSet
> ' is returned to the calling Window Form application
> row.SetColumnError("TestColumn1", "Error message here")
> Next
>
> Return ds
> End Function
>
>
>
> For the Windows Form application, you need to insert a datagrid control > (assumed as datagrid1). It will look something like this,
>
> Code:
>
> Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> Dim ws As localhost.Service1
> Dim ds As DataSet
>
> Try
> ws = New localhost.Service1
> ds = ws.RetrieveDataSet
>
> Me.DataGrid1.SetDataBinding(ds.Tables(0), "")
> Catch ex As Exception
> MsgBox(ex.Message)
> Finally
> If (Not (ws Is Nothing)) Then
> ws.Dispose()
> End If
> End Try
> End Sub
>
>
>
> I really hope someone could help me out with this one.
>
> Thanks in advance.
>
>
>



Jul 19 '05 #5
The following it the text of the error I receive:

An unhandled exception of type 'System.InvalidOperationException' occurred
in system.xml.dll
Additional information: There is an error in XML document (1, 132741).

The inner exception reads as follows:

"System.NullReferenceException: Object reference not set to an instance of
an object.
at System.Xml.Serialization.XmlSerializationReader.Un knownNode(XmlNode
unknownNode, Object o)
at System.Xml.Serialization.XmlSerializationReader.Un knownNode(Object o)
at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReader1.Read3_
getDatasetResponse()"

If I comment out the following line in the function that returns the
dataset:

ds.States(0).SetColumnError(0, "My row error") ' set error on first row

then it all works fine but if I put this line back in then the error above
occurs. I tried, as you suggested, to eat the exception in a try/catch but
the dataset is not returned. Again, this only seems to be a problem with the
dataset is returned from a webservice call.

I do appreciate you looking at this, Kathleen. I have since worked around my
problem but I think this is something that needs attention and should be
addressed. I had to change the design of a DataAccessLayer for a fairly
large enterprise application when I hit this wall as I was initially using
row errors to return custom messages from stored procs.

Roger


"Kathleen Dollard" <ka******@mvps.org> wrote in message
news:O$**************@TK2MSFTNGP11.phx.gbl...
The "message" you receive is an exception? Is the dataset correct? I think
this is just extra informatoin and you just need to do something like

Try
' Get WebService Data
Catch
' Do we care?
End Try

Kathleen
"Programatix" <pr*********@nospam.com> wrote in message
news:Oz**************@tk2msftngp13.phx.gbl...
Hi,

I'm working on a project which includes WebServices and Windows Form
application.

The Windows Form application will call the WebServices to retrieve data

from
database. The data will be returned as DataSet.

Now, here's the problem. On .NET Framework 1.1, if any rows in the dataset returned contain errors (marked by calling the SetColumnError() method or setting the RowError property of the DataRow), I get the following error
message in the Windows Form application,

"There is an error in XML doument (1,xxxxxxx)"

If I forced the Windows Form application to run on .NET Framework 1.0,
everything works fine.

Is this a bug? Or I need to make some code adjustment because of changes

to
the Framework?

Here's the partial code for the WebService project

Code:

<WebMethod()> _
Public Function RetrieveDataSet() As DataSet
Dim ds As New DataSet
Dim dt As New DataTable
Dim row As DataRow
Dim i As Integer

dt.TableName = "TestTable"
dt.Columns.Add("TestColumn1", GetType(String))
dt.Columns.Add("TestColumn2", GetType(Integer))

ds.DataSetName = "TestDataSet"
ds.Tables.Add(dt)

For i = 0 To 10
row = dt.NewRow
row("TestColumn1") = "This is row " & i
row("TestColumn2") = i
dt.Rows.Add(row)

' The following code trigger the error after the DataSet
' is returned to the calling Window Form application
row.SetColumnError("TestColumn1", "Error message here")
Next

Return ds
End Function

For the Windows Form application, you need to insert a datagrid control
(assumed as datagrid1). It will look something like this,

Code:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim ws As localhost.Service1
Dim ds As DataSet

Try
ws = New localhost.Service1
ds = ws.RetrieveDataSet

Me.DataGrid1.SetDataBinding(ds.Tables(0), "")
Catch ex As Exception
MsgBox(ex.Message)
Finally
If (Not (ws Is Nothing)) Then
ws.Dispose()
End If
End Try
End Sub

I really hope someone could help me out with this one.

Thanks in advance.


Jul 19 '05 #6
BTW,

Thanks for the great repro, and I'm sorry I looked at it too lightly
yesterday.

--
Kathleen (MVP-VB)

"Programatix" <pr*********@nospam.com> wrote in message
news:eA**************@TK2MSFTNGP12.phx.gbl...
Yes, it's an exception. There shouldn't be any exception. In the catch
section, there is nothing I can do.

If forcing the Windows Form application to run in .NET Framework 1.0, there isn't any exception at all.

"Kathleen Dollard" <ka******@mvps.org> wrote in message
news:O$**************@TK2MSFTNGP11.phx.gbl...
The "message" you receive is an exception? Is the dataset correct? I think
this is just extra informatoin and you just need to do something like

Try
' Get WebService Data
Catch
' Do we care?
End Try

Kathleen
"Programatix" <pr*********@nospam.com> wrote in message
news:Oz**************@tk2msftngp13.phx.gbl...
Hi,

I'm working on a project which includes WebServices and Windows Form
application.

The Windows Form application will call the WebServices to retrieve data
from
database. The data will be returned as DataSet.

Now, here's the problem. On .NET Framework 1.1, if any rows in the dataset returned contain errors (marked by calling the SetColumnError() method or setting the RowError property of the DataRow), I get the following

error message in the Windows Form application,

"There is an error in XML doument (1,xxxxxxx)"

If I forced the Windows Form application to run on .NET Framework 1.0,
everything works fine.

Is this a bug? Or I need to make some code adjustment because of changes to
the Framework?

Here's the partial code for the WebService project

Code:

<WebMethod()> _
Public Function RetrieveDataSet() As DataSet
Dim ds As New DataSet
Dim dt As New DataTable
Dim row As DataRow
Dim i As Integer

dt.TableName = "TestTable"
dt.Columns.Add("TestColumn1", GetType(String))
dt.Columns.Add("TestColumn2", GetType(Integer))

ds.DataSetName = "TestDataSet"
ds.Tables.Add(dt)

For i = 0 To 10
row = dt.NewRow
row("TestColumn1") = "This is row " & i
row("TestColumn2") = i
dt.Rows.Add(row)

' The following code trigger the error after the DataSet
' is returned to the calling Window Form application
row.SetColumnError("TestColumn1", "Error message here")
Next

Return ds
End Function

For the Windows Form application, you need to insert a datagrid

control (assumed as datagrid1). It will look something like this,

Code:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim ws As localhost.Service1
Dim ds As DataSet

Try
ws = New localhost.Service1
ds = ws.RetrieveDataSet

Me.DataGrid1.SetDataBinding(ds.Tables(0), "")
Catch ex As Exception
MsgBox(ex.Message)
Finally
If (Not (ws Is Nothing)) Then
ws.Dispose()
End If
End Try
End Sub

I really hope someone could help me out with this one.

Thanks in advance.



Jul 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Programatix | last post by:
Hi, I'm working on a project which includes WebServices and Windows Form application. The Windows Form application will call the WebServices to retrieve data from database. The data will be...
2
by: Programatix | last post by:
Hi, I'm working on a project which includes WebServices and Windows Form application. The Windows Form application will call the WebServices to retrieve data from database. The data will be...
8
by: Programatix | last post by:
Hi, I'm working on a project which includes XML WebServices and Windows Form application. The Windows Form application will call the XML WebServices to retrieve data from database. The data...
6
by: Programatix | last post by:
Hi, I'm working on a project which includes WebServices and Windows Form application. The Windows Form application will call the WebServices to retrieve data from database. The data will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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...

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.