Exposing NameValueList through WebService

Exposing NameValueList through WebService

Old forum URL: forums.lhotka.net/forums/t/177.aspx


Pradeep posted on Tuesday, May 23, 2006

Hi all,
I am reading through the WebServices chapter in the book. We basically create a struct for Project and resource objects. If I am not mistaken, in the UpdateResource method we get a resourceInfo struct, which has a string property called role. Here we just assume that the role the user passed in is the right one?
 
How would the user application know what are the available roles in our system? I am thinking of expose the list of available roles as well in my webservice. So that the user can bind this list to a combo or whatever interface he uses and will send in a roleId in the resourceInfo struct.
 
Could anyone please tell me, what is the best way to expose a NameValueList in the WebService. Should I create another struct containing RoleId, roleName and then expose as a collection of this struct?
 
Thank You
Pradeep
 

RockfordLhotka replied on Tuesday, May 23, 2006

Yes, create a formal contract (DTO) for the name/value pair and have a method return an array of this type.

Copyright (c) Marimer LLC