It is strange that .NET would internally make a selection list an
integer when it should be passed to Remedy in the XML as a string.
Here is an example from a sample web service on a sample form here. This
was pulled directly from the View WSDL tab in the Web Service definition
window of the Admin tool (spacing added for readability).
<xsd:complexType name="CreateInputMap">
<xsd:sequence>
<xsd:element minOccurs="0" name="Character_Field"
type="xsd:string" />
<xsd:element minOccurs="0" name="Date_Field"
type="xsd:date" />
<xsd:element minOccurs="0" name="Date_Time_Field"
type="xsd:dateTime" />
<xsd:element minOccurs="0" name="Real_Number_Field"
type="xsd:double" />
<xsd:element name="Short_Description"
type="xsd:string" />
<xsd:element minOccurs="0" name="Time_Field"
type="xsd:time" />
<xsd:element name="Status"
type="s0:StatusType" />
<xsd:element minOccurs="0" name="Integer_Field" type="xsd:int"
/>
<xsd:element minOccurs="0" name="Selection_List"
type="s0:Selection_ListType" nillable="true" />
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="StatusType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Active" />
<xsd:enumeration value="Outdated" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="Selection_ListType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Black" />
<xsd:enumeration value="Maroon" />
<xsd:enumeration value="Green" />
<xsd:enumeration value="Olive" />
<xsd:enumeration value="Blue" />
<xsd:enumeration value="Violet" />
<xsd:enumeration value="Teal" />
<xsd:enumeration value="Grey" />
<xsd:enumeration value="Silver" />
<xsd:enumeration value="Red" />
<xsd:enumeration value="Bright Green" />
<xsd:enumeration value="Yellow" />
<xsd:enumeration value="Light Blue" />
<xsd:enumeration value="Fushia" />
<xsd:enumeration value="Aqua" />
<xsd:enumeration value="White" />
</xsd:restriction>
</xsd:simpleType>
As you can see the Status field and Selection_List fields are a
restriction base of string. In the above example the Status field can't
be Null of course while Selection_List can be.
Fred
-----Original Message-----
From: Action Request System discussion list(ARSList)
[mailto:[email protected]] On Behalf Of maggie2007
Sent: Wednesday, April 08, 2009 8:19 AM
To: [email protected]
Subject: Re: serialize webservice response error:The string '' is not a
valid AllXsd value.
Lyle, did you have the same problem as I described?
For integer field, datetime field, it is ok as long as you set
nillable=true, minOccurs=0 on the output mapping.
But for drop-down list field (which is enumeration type in WSDL), the
value
cannot be empty. I found out that the workaround is to add an empty
enumeration value. This way even customer select "(clear)" for that
drop-down list field, serialization will be ok on my .Net client.
The .NET framework for working with web services creates a class that
represents the web service for use in your application. Selection
fields
(or dates or other numerical fields) get represented by numbers,
DateTimes,
or enums which can't be null in .NET, because they are value types and
not
reference types. As a result, any time you try to retrieve a record
that
has NULL in one of those fields, you will get an error. The work around
we
found was to manually edit the WSDL after you create the web service and
change the type of all of those fields to a string. String is a
reference
type and can be null, so you will no longer get the error. If you need
to
work with the values in the correct data type in your .NET code, you can
convert the string to the desired data type after retrieving it from the
web
service and then work with it that way.
Lyle
_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
Platinum Sponsor: RMI Solutions ARSlist: "Where the Answers Are"