473,387 Members | 1,834 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,387 software developers and data experts.

Problem with return type in webservice

Hi All,

I am having trouble with my first effort at developing a web service.

I have a methods, outlined below which should return a DataTable.

[WebMethod(Description = "Gets details for contact for the ID provided")]
public DataTable GetContactsforCompany(string sID)
{
if (sID == string.Empty)
return new DataTable();

return getContactsForCompany(sID);

}
Unfortunately when I call the methood in an application the return type
is: GetContractsForCompanyResponseGetContactsForCompan yResult

and the only properties avaialable are "Any"

Can anybody tell me why?

TIA
Peter Longstaff
Nov 21 '06 #1
3 2004
Try adding the DataTable to a DataSet in the WebMethod and return a DataSet.
At the client, you can get your DataTable back out with
MyDataSet.Tables[0]

Peter

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


"Peter Longstaff" wrote:
Hi All,

I am having trouble with my first effort at developing a web service.

I have a methods, outlined below which should return a DataTable.

[WebMethod(Description = "Gets details for contact for the ID provided")]
public DataTable GetContactsforCompany(string sID)
{
if (sID == string.Empty)
return new DataTable();

return getContactsForCompany(sID);

}
Unfortunately when I call the methood in an application the return type
is: GetContractsForCompanyResponseGetContactsForCompan yResult

and the only properties avaialable are "Any"

Can anybody tell me why?

TIA
Peter Longstaff
Nov 21 '06 #2
Peter Longstaff wrote:
I am having trouble with my first effort at developing a web service.

I have a methods, outlined below which should return a DataTable.

[WebMethod(Description = "Gets details for contact for the ID provided")]
public DataTable GetContactsforCompany(string sID)
{
if (sID == string.Empty)
return new DataTable();

return getContactsForCompany(sID);

}
Why pay the huge overhead of converting to a technology
neutral format like SOAP and then return a data type that
is .NET specific ?

I would either use a binary protocol like .NET Remoting
with the DataTable/DataSet or use SOAP/HTTP with a
portable data type (like array of object with properties).

Arne
Nov 22 '06 #3
Arne,
You are way over the OP's head - this is his first webservice and he *wants*
to return a Datatable (actually he *would* need a dataset containing a
datatable).

I agree about returning provider-neutral types wholeheartedly. However, if
you are starting out with a webservice to begin with, this idea of a "huge
overhead" becomes a moot issue, IMHO.
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Arne Vajhøj" wrote:
Peter Longstaff wrote:
I am having trouble with my first effort at developing a web service.

I have a methods, outlined below which should return a DataTable.

[WebMethod(Description = "Gets details for contact for the ID provided")]
public DataTable GetContactsforCompany(string sID)
{
if (sID == string.Empty)
return new DataTable();

return getContactsForCompany(sID);

}

Why pay the huge overhead of converting to a technology
neutral format like SOAP and then return a data type that
is .NET specific ?

I would either use a binary protocol like .NET Remoting
with the DataTable/DataSet or use SOAP/HTTP with a
portable data type (like array of object with properties).

Arne
Nov 22 '06 #4

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

Similar topics

4
by: Flare | last post by:
OK. I'll try explain my problem so simple as possible. I have to send a complex data type to a WebService from a Asp.net webapplication. My Data type look like this. (A class with a porperty)...
0
by: Raed Sawalha | last post by:
Dear: I'm working web application that expect to pass an class object to DLL(Class Lib) I just Attached the DLL File into Web Solution ( DLL is located in other machine), inside the class...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
6
by: Picho | last post by:
Hi all. I have a webservice and a windows app. both of them reference the same class library called WebServiceTest.Core that defines a class called Class1. the webservice exposes a method...
2
by: yqlu | last post by:
I hava developed a client in C# that is connected to a 3-party XML Web Services developed in Java based on the AXIS 1.1. Most methods call are successful except for one method named "findObjects"...
8
by: andyjgw | last post by:
Hi all, hope someone can help here, I'm really stuck. Reading and googling like mad, to no avail so far... Basically, my problem *seems* to boil down to type conversion: Here's a sample web...
5
by: Stacey Levine | last post by:
I have a webservice that I wanted to return an ArrayList..Well the service compiles and runs when I have the output defined as ArrayList, but the WSDL defines the output as an Object so I was...
9
by: MSDNAndi | last post by:
Hi, I have a set of simple webservices calls that worked fine using .NET Framework 1.0. I am calling a Java/Apache based webservices, the calling side is not able to supply a proper WSDL. ...
1
by: louis_la_brocante | last post by:
Dear all, I am having trouble generating a client proxy for a webservice whose methods return a "complex" type. The type is complex in that it is a class whose members are a mix of primitive...
0
by: Rob C | last post by:
I have several methods implemented in a webservice written in C#. The methods execute SQL against a SQL Server 2005 db and returns a Dataset (as XML). I am utilizing the webservice from a VC++...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...

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.