Hi,
I'm developing a webservice that will accept an Order and forward it to
a backend system, but I'm having a problem with transferring my "Order"
class over a webservice.
When I try and call the webservice and pass it an Order, I get the
following error message:
The type Wright.BusinessLogicLayer.OrderLine was not expected. Use the
XmlInclude or SoapInclude attribute to specify types that are not known
statically.
Source Error:
Line 55: public string EchoOrder(Order order) {
Line 56: object[] results = this.Invoke("EchoOrder", new
object[] {
Line 57: order});
Line 58: return ((string)(results[0]));
My Order class contains a single property, which is just an ArrayList of
OrderLines.
I've tried adding the SoapAttribute but it seems to have no effect:
[WebMethod]
[SoapInclude(typeof(OrderLine))]
public string EchoOrder(Order order) {
return order.ToString();
}
Any ideas what am I doing wrong?
Thanks!
Nick...
Nick Gilbert - 25 May 2005 15:29 GMT
The odd thing is, if I change my class so that it has a single OrderLine
object instead of an arraylist of them:
public OrderLine Item {
get { return item; }
set { item = value; }
}
as opposed to:
public ArrayList OrderItems {
get { return orderItems; }
set { orderItems = value; }
}
Then it works fine. So it's obviously having trouble serializing the
ArrayList of OrderItems.
I don't know how to fix this and I can't proceed with my project until
I've got this working! Needless to say - I'm getting very stressed and
worried!
Nick...
Sami Vaaraniemi - 27 May 2005 08:22 GMT
Change the property to:
public OrderLine[] OrderItems
{
...
}
Regards,
Sami
> The odd thing is, if I change my class so that it has a single OrderLine
> object instead of an arraylist of them:
[quoted text clipped - 19 lines]
>
> Nick...