Home All Groups Group Topic Archive Search About

Passing an enum to a web method

Author
10 Apr 2006 6:49 PM
Tony
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

Author
10 Apr 2006 8:23 PM
Martin Kulov [MVP]
"Tony" <tony***@spacecommand.net> wrote in message
news:e1HNu9MXGHA.1352@TK2MSFTNGP05.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
Author
11 Apr 2006 6:39 AM
Tony
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

Show quote
"Martin Kulov [MVP]" <ku***@bezbokluk.abv.bg> wrote in message
news:OAoWmyNXGHA.1352@TK2MSFTNGP05.phx.gbl...
> "Tony" <tony***@spacecommand.net> wrote in message
> news:e1HNu9MXGHA.1352@TK2MSFTNGP05.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
>
Author
11 Apr 2006 8:42 PM
Martin Kulov [MVP]
"Tony" <tony***@spacecommand.net> wrote in message
news:ekFD6KTXGHA.4148@TK2MSFTNGP03.phx.gbl...
> 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

AddThis Social Bookmark Button