The String[] getNames() is an alternative, to get "retrieve valid
choices" from the server.

The other alternative is to define a string enumeration type in your
WSDL (as is a previous message):

<wsdl:types>
  <schema targetNamespace="urn:namespace"
xmlns="http://www.w3.org/2001/XMLSchema";>
    <simpleType name="myEnumType">
      <restriction base="xsd:string">
        <enumeration value="legalValue1" /> 
        <enumeration value="legalValue2" /> 
        <enumeration value="legalValue3" /> 
        </restriction>
    </simpleType>
  <schema>
</wsdl:types> 


But this would mean hardcoding the values in WSDL. If the Java code
changes the value for one of these static variable, one would have to
remember to modify the WSDL file. 

Liviu



-----Original Message-----
From: Benjamin Tomasini [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, February 06, 2003 7:45 PM
To: [EMAIL PROTECTED]
Subject: Re: how to serialize/deserialize static final fields

You probably can.  But that only presents a restriction... the xsd could
tell you if the message is valid.  But the xsd has little meaning once
you have de-serialized the object.

Then the object itself would have to communicate what valid choices
are.  The Enum is an example of this, so is the 

String[] getNames()

method I mentioned.

On Thu, 2003-02-06 at 19:24, Dmitri Colebatch wrote:
> > However, since you do not have control over the client side, you
will
> > never really be able to restrict what values they pass.  You can
> > "suggest it".  But that in itself is totally separate from the
JavaBean
> > construct.  JavaBeans (and the JDK proper) has no real type-safe
enum
> > construct (hence the reference to Jakara Commons above).
> 
> can you not restrict this at the xsd level?  I haven't had the
requirement
> myself, but I would find it hard to believe that its not possible.
> 
> cheers
> dim
> 




Reply via email to