Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: enumerations

$
0
0
Re: enumerations
Web Service Proxy Generator
Re: enumerations
05/14/2012
01:00:53 PM
3I30RWASK Show this entire thread in new window
Gratar Image based on email address
From:
Rick Strahl
To:
Attachments:
None
It's not a string it's an enum value, but yes you can pass an integer. Alternately you can use the SetStaticProperty() method to set an enum value:

*** Getting and setting an Enum value lnEnum = loBridge.GetEnumValue("System.Windows.Forms.MessageBoxIcon.Warning") ? lnEnum && 48 *** Set Enum Value loBridge.SetStaticProperty("System.Windows.Forms.MessageBoxIcon",lnEnum)

+++ Rick ---


so i should expect to see an int32 and the proxy will translate that to a string for submission to the web service?


sorry, the nullable aspect was really an afterthought...

... what i was really asking was if it was usual to see what the wsdl defines as strings appear as int32 in the reflector (and in the proxy object).

I'm still trying to track down what is causing that "parameter is incorrect" response.


n

Enumerations aren't nullable, so you have to pick one of the values on the enumeration. Enumerations usually contain an 'Empty' or 'None' value if they are intended to not hold a value, but that's up to the designer of the type.

+++ Rick ---


there are some enumerations in the WSDL i'm using;

<s:complexType name="Applicant">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="id" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="ReportType" type="tns:REPORT_TYPE"/>
<s:element minOccurs="1" maxOccurs="1" name="Type" type="tns:APPLICANT_TYPE"/>
<s:element minOccurs="1" maxOccurs="1" name="Title" type="tns:TITLE_TYPE"/>
<s:element minOccurs="1" maxOccurs="1" name="ShareOfMonthlyRent" type="s:int"/>
<s:element minOccurs="0" maxOccurs="1" name="Forename" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Middlenames" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Surname" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="MaidenName" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Email" type="s:string"/>
<s:element minOccurs="1" maxOccurs="1" name="Gender" type="tns:GENDER_TYPE"/>
<s:element minOccurs="1" maxOccurs="1" name="DOB" type="s:dateTime"/>
<s:element minOccurs="1" maxOccurs="1" name="MaritialStatus" type="tns:MARTIAL_STATUS_TYPE"/>
<s:element minOccurs="0" maxOccurs="1" name="Home_Phone" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Work_Phone" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Mobile" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="CurrentAddress" type="tns:PostalAddress"/>
<s:element minOccurs="1" maxOccurs="1" name="CurrentMovedIn" type="s:dateTime"/>
<s:element minOccurs="0" maxOccurs="1" name="PrevAddress" type="tns:PostalAddress"/>
<s:element minOccurs="1" maxOccurs="1" name="PrevMovedIn" type="s:dateTime"/>
<s:element minOccurs="1" maxOccurs="1" name="PrevMovedOut" type="s:dateTime"/>
</s:sequence>
</s:complexType>
<s:simpleType name="REPORT_TYPE">
<s:restriction base="s:string">
<s:enumeration value="BASIC"/>
<s:enumeration value="FULL"/>
</s:restriction>
</s:simpleType>
<s:simpleType name="APPLICANT_TYPE">
<s:restriction base="s:string">
<s:enumeration value="APPLICANT"/>
<s:enumeration value="GUARANTOR"/>
</s:restriction>
</s:simpleType>
<s:simpleType name="TITLE_TYPE">
<s:restriction base="s:string">
<s:enumeration value="MR"/>
<s:enumeration value="MRS"/>
<s:enumeration value="MISS"/>
<s:enumeration value="MS"/>
<s:enumeration value="DR"/>
<s:enumeration value="PROF"/>
<s:enumeration value="REV"/>
</s:restriction>
</s:simpleType>
<s:simpleType name="GENDER_TYPE">
<s:restriction base="s:string">
<s:enumeration value="MALE"/>
<s:enumeration value="FEMALE"/>
</s:restriction>
</s:simpleType>
<s:simpleType name="MARTIAL_STATUS_TYPE">
<s:restriction base="s:string">
<s:enumeration value="SINGLE"/>
<s:enumeration value="MARRIED"/>
<s:enumeration value="SEPARATED"/>
<s:enumeration value="DIVORCED"/>
<s:enumeration value="WIDOWED"/>
<s:enumeration value="COHABITATING"/>
</s:restriction>
</s:simpleType>


when i look at these in the .net reflector it reports them as int32. "MR" = 0, "FEMALE"=1, "MALE" = 0 etc. Is this to be expected? It makes it hard for me to leave blank (meaning "unknown").

nigel







Rick Strahl
West Wind Technologies

Making waves on the Web

from Maui, Hawaii

Viewing all articles
Browse latest Browse all 10393

Trending Articles