Problem in defining web service method which returns Hashtable

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have a web service method which needs to return a hashtable.But it
gives errror as,

The type System.Collections.Hashtable is not supported because it implements
IDictionary.

Is there any way to return hashtable through a web method other than
implementing the IDictionary?
Please do tell me if any one knows.
 
I think I remember they found a way to serialize HT in 2.0. Until then, you
could just implement a simple class with two public fields, a string for the
key and your type as the value. Then just return an array of that class
(after you fill it from the hashtable). I am thinking about WSE web methods
here. Not sure this will work with IIS web methods.
 
William Stacey said:
I think I remember they found a way to serialize HT in 2.0. Until then, you
could just implement a simple class with two public fields, a string for the
key and your type as the value. Then just return an array of that class
(after you fill it from the hashtable). I am thinking about WSE web methods
here. Not sure this will work with IIS web methods.

Will WSE make any differences to the return type of the webmethod William?,
I mean if it works with WSE theoritically it should work with normal
webmethod...
 
I would say "should" as I have been using WSE mostly and forgot if custom
types and arrays of types return ok with std web services. Easy to hack up
a quick test to know for sure.

--
William Stacey, MVP
http://mvp.support.microsoft.com

Champika Nirosh said:
William Stacey said:
I think I remember they found a way to serialize HT in 2.0. Until then, you
could just implement a simple class with two public fields, a string for the
key and your type as the value. Then just return an array of that class
(after you fill it from the hashtable). I am thinking about WSE web methods
here. Not sure this will work with IIS web methods.

Will WSE make any differences to the return type of the webmethod William?,
I mean if it works with WSE theoritically it should work with normal
webmethod...

 
Back
Top