views:

14

answers:

1

I am using a asp.net WSE web service in my web application.

For some reason, some collections are in the form of an array.

i.e. I am doing:

MyService.SomeObject so = new MyService.SomeObject();

so.SomeCollection = new SomeCollection[0];

Yet the developer of the service says he defined it as a List, not an array.

Is this common where the types don't match between the actual service and the client proxy?

What about enumerations, do they serialize/deserialize properly?

+1  A: 

In the metadata (be is SOAP or MEX), they are just repeated elements. The proxy-generation tool can choose to interpret that in a variety of ways, and generally provide options to control this (in the advanced page in VS, IIRC - or at the command line).

Serialization should still be fine.

Marc Gravell
it seems under properties, we are forced to tell what kind of collection we want e.g. array, or generic list, etc. Can't we just tell it to use whatever the web service has internally?
Blankman
@Blankman - not unless you use assembly-sharing via WCF, no. The "service" is defined by SOAP/MEX, which does **not** include strong type information; simply "multiple of [these], named as [that]"
Marc Gravell
i'm not using WCF, we are using old school WSE i.e. .asmx
Blankman
@Blankman - *exactly*; and hence you are subject to the rules of SOAP. And SOAP doesn't distinguish between arrays/lists/collections/anything-else; simply ordinality in terms of (if I take the liberty of using regex notation) {1}, ?, +, * or {n,m}
Marc Gravell