Here's what I have
A custom collection:
public class aUser {
public string UserName { get {...} set {...}
}
public class UserList : System.Collecti on.CollectionBa se {
public void Add(aUser user) {...}
public aUser this[int Index] {...}
}
A web service:
[WebMethod]
[return: XmlElement("Use rList", typeof(UserList ))]
public UserList getUserList(str ing 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.Phone Svc svc = new WebApplication1 .localhost.Phon eSvc();
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 7039
Try this:
[WebMethod]
public UserList getUserList(str ing 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******** *****@TK2MSFTNG P11.phx.gbl... Here's what I have
A custom collection: public class aUser { public string UserName { get {...} set {...} }
public class UserList : System.Collecti on.CollectionBa se { public void Add(aUser user) {...} public aUser this[int Index] {...} }
A web service:
[WebMethod] [return: XmlElement("Use rList", typeof(UserList ))] public UserList getUserList(str ing 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.Phone Svc svc = new WebApplication1 .localhost.Phon eSvc(); 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******** *****@TK2MSFTNG P11.phx.gbl... Here's what I have
A custom collection: public class aUser { public string UserName { get {...} set {...} }
public class UserList : System.Collecti on.CollectionBa se { public void Add(aUser user) {...} public aUser this[int Index] {...} }
A web service:
[WebMethod] [return: XmlElement("Use rList", typeof(UserList ))] public UserList getUserList(str ing 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.Phone Svc svc = new WebApplication1 .localhost.Phon eSvc(); 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.Collecti ons.CollectionB ase, 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******@takem pis.com> wrote in message
news:O9******** ******@tk2msftn gp13.phx.gbl... Try this:
[WebMethod] public UserList getUserList(str ing 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******** *****@TK2MSFTNG P11.phx.gbl... Here's what I have
A custom collection: public class aUser { public string UserName { get {...} set {...} }
public class UserList : System.Collecti on.CollectionBa se { public void Add(aUser user) {...} public aUser this[int Index] {...} }
A web service:
[WebMethod] [return: XmlElement("Use rList", typeof(UserList ))] public UserList getUserList(str ing 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.Phone Svc svc = new WebApplication1 .localhost.Phon eSvc(); 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.getDepartme nt()
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**********@y ahoo.com> wrote in message
news:O6******** ******@TK2MSFTN GP09.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******** *****@TK2MSFTNG P11.phx.gbl... Here's what I have
A custom collection: public class aUser { public string UserName { get {...} set {...} }
public class UserList : System.Collecti on.CollectionBa se { public void Add(aUser user) {...} public aUser this[int Index] {...} }
A web service:
[WebMethod] [return: XmlElement("Use rList", typeof(UserList ))] public UserList getUserList(str ing 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.Phone Svc svc = new WebApplication1 .localhost.Phon eSvc(); 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.Collecti on.CollectionBa se { public void Add(aUser user) {...} public aUser this[int Index] {...} }
A web service:
[WebMethod] [return: XmlElement("Use rList", typeof(UserList ))] public UserList getUserList(str ing 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.Phone Svc svc = new WebApplication1 .localhost.Phon eSvc(); 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****@discuss ions.microsoft. com> wrote in message
news:F7******** *************** ***********@mic rosoft.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.Collecti on.CollectionBa se { public void Add(aUser user) {...} public aUser this[int Index] {...} }
A web service:
[WebMethod] [return: XmlElement("Use rList", typeof(UserList ))] public UserList getUserList(str ing 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.Phone Svc svc = new WebApplication1 .localhost.Phon eSvc(); 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 having to integrate some Web services into the
application using the existing architecture. These Web services are
secured using Forms Authentication. Hence, we need to turn the default
behavior of Forms Authentication (redirects to login pages, etc)...
|
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 user) {...}
public aUser this {...}
|
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 "Enlighten.LinkMad.Businesslogic". In one of
my frontend websites I use this type to authenticate a user who is trying to
login.
The following excerpt is from the web.config of the particular site showing
the reference to the custom provider, allowing .Net to do...
|
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 having to do a httpwebreqeust call.
|
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 intended for use, but I think this is the
only solution for my situation. I searched the web, in the hope finding the
answer, without any luck, so my final hope is with you.
Let me explain the situation:
I have an 'export'-wrapper to my regular...
| |
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 original author
of the below post)
I have similar issue sharing types between the web services, and also
the
client consuming those web services. I have all my custom types defined
in a
seperate assembly and I am using those types as parameter/...
|
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 complains about( You must implement
a default accessor as it inherits from ICollection).
I want to now what are the methods need to be implemented for that
collection.Any help with sample code is highly appreciated.
Thanks
|
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 techniques are not feasible)
The question is;
Given that I have a Person object with a private set for id.
What is the recommended approac in passing that object to the web service
|
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 label's text. I was thinking of
having a property on my textbox that was something like LabelControlID. the
textbox could then do a .Findcontrol on its parent control to find this
label and access its text. i thought that this might be an...
|
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 (C#);
public class MyServiceInstaller : System.Configuration.Install.Installer
{
private System.ServiceProcess.ServiceProcessInstaller
serviceProcessInstaller;
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |