Friday, September 30, 2005

ECO objects cannot be serialized !!!

I just understand that why Borland didnot promote enough their use of ECO for Web Services. I also realize that why there are only few discussion about Web Services issue on ECO news group. It is because we cannot directly use ECO types as WS complex types.


Here is my simple code:


[WebMethod]
public SystemUser[] ListAllUsers() {
SystemUserEA ea = (SystemUserEA)AccessFactory.Create(EcoSpace,
typeof(SystemUserEA));
return ea.FindAll();
}



However, I've already got the idea and trick how to make ECO fully support Web Services :).

2 comments:

Peter Morris said...

Hi Chanwit, here are some thoughts.

To me a service is the front end (like a GUI) whereas the object classes are the back end (the implementation).

The front end is an interface to the business logic, so when creating a webservice (to me) it makes no sense to pass around true ECO objects.

Passing ECO objects gives the consumer a dependancy on the structure of your implementation, rather than the structure of your service. This makes it more difficult to change the implementation without having to update all of your clients.

So, I'd be more inclined to pass structs or, preferably, some kind of XML structure as it can be parsed directly into HTML etc.

Peter Morris said...

PS: I wrote an XmlQueryService, so you can parse an xml query against the object space and produce XML output.