HighTechTalks DotNet Forums  

Passing an enum to a web method

Dotnet Framework microsoft.public.dotnet.framework


Discuss Passing an enum to a web method in the Dotnet Framework forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Tony
 
Posts: n/a

Default Passing an enum to a web method - 04-10-2006 , 01:49 PM






Does anyone know how to pass an enum to a web method?

public enum RptSetStatus
{
PendingApproval,
Active,
}

[WebMethod]
public void SetRptSetLoadComplete(Guid oUserInstance, int nRptSetId,
RptSetStatus eRptSetStatus)
{

}

Tony



Reply With Quote
  #2  
Old   
Martin Kulov [MVP]
 
Posts: n/a

Default Re: Passing an enum to a web method - 04-10-2006 , 03:23 PM






"Tony" <tonyng2 (AT) spacecommand (DOT) net> wrote

Quote:
Does anyone know how to pass an enum to a web method?

Hi Tony,

if you are using .NET framework to call the web service, in the generated
proxy class on the client should be a method definition that would allow you
to pass the enum. Additionaly you can apply XmlEnumAttribute to your enum to
describe what value you want to serialize over the wire.

Regards,

--
Martin Kulov
http://www.codeattest.com/blogs/martin

MVP, MCT, MCSD.NET Early Achiever



Reply With Quote
  #3  
Old   
Tony
 
Posts: n/a

Default Re: Passing an enum to a web method - 04-11-2006 , 01:39 AM



Yes, the client is a v2.0 win forms client application.
I get compiler errors when attempting to use the enum - so if this is
possible, I must be doing something wrong..

Tony

"Martin Kulov [MVP]" <kulov (AT) bezbokluk (DOT) abv.bg> wrote

Quote:
"Tony" <tonyng2 (AT) spacecommand (DOT) net> wrote in message
news:e1HNu9MXGHA.1352 (AT) TK2MSFTNGP05 (DOT) phx.gbl...
Does anyone know how to pass an enum to a web method?


Hi Tony,

if you are using .NET framework to call the web service, in the generated
proxy class on the client should be a method definition that would allow
you to pass the enum. Additionaly you can apply XmlEnumAttribute to your
enum to describe what value you want to serialize over the wire.

Regards,

--
Martin Kulov
http://www.codeattest.com/blogs/martin

MVP, MCT, MCSD.NET Early Achiever




Reply With Quote
  #4  
Old   
Martin Kulov [MVP]
 
Posts: n/a

Default Re: Passing an enum to a web method - 04-11-2006 , 03:42 PM



"Tony" <tonyng2 (AT) spacecommand (DOT) net> wrote

Quote:
Yes, the client is a v2.0 win forms client application.
I get compiler errors when attempting to use the enum - so if this is
possible, I must be doing something wrong..

Tony.

it would be helpful to see some sample code that is causing the error.

Martin



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.