Here's what I have
A custom collection:
public class aUser {
public string UserName { get {...} set {...}
}
public class UserList : System.Collection.CollectionBase {
public void Add(aUser user) {...}
public aUser this[int Index] {...}
}
A web service:
[WebMethod]
[return: XmlElement("UserList", typeof(UserList))]
public UserList getUserList(string search) {
UserList ul = new UserList();
return ul;
}
On the client side, when adding a reference to the webservice, it can only
see aUser object, but not UserList object. So I have to do
localhost.PhoneSvc svc = new WebApplication1.localhost.PhoneSvc();
localhost.aUser[] a = svc.getContact("test");
Is there a way to expose the collection object, so that you can do something
like this?
UserList ul = svc.getUserList("tester");
I know there are several articles out there that create wrapper class so
that it can be bounded to datagrid, etc. But none of them seems to be able
to expose the collection object directly.
Any ideas? Thanks. 6 7025
Try this:
[WebMethod]
public UserList getUserList(string search) {
UserList ul = new UserList();
return ul;
}
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
"Whoever" <bz****@hotmail.com> wrote in message
news:es*************@TK2MSFTNGP11.phx.gbl... Here's what I have
A custom collection: public class aUser { public string UserName { get {...} set {...} }
public class UserList : System.Collection.CollectionBase { public void Add(aUser user) {...} public aUser this[int Index] {...} }
A web service:
[WebMethod] [return: XmlElement("UserList", typeof(UserList))] public UserList getUserList(string search) { UserList ul = new UserList(); return ul; }
On the client side, when adding a reference to the webservice, it can only see aUser object, but not UserList object. So I have to do
localhost.PhoneSvc svc = new WebApplication1.localhost.PhoneSvc(); localhost.aUser[] a = svc.getContact("test");
Is there a way to expose the collection object, so that you can do
something like this?
UserList ul = svc.getUserList("tester");
I know there are several articles out there that create wrapper class so that it can be bounded to datagrid, etc. But none of them seems to be
able to expose the collection object directly.
Any ideas? Thanks.
We've used an array as the return type for our web services, and that worked
ok. You can always implement an AddRange(User[] users) method in your
collection to re-create the collection from the array ...
Angel
O:]
"Whoever" <bz****@hotmail.com> wrote in message
news:es*************@TK2MSFTNGP11.phx.gbl... Here's what I have
A custom collection: public class aUser { public string UserName { get {...} set {...} }
public class UserList : System.Collection.CollectionBase { public void Add(aUser user) {...} public aUser this[int Index] {...} }
A web service:
[WebMethod] [return: XmlElement("UserList", typeof(UserList))] public UserList getUserList(string search) { UserList ul = new UserList(); return ul; }
On the client side, when adding a reference to the webservice, it can only see aUser object, but not UserList object. So I have to do
localhost.PhoneSvc svc = new WebApplication1.localhost.PhoneSvc(); localhost.aUser[] a = svc.getContact("test");
Is there a way to expose the collection object, so that you can do
something like this?
UserList ul = svc.getUserList("tester");
I know there are several articles out there that create wrapper class so that it can be bounded to datagrid, etc. But none of them seems to be
able to expose the collection object directly.
Any ideas? Thanks.
Thanks for the help. You mean without the [return: XmlEelement...]? I
tried that but it's the same.
It seems whenever you return a class that inherits
System.Collections.CollectionBase, directly or indirectly, it ends up as an
array of the object it contains, never the collection object itself.
Am I missing something?
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:O9**************@tk2msftngp13.phx.gbl... Try this:
[WebMethod] public UserList getUserList(string search) { UserList ul = new UserList(); return ul; }
-- HTH, Kevin Spencer .Net Developer Microsoft MVP Neither a follower nor a lender be.
"Whoever" <bz****@hotmail.com> wrote in message news:es*************@TK2MSFTNGP11.phx.gbl... Here's what I have
A custom collection: public class aUser { public string UserName { get {...} set {...} }
public class UserList : System.Collection.CollectionBase { public void Add(aUser user) {...} public aUser this[int Index] {...} }
A web service:
[WebMethod] [return: XmlElement("UserList", typeof(UserList))] public UserList getUserList(string search) { UserList ul = new UserList(); return ul; }
On the client side, when adding a reference to the webservice, it can
only see aUser object, but not UserList object. So I have to do
localhost.PhoneSvc svc = new WebApplication1.localhost.PhoneSvc(); localhost.aUser[] a = svc.getContact("test");
Is there a way to expose the collection object, so that you can do something like this?
UserList ul = svc.getUserList("tester");
I know there are several articles out there that create wrapper class so that it can be bounded to datagrid, etc. But none of them seems to be able to expose the collection object directly.
Any ideas? Thanks.
For a more complicated case, such as:
<Department name='something'>
<Group id='123'>
<User>...</User>
<User>...</User>
</Group>
<Group>
...
</Group>
</Department>
<Department>
...
</Department>
Array is not as convenient. Also, it's also much better if you can:
DepartmentList deptlist = svc.getDepartment()
foreach (Department d in deptlist)
GroupList grplist = svc.getGroup(d);
(this last code is not real and may totally be wrong, since I haven't figure
out how to expose the list in the first place)
"Angelos Karantzalis" <ak**********@yahoo.com> wrote in message
news:O6**************@TK2MSFTNGP09.phx.gbl... We've used an array as the return type for our web services, and that
worked ok. You can always implement an AddRange(User[] users) method in your collection to re-create the collection from the array ...
Angel O:]
"Whoever" <bz****@hotmail.com> wrote in message news:es*************@TK2MSFTNGP11.phx.gbl... Here's what I have
A custom collection: public class aUser { public string UserName { get {...} set {...} }
public class UserList : System.Collection.CollectionBase { public void Add(aUser user) {...} public aUser this[int Index] {...} }
A web service:
[WebMethod] [return: XmlElement("UserList", typeof(UserList))] public UserList getUserList(string search) { UserList ul = new UserList(); return ul; }
On the client side, when adding a reference to the webservice, it can
only see aUser object, but not UserList object. So I have to do
localhost.PhoneSvc svc = new WebApplication1.localhost.PhoneSvc(); localhost.aUser[] a = svc.getContact("test");
Is there a way to expose the collection object, so that you can do something like this?
UserList ul = svc.getUserList("tester");
I know there are several articles out there that create wrapper class so that it can be bounded to datagrid, etc. But none of them seems to be able to expose the collection object directly.
Any ideas? Thanks.
Hi all (specially Whoever),
I've got your same problem. My WebMethod must return an ArrayList of custom
objects. Nevertheless, when calling the web method from my ASP.NET page, it
returns me an array of objetcs. What can I do? I've been trying to
deserialize objects with XMLInclude and so on, but I haven't got very clear
ideas about these issues of serialization adn deserialization.
I want the client to recognize my custom objects inside the Arraylist
because I must bound the returned ArrayList to a DataGrid and this way it's
no posible. First of all, do Web Services work well with Arraylists?
"Whoever", where are these articles telling about making wrappers in order
to bound DataGrids?
I'm willing your beautiful ideas. Thanks in advance.
"Whoever" wrote: Here's what I have
A custom collection: public class aUser { public string UserName { get {...} set {...} }
public class UserList : System.Collection.CollectionBase { public void Add(aUser user) {...} public aUser this[int Index] {...} }
A web service:
[WebMethod] [return: XmlElement("UserList", typeof(UserList))] public UserList getUserList(string search) { UserList ul = new UserList(); return ul; }
On the client side, when adding a reference to the webservice, it can only see aUser object, but not UserList object. So I have to do
localhost.PhoneSvc svc = new WebApplication1.localhost.PhoneSvc(); localhost.aUser[] a = svc.getContact("test");
Is there a way to expose the collection object, so that you can do something like this?
UserList ul = svc.getUserList("tester");
I know there are several articles out there that create wrapper class so that it can be bounded to datagrid, etc. But none of them seems to be able to expose the collection object directly.
Any ideas? Thanks. http://www.ftponline.com/vsm/2003_06...olumns/aspnet/
Datagrid will bound to Properties not field. You can fix that. But I would
really like to see the list object pass to the client so that you can
declare
UserList ul;
Instead of
aUser[] users;
from the client side. Especially with multile level xml document.
Maybe it's not doable with custom collection?
"MIGUEL" <MI****@discussions.microsoft.com> wrote in message
news:F7**********************************@microsof t.com... Hi all (specially Whoever),
I've got your same problem. My WebMethod must return an ArrayList of
custom objects. Nevertheless, when calling the web method from my ASP.NET page,
it returns me an array of objetcs. What can I do? I've been trying to deserialize objects with XMLInclude and so on, but I haven't got very
clear ideas about these issues of serialization adn deserialization.
I want the client to recognize my custom objects inside the Arraylist because I must bound the returned ArrayList to a DataGrid and this way
it's no posible. First of all, do Web Services work well with Arraylists?
"Whoever", where are these articles telling about making wrappers in order to bound DataGrids?
I'm willing your beautiful ideas. Thanks in advance.
"Whoever" wrote:
Here's what I have
A custom collection: public class aUser { public string UserName { get {...} set {...} }
public class UserList : System.Collection.CollectionBase { public void Add(aUser user) {...} public aUser this[int Index] {...} }
A web service:
[WebMethod] [return: XmlElement("UserList", typeof(UserList))] public UserList getUserList(string search) { UserList ul = new UserList(); return ul; }
On the client side, when adding a reference to the webservice, it can
only see aUser object, but not UserList object. So I have to do
localhost.PhoneSvc svc = new WebApplication1.localhost.PhoneSvc(); localhost.aUser[] a = svc.getContact("test");
Is there a way to expose the collection object, so that you can do
something like this?
UserList ul = svc.getUserList("tester");
I know there are several articles out there that create wrapper class so that it can be bounded to datagrid, etc. But none of them seems to be
able to expose the collection object directly.
Any ideas? Thanks. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Matt |
last post by:
Hello all,
The app we are working on uses custom errors extensively to provide
friendly error pages to users whilst logging the actual exceptions
behind the scenes.
However.... We are now...
|
by: Whoever |
last post by:
Here's what I have
A custom collection:
public class aUser {
public string UserName { get {...} set {...}
}
public class UserList : System.Collection.CollectionBase {
public void Add(aUser...
|
by: Graham |
last post by:
I have created a custom MembershipProvider called "LassieMembershipProvider"
that derives from "MembershipProvider". This providor is located in a
Businesslogic layer dll called...
|
by: kbs |
last post by:
Hi,
I'm looking for some good examples that illustrate how to code a web service
that exposes a custom collection so that the properties of the collection are
accessible on the client without...
|
by: Thomas D. |
last post by:
Hello all,
I'm using the IXmlSerializable interface for a project and encounter some
problems when testing my webservice in a client application. I know this
interface is undocumented and not...
|
by: gbanister |
last post by:
I'd like to repost a message that I found in this group almost one year
ago, because it's the exact problem I'm in and there was no solution
offered to this post last year. (note: I was not the...
|
by: Ghanashyam |
last post by:
I have a custom collection (Dervided from CollectionBase) and it works pretty
well when I consume it from C# console app.But it is not working if I return
the collection from a web service.The IE...
|
by: Greger |
last post by:
Hi,
I am building an architecture that passes my custom objects to and from
webservices. (Our internal architecture requires me to use webservices to any
suggestion to use other remoting...
|
by: TS |
last post by:
I have a custom textbox that i need to access a label's text property. the
label and textbox are 2 separate controls that will be on my page. Inside my
custom control i want to have access to this...
|
by: =?Utf-8?B?Qi5BaGxzdGVkdA==?= |
last post by:
Hi all,
This is something that I have been toying with for about a week now. What
I want to achieve is Install a Service with Customised parameters (using
InstallUtil.exe) for User Name. Example...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
| |