Re: Using Enum type as Webservice Parameter
- From: stcheng@xxxxxxxxxxxxxxxxxxxx (Steven Cheng[MSFT])
- Date: Fri, 07 Apr 2006 03:20:46 GMT
{\rtf1\ansi\ansicpg936\deff0\deflang1033\deflangfe2052{\fonttbl{\f0\fnil\fprq2\fcharset0 MS Sans Serif;}}
\viewkind4\uc1\pard\lang2052\f0\fs20 Hi Martin,
\par
\par As Martin Kulov mentioned, generally enum types are represented by xsd enumeration simple type like below:
\par
\par <s:simpleType name="TestEnum">
\par - <s:restriction base="s:string">
\par <s:enumeration value="A" />
\par <s:enumeration value="B" />
\par </s:restriction>
\par </s:simpleType>
\par
\par so it can not hold two value pairs(or the mapping info). For your scenario,I think you can consider use the XmlEnumAttribute to
\par specify the enum's actual number value as the underlying xmlserialization value. e.g:
\par
\par =================
\par Public Enum TestEnum As Integer
\par
\par <XmlEnum("128")> _
\par Enum1 = 128
\par
\par <XmlEnum("256")> _
\par Enum2 = 256
\par
\par End Enum
\par ====================
\par
\par thus, the "Enum1" will be transfered as "128", "Enum2" will be transfered as "256" in SOAP message, and when arrive the other side, it will be deserizlied to the .net enum value.
\par
\par Hope this helps.
\par
\par Regards,
\par
\par Steven Cheng
\par Microsoft Online Community Support
\par
\par
\par ==================================================
\par
\par When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue.
\par
\par ==================================================
\par
\par
\par This posting is provided "AS IS" with no warranties, and confers no rights.
\par
\par
\par
\par Get Secure! www.microsoft.com/security
\par (This posting is provided "AS IS", with no warranties, and confers no rights.)
\par
\par
\par
\par }
- References:
- Re: Using Enum type as Webservice Parameter
- From: Martin Kulov [MVP]
- Re: Using Enum type as Webservice Parameter
- Prev by Date: RE: Precompile ASP.NET Web services problems
- Next by Date: WebProxy url : web method call intermittently failing
- Previous by thread: Re: Using Enum type as Webservice Parameter
- Next by thread: WebProxy url : web method call intermittently failing
- Index(es):
Relevant Pages
|