473,466 Members | 1,457 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Adding a Web Reference changes DataTypes ???

cc
Hi,

I having created a simple WebService (in VS 2005) with just one WebMethod as
follows :
[WebMethod]
public DataTable GetProducts()
{
DataTable objDataTable = null;

// code for filling up the datatable

return objDataTable;
}

Then, Adding the WebService as a Web Reference to a Client Application is
following proxy code generated
at the client for the WebMethod :

public GetProductsResponseGetProductsResult GetProducts()
{
object[] results = this.Invoke("GetProducts", new object[0]);
return ((GetProductsResponseGetProductsResult)(results[0]));
}

Look at the return type of the method :
at the server it was defined as DataTable but at the client is it changed to
an unreadable name GetProductsResponseGetProductsResult ???

What is happening here ? how can I make sure that the DataTable-type is used
at the client as well ?

thanks
Chris
Apr 30 '06 #1
9 942
Put the datatable inside a new DataSet and have the WebMethod return a
DataSet object.

I don't believe the WebService infrastructure is capable of intelligently
serializing a datatable by itself.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"cc" wrote:
Hi,

I having created a simple WebService (in VS 2005) with just one WebMethod as
follows :
[WebMethod]
public DataTable GetProducts()
{
DataTable objDataTable = null;

// code for filling up the datatable

return objDataTable;
}

Then, Adding the WebService as a Web Reference to a Client Application is
following proxy code generated
at the client for the WebMethod :

public GetProductsResponseGetProductsResult GetProducts()
{
object[] results = this.Invoke("GetProducts", new object[0]);
return ((GetProductsResponseGetProductsResult)(results[0]));
}

Look at the return type of the method :
at the server it was defined as DataTable but at the client is it changed to
an unreadable name GetProductsResponseGetProductsResult ???

What is happening here ? how can I make sure that the DataTable-type is used
at the client as well ?

thanks
Chris

Apr 30 '06 #2
cc
thanks for the tip !

Still, at my company, they are using a WebMethod that returns something of
type DataTable and the proxy code uses DataTable as well !!!
And I have been asked to use the same webmethod in my client but can't get
it work !!

any idea how the datatable can be maintained ?

thanks
Chris
"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message
news:13**********************************@microsof t.com...
Put the datatable inside a new DataSet and have the WebMethod return a
DataSet object.

I don't believe the WebService infrastructure is capable of intelligently
serializing a datatable by itself.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"cc" wrote:
Hi,

I having created a simple WebService (in VS 2005) with just one WebMethod as follows :
[WebMethod]
public DataTable GetProducts()
{
DataTable objDataTable = null;

// code for filling up the datatable

return objDataTable;
}

Then, Adding the WebService as a Web Reference to a Client Application is following proxy code generated
at the client for the WebMethod :

public GetProductsResponseGetProductsResult GetProducts()
{
object[] results = this.Invoke("GetProducts", new object[0]);
return ((GetProductsResponseGetProductsResult)(results[0]));
}

Look at the return type of the method :
at the server it was defined as DataTable but at the client is it changed to an unreadable name GetProductsResponseGetProductsResult ???

What is happening here ? how can I make sure that the DataTable-type is used at the client as well ?

thanks
Chris

Apr 30 '06 #3
Ok. The easiest way to figure this out is to look at the SOAP Envelope that's
returned by the WebService. YOu can examine the XML and see (for example) if
it could be loaded into a DataSet object with ReadXml and provide easy access
to the DataTable that way, or it may be that's it's being returned as an
array. if your web proxy class can't represent it accurately on the client
side, then you need to look at the raw XML to figure out what is being
returned to you.

WebService Studio is a nice tool that makes this easy. I think its on
Gotdotnet.com in the user samples or in a workspace.

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"cc" wrote:
thanks for the tip !

Still, at my company, they are using a WebMethod that returns something of
type DataTable and the proxy code uses DataTable as well !!!
And I have been asked to use the same webmethod in my client but can't get
it work !!

any idea how the datatable can be maintained ?

thanks
Chris
"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message
news:13**********************************@microsof t.com...
Put the datatable inside a new DataSet and have the WebMethod return a
DataSet object.

I don't believe the WebService infrastructure is capable of intelligently
serializing a datatable by itself.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"cc" wrote:
Hi,

I having created a simple WebService (in VS 2005) with just one WebMethod as follows :
[WebMethod]
public DataTable GetProducts()
{
DataTable objDataTable = null;

// code for filling up the datatable

return objDataTable;
}

Then, Adding the WebService as a Web Reference to a Client Application is following proxy code generated
at the client for the WebMethod :

public GetProductsResponseGetProductsResult GetProducts()
{
object[] results = this.Invoke("GetProducts", new object[0]);
return ((GetProductsResponseGetProductsResult)(results[0]));
}

Look at the return type of the method :
at the server it was defined as DataTable but at the client is it changed to an unreadable name GetProductsResponseGetProductsResult ???

What is happening here ? how can I make sure that the DataTable-type is used at the client as well ?

thanks
Chris


Apr 30 '06 #4
CC

I would use VB Net that is much simpler for this,

Cor

"cc" <cm****@yahoo.com> schreef in bericht
news:44***********************@news.skynet.be...
Hi,

I having created a simple WebService (in VS 2005) with just one WebMethod
as
follows :
[WebMethod]
public DataTable GetProducts()
{
DataTable objDataTable = null;

// code for filling up the datatable

return objDataTable;
}

Then, Adding the WebService as a Web Reference to a Client Application is
following proxy code generated
at the client for the WebMethod :

public GetProductsResponseGetProductsResult GetProducts()
{
object[] results = this.Invoke("GetProducts", new object[0]);
return ((GetProductsResponseGetProductsResult)(results[0]));
}

Look at the return type of the method :
at the server it was defined as DataTable but at the client is it changed
to
an unreadable name GetProductsResponseGetProductsResult ???

What is happening here ? how can I make sure that the DataTable-type is
used
at the client as well ?

thanks
Chris

May 1 '06 #5
cc
thanks Peter !
I'll have a look with the tool you suggest.

Chris

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message
news:4E**********************************@microsof t.com...
Ok. The easiest way to figure this out is to look at the SOAP Envelope that's returned by the WebService. YOu can examine the XML and see (for example) if it could be loaded into a DataSet object with ReadXml and provide easy access to the DataTable that way, or it may be that's it's being returned as an
array. if your web proxy class can't represent it accurately on the client
side, then you need to look at the raw XML to figure out what is being
returned to you.

WebService Studio is a nice tool that makes this easy. I think its on
Gotdotnet.com in the user samples or in a workspace.

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"cc" wrote:
thanks for the tip !

Still, at my company, they are using a WebMethod that returns something of type DataTable and the proxy code uses DataTable as well !!!
And I have been asked to use the same webmethod in my client but can't get it work !!

any idea how the datatable can be maintained ?

thanks
Chris
"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message news:13**********************************@microsof t.com...
Put the datatable inside a new DataSet and have the WebMethod return a
DataSet object.

I don't believe the WebService infrastructure is capable of intelligently serializing a datatable by itself.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"cc" wrote:

> Hi,
>
> I having created a simple WebService (in VS 2005) with just one

WebMethod as
> follows :
> [WebMethod]
> public DataTable GetProducts()
> {
> DataTable objDataTable = null;
>
> // code for filling up the datatable
>
> return objDataTable;
> }
>
> Then, Adding the WebService as a Web Reference to a Client
Application is
> following proxy code generated
> at the client for the WebMethod :
>
> public GetProductsResponseGetProductsResult GetProducts()
> {
> object[] results = this.Invoke("GetProducts", new object[0]);
> return ((GetProductsResponseGetProductsResult)(results[0]));
> }
>
> Look at the return type of the method :
> at the server it was defined as DataTable but at the client is it

changed to
> an unreadable name GetProductsResponseGetProductsResult ???
>
> What is happening here ? how can I make sure that the DataTable-type
is used
> at the client as well ?
>
> thanks
> Chris
>
>
>


May 1 '06 #6
Cor,
With all due respect, and notwithstanding the fact that you are posting to
the C# newsgroup and then advising posters that using VB.NET can solve their
issues better, I fail to see what VB.NET can do for this individual that he
can't do with C#, which is the programming language he has chosen?
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Cor Ligthert [MVP]" wrote:
CC

I would use VB Net that is much simpler for this,

Cor

"cc" <cm****@yahoo.com> schreef in bericht
news:44***********************@news.skynet.be...
Hi,

I having created a simple WebService (in VS 2005) with just one WebMethod
as
follows :
[WebMethod]
public DataTable GetProducts()
{
DataTable objDataTable = null;

// code for filling up the datatable

return objDataTable;
}

Then, Adding the WebService as a Web Reference to a Client Application is
following proxy code generated
at the client for the WebMethod :

public GetProductsResponseGetProductsResult GetProducts()
{
object[] results = this.Invoke("GetProducts", new object[0]);
return ((GetProductsResponseGetProductsResult)(results[0]));
}

Look at the return type of the method :
at the server it was defined as DataTable but at the client is it changed
to
an unreadable name GetProductsResponseGetProductsResult ???

What is happening here ? how can I make sure that the DataTable-type is
used
at the client as well ?

thanks
Chris


May 1 '06 #7
It was a crosspost, but I agree totally agree Peter.

--
William Stacey [MVP]

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message
news:10**********************************@microsof t.com...
| Cor,
| With all due respect, and notwithstanding the fact that you are posting to
| the C# newsgroup and then advising posters that using VB.NET can solve
their
| issues better, I fail to see what VB.NET can do for this individual that
he
| can't do with C#, which is the programming language he has chosen?
| Peter
May 2 '06 #8
Peter,

I completely agree with you, I could not resist doing it like this, it was a
trap. However, the OP did not ask "why". If he had done I would have written
than "why do you post than to the language.vb newsgroup"

It was just trying another approach, but the OP did not go into the trap.

:-)

Cor

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> schreef in bericht
news:10**********************************@microsof t.com...
Cor,
With all due respect, and notwithstanding the fact that you are posting to
the C# newsgroup and then advising posters that using VB.NET can solve
their
issues better, I fail to see what VB.NET can do for this individual that
he
can't do with C#, which is the programming language he has chosen?
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Cor Ligthert [MVP]" wrote:
CC

I would use VB Net that is much simpler for this,

Cor

"cc" <cm****@yahoo.com> schreef in bericht
news:44***********************@news.skynet.be...
> Hi,
>
> I having created a simple WebService (in VS 2005) with just one
> WebMethod
> as
> follows :
> [WebMethod]
> public DataTable GetProducts()
> {
> DataTable objDataTable = null;
>
> // code for filling up the datatable
>
> return objDataTable;
> }
>
> Then, Adding the WebService as a Web Reference to a Client Application
> is
> following proxy code generated
> at the client for the WebMethod :
>
> public GetProductsResponseGetProductsResult GetProducts()
> {
> object[] results = this.Invoke("GetProducts", new object[0]);
> return ((GetProductsResponseGetProductsResult)(results[0]));
> }
>
> Look at the return type of the method :
> at the server it was defined as DataTable but at the client is it
> changed
> to
> an unreadable name GetProductsResponseGetProductsResult ???
>
> What is happening here ? how can I make sure that the DataTable-type is
> used
> at the client as well ?
>
> thanks
> Chris
>
>


May 2 '06 #9
Peter,

There was something more that I almost forgot.

I wrote in my idea nothing wrong, however I could have placed two words
extra.

"I would use VB Net that is much simpler for this, *for me*".

But I thought that that was obvious because I wrote *I would* .

:-)

Cor

I wrote
"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> schreef in bericht
news:10**********************************@microsof t.com...
Cor,
With all due respect, and notwithstanding the fact that you are posting to
the C# newsgroup and then advising posters that using VB.NET can solve
their
issues better, I fail to see what VB.NET can do for this individual that
he
can't do with C#, which is the programming language he has chosen?
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Cor Ligthert [MVP]" wrote:
CC

I would use VB Net that is much simpler for this,

Cor

"cc" <cm****@yahoo.com> schreef in bericht
news:44***********************@news.skynet.be...
> Hi,
>
> I having created a simple WebService (in VS 2005) with just one
> WebMethod
> as
> follows :
> [WebMethod]
> public DataTable GetProducts()
> {
> DataTable objDataTable = null;
>
> // code for filling up the datatable
>
> return objDataTable;
> }
>
> Then, Adding the WebService as a Web Reference to a Client Application
> is
> following proxy code generated
> at the client for the WebMethod :
>
> public GetProductsResponseGetProductsResult GetProducts()
> {
> object[] results = this.Invoke("GetProducts", new object[0]);
> return ((GetProductsResponseGetProductsResult)(results[0]));
> }
>
> Look at the return type of the method :
> at the server it was defined as DataTable but at the client is it
> changed
> to
> an unreadable name GetProductsResponseGetProductsResult ???
>
> What is happening here ? how can I make sure that the DataTable-type is
> used
> at the client as well ?
>
> thanks
> Chris
>
>


May 2 '06 #10

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

Similar topics

36
by: Riccardo Rossi | last post by:
Hi all! How does Python pass arguments to a function? By value or by reference? Thanks, Riccardo Rossi.
2
by: tdmailbox | last post by:
I have a production application that I am building some upgrades using a second (empty) copy the database. A few of the upgrades included changing the datatypes of a few fields from varchar to...
2
by: sam | last post by:
Hi, I've been buried in xsl and xslt articles for several days now, and am still unsure as to what I need to do... Basically, my vb.net app loads up an XML file from an external source...
2
by: JD | last post by:
I'm trying to add a custom utility.mde reference to an application from code using the standard Application.References.AddFromFile code. IT has worked really well with A2K for a couple of years but...
8
by: Bri | last post by:
Greetings, I am using Eval() in a query with only limited success. If the text within the function contains a reference to a Field I get #ERROR#. I'll try and explain what I'm trying to do and...
7
by: Andy Bates | last post by:
I have hopefully a simple problem in C#. I designed a form with a listview on left, vert splitter against that, then the remainder of the form from top to bottom: a listview, horiz splitter and...
47
by: Pierre Barbier de Reuille | last post by:
Please, note that I am entirely open for every points on this proposal (which I do not dare yet to call PEP). Abstract ======== This proposal suggests to add symbols into Python. Symbols...
14
by: 97T | last post by:
Well this is still bugging me. I know there are other ways around this, but for a number of reasons I would like to be able to do this one simple thing. I have a form with a number of controls...
9
by: cc | last post by:
Hi, I having created a simple WebService (in VS 2005) with just one WebMethod as follows : public DataTable GetProducts() { DataTable objDataTable = null; // code for filling up the...
7
by: Maximus Decimus | last post by:
HI all, I am using python v2.5 and I am an amateur working on python. I am extending python for my research work and would like some help and guidance w.r.t this matter from you experienced...
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
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
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.