开发者

Using existing business logic in a webservice

I have a very simple method GetMembers() in a class MemberCollection which inherits from list, this method returns a list of members straight from the sele开发者_JS百科cted database and currently sits in a class library.

I would like to have a webservice which will sit on the live server and can utilise this business logic class library which calls this existing method and returns me a MemberCollection object which I can then use on a winforms application.

I am currently struggling to make this work as it seems to be returning an array of the member object (member[]) rather than the actual MemberCollection object and all the types are wrong.

I hope this makes sense.


in the case of SOAP webservices Lists will be converted to arrays while they are returned from the service. You can write a wrapper instead to convert them to lists. Or you can use a WCF where you configure it to return System.Collections.Generic.List


You might need to use the CollectionDataContract attribute on the MemberCollection class definition. See here for more info.

Also - your classes need to be serializable. You may need to remove the data access code from the class in order to send it over the wire.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜