Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > How to do: Web Services returning a class that inherits arraylist

Reply
Thread Tools

How to do: Web Services returning a class that inherits arraylist

 
 
Hammer
Guest
Posts: n/a
 
      09-18-2008
All,

I have a class called CartLine and I try to return this class in a Web
Method I can not!

[Serializable]
public class Cartline: Arraylist
{
// class properties and etc.
}

The proxy reference doesn't contain any information even though I use the
following:

[XmlInclude(typeof(ShoppingCart)), XmlInclude(typeof(Business.Cart))]
public CartLine GetCartItem(String m_ShoppingCartUserId,
Common.UserStatus eStatus)

And to add insult to injury, when I uses this web method calls to returns my
class as object[] that I can not cast back to my business class.

Can anyone shed some light on how to accomplish this?

 
Reply With Quote
 
 
 
 
Registered User
Guest
Posts: n/a
 
      09-18-2008
On Thu, 18 Sep 2008 11:31:04 -0700, Hammer
<(E-Mail Removed)> wrote:

>All,
>
>I have a class called CartLine and I try to return this class in a Web
>Method I can not!
>
>[Serializable]
>public class Cartline: Arraylist
>{
> // class properties and etc.
>}
>
>The proxy reference doesn't contain any information even though I use the
>following:
>
> [XmlInclude(typeof(ShoppingCart)), XmlInclude(typeof(Business.Cart))]
> public CartLine GetCartItem(String m_ShoppingCartUserId,
>Common.UserStatus eStatus)
>
>And to add insult to injury, when I uses this web method calls to returns my
>class as object[] that I can not cast back to my business class.
>
>Can anyone shed some light on how to accomplish this?
>


You're trying to return an object which contains both data and
functionality which can't be done. The objects in the array are of a
type declared within the web service's namespace. This is because not
every client will know about the System.Collections namespace and its
ArrayList type.

Web service types are described as simple objects because they are not
based upon true object-oriented types. The SOAP in SOAP web service
stands for Simple Object Access Protocol.A different mechanism will be
needed to pass complex types.

regards
A.G.
 
Reply With Quote
 
 
 
 
Hammer
Guest
Posts: n/a
 
      09-19-2008
I beg differ,

its an array. Array types can be defined in the soap schema. I'm just trying
to find out why doesn't mines get defined. I can update my reference files
but it does me little good if I then update my web references.

Has anyone encounter this problem or has a possible solution?

Thanks,

"Registered User" wrote:

> On Thu, 18 Sep 2008 11:31:04 -0700, Hammer
> <(E-Mail Removed)> wrote:
>
> >All,
> >
> >I have a class called CartLine and I try to return this class in a Web
> >Method I can not!
> >
> >[Serializable]
> >public class Cartline: Arraylist
> >{
> > // class properties and etc.
> >}
> >
> >The proxy reference doesn't contain any information even though I use the
> >following:
> >
> > [XmlInclude(typeof(ShoppingCart)), XmlInclude(typeof(Business.Cart))]
> > public CartLine GetCartItem(String m_ShoppingCartUserId,
> >Common.UserStatus eStatus)
> >
> >And to add insult to injury, when I uses this web method calls to returns my
> >class as object[] that I can not cast back to my business class.
> >
> >Can anyone shed some light on how to accomplish this?
> >

>
> You're trying to return an object which contains both data and
> functionality which can't be done. The objects in the array are of a
> type declared within the web service's namespace. This is because not
> every client will know about the System.Collections namespace and its
> ArrayList type.
>
> Web service types are described as simple objects because they are not
> based upon true object-oriented types. The SOAP in SOAP web service
> stands for Simple Object Access Protocol.A different mechanism will be
> needed to pass complex types.
>
> regards
> A.G.
>

 
Reply With Quote
 
Hammer
Guest
Posts: n/a
 
      09-26-2008
I found the solution to my problem, when you add a WCF service - select the
advance button, select the array dropdown and then select the appropriate
array that applys to your situation.

Yupper, hidden to plain view....

Happy hunting...

"Hammer" wrote:

> I beg differ,
>
> its an array. Array types can be defined in the soap schema. I'm just trying
> to find out why doesn't mines get defined. I can update my reference files
> but it does me little good if I then update my web references.
>
> Has anyone encounter this problem or has a possible solution?
>
> Thanks,
>
> "Registered User" wrote:
>
> > On Thu, 18 Sep 2008 11:31:04 -0700, Hammer
> > <(E-Mail Removed)> wrote:
> >
> > >All,
> > >
> > >I have a class called CartLine and I try to return this class in a Web
> > >Method I can not!
> > >
> > >[Serializable]
> > >public class Cartline: Arraylist
> > >{
> > > // class properties and etc.
> > >}
> > >
> > >The proxy reference doesn't contain any information even though I use the
> > >following:
> > >
> > > [XmlInclude(typeof(ShoppingCart)), XmlInclude(typeof(Business.Cart))]
> > > public CartLine GetCartItem(String m_ShoppingCartUserId,
> > >Common.UserStatus eStatus)
> > >
> > >And to add insult to injury, when I uses this web method calls to returns my
> > >class as object[] that I can not cast back to my business class.
> > >
> > >Can anyone shed some light on how to accomplish this?
> > >

> >
> > You're trying to return an object which contains both data and
> > functionality which can't be done. The objects in the array are of a
> > type declared within the web service's namespace. This is because not
> > every client will know about the System.Collections namespace and its
> > ArrayList type.
> >
> > Web service types are described as simple objects because they are not
> > based upon true object-oriented types. The SOAP in SOAP web service
> > stands for Simple Object Access Protocol.A different mechanism will be
> > needed to pass complex types.
> >
> > regards
> > A.G.
> >

 
Reply With Quote
 
Registered User
Guest
Posts: n/a
 
      09-27-2008
On Fri, 26 Sep 2008 12:28:06 -0700, Hammer
<(E-Mail Removed)> wrote:

>I found the solution to my problem, when you add a WCF service - select the
>advance button, select the array dropdown and then select the appropriate
>array that applys to your situation.
>
>Yupper, hidden to plain view....
>
>Happy hunting...
>

Good stuff. I hadn't considered WCF primarily because I haven't had
occasion to use the tool. Most of what I do interacts with legacy
systems and their seeming eccentricities.

Doesn't a WCF webservice require a WCF client?

regards
A.G.

>"Hammer" wrote:
>
>> I beg differ,
>>
>> its an array. Array types can be defined in the soap schema. I'm just trying
>> to find out why doesn't mines get defined. I can update my reference files
>> but it does me little good if I then update my web references.
>>
>> Has anyone encounter this problem or has a possible solution?
>>
>> Thanks,
>>
>> "Registered User" wrote:
>>
>> > On Thu, 18 Sep 2008 11:31:04 -0700, Hammer
>> > <(E-Mail Removed)> wrote:
>> >
>> > >All,
>> > >
>> > >I have a class called CartLine and I try to return this class in a Web
>> > >Method I can not!
>> > >
>> > >[Serializable]
>> > >public class Cartline: Arraylist
>> > >{
>> > > // class properties and etc.
>> > >}
>> > >
>> > >The proxy reference doesn't contain any information even though I use the
>> > >following:
>> > >
>> > > [XmlInclude(typeof(ShoppingCart)), XmlInclude(typeof(Business.Cart))]
>> > > public CartLine GetCartItem(String m_ShoppingCartUserId,
>> > >Common.UserStatus eStatus)
>> > >
>> > >And to add insult to injury, when I uses this web method calls to returns my
>> > >class as object[] that I can not cast back to my business class.
>> > >
>> > >Can anyone shed some light on how to accomplish this?
>> > >
>> >
>> > You're trying to return an object which contains both data and
>> > functionality which can't be done. The objects in the array are of a
>> > type declared within the web service's namespace. This is because not
>> > every client will know about the System.Collections namespace and its
>> > ArrayList type.
>> >
>> > Web service types are described as simple objects because they are not
>> > based upon true object-oriented types. The SOAP in SOAP web service
>> > stands for Simple Object Access Protocol.A different mechanism will be
>> > needed to pass complex types.
>> >
>> > regards
>> > A.G.
>> >

 
Reply With Quote
 
John Saunders
Guest
Posts: n/a
 
      09-27-2008
"Registered User" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Fri, 26 Sep 2008 12:28:06 -0700, Hammer
> <(E-Mail Removed)> wrote:
>
>>I found the solution to my problem, when you add a WCF service - select
>>the
>>advance button, select the array dropdown and then select the appropriate
>>array that applys to your situation.
>>
>>Yupper, hidden to plain view....
>>
>>Happy hunting...
>>

> Good stuff. I hadn't considered WCF primarily because I haven't had
> occasion to use the tool. Most of what I do interacts with legacy
> systems and their seeming eccentricities.
>
> Doesn't a WCF webservice require a WCF client?


No. WCF is simply the replacement for the older ASMX web service technology.
It no more requires a WCF client than ASMX required a .NET client.

--
John Saunders | MVP - Connected System Developer

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
problem in running a basic code in python 3.3.0 that includes HTML file Satabdi Mukherjee Python 1 04-04-2013 07:48 PM
difference Inherits CompositeControl vs Inherits WebControl ton ASP .Net Building Controls 1 06-24-2007 07:49 AM
Inherits from Control, Yay, Inherits from WebControl, Nay.... Alex Nitulescu ASP .Net 0 02-22-2005 05:55 AM
a class inherited from ArrayList, is saved to ViewState, why the type of the object read from ViewSate is not the class, but the parent, ArrayList leal ting ASP .Net 1 02-10-2004 07:45 PM



Advertisments