> Is there any way of getting a public enumeration to be generated into
> a web service proxy?
This works for me:
<codeSnippet language="C#">
[Flags]
public enum TestEnum
{
None = 0,
Value1 = 1,
Value2 = 2
}
[WebMethod]
public TestEnum ReturnEnum()
{
return TestEnum.None;
}
</codeSnippet>
It generates the following Schmea within the WSDL:
<s:simpleType name="TestEnum">
<s:list>
<s:simpleType>
<s:restriction base="s:string">
<s:enumeration value="None" />
<s:enumeration value="Value1" />
<s:enumeration value="Value2" />
</s:restriction>
</s:simpleType>
</s:list>
</s:simpleType>
Which the proxy generator seems to parse just fine. I end up with the same
enum on the client. Also beware that the values will not be the same, but
they don't need to be since the enum name is all that matters in the realm
of XML.
HTH,
Dre
DMitchell - 29 Nov 2004 15:49 GMT
Thanks Drew. Have tried that and just does not generate anything into the
proxy. Will try on another machine.
> > Is there any way of getting a public enumeration to be generated into
> > a web service proxy?
[quoted text clipped - 38 lines]
> HTH,
> Drew
DMitchell - 29 Nov 2004 16:09 GMT
Drew - What is the [Flags] bit for ? Am writing my web service in
VB.Net...what would the equivalent for it? Cannot find any reference in MSDN.
Thanks.
> > Is there any way of getting a public enumeration to be generated into
> > a web service proxy?
[quoted text clipped - 38 lines]
> HTH,
> Drew
Drew Marsh - 29 Nov 2004 16:44 GMT
> Drew - What is the [Flags] bit for ? Am writing my web service in
> VB.Net...what would the equivalent for it? Cannot find any reference
> in MSDN.
Oh, you might not need that. It's short for FlagsAttribute which you can
read about here[1]. If you don't need bitwise enums, then you don't need
the attribute. Even without that attribute applied to my enum, it works.
Enums are a well supported concept in Microsoft's web services tools.
HTH,
Drew
[1] http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemflagsattributeclas
stopic.as
Stuart Hemming (via DFN-CIS NetNews Service) - 30 Nov 2004 09:31 GMT
On 29/11/2004, around 09:29, Drew Marsh wrote:
<delurk>
Drew, thanks for that. Something I didn't know and can definitely use.
DM> http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemflagsattributeclas
stopic.asp
</delurk>

Signature
Stuart
See headers for PGP Key.
The darkest hour is just before dawn. So if you're going to steal your
neighbour's milk, that's the time to do it.