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

H

Hammer

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?
 
R

Registered User

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.
 
H

Hammer

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 said:
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.
 
H

Hammer

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 said:
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 said:
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.
 
R

Registered User

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 said:
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 said:
On Thu, 18 Sep 2008 11:31:04 -0700, Hammer

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.
 
J

John Saunders

Registered User said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top