axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Barrett" <JBarr...@sawyermedia.com>
Subject using XML schema types for enumeration (was RE: how to serialize/deserialize static final fields)
Date Fri, 07 Feb 2003 17:36:57 GMT
I'm a little confused here, and new to axis, wsdl, soap, etc.

I saw a couple people respond with this solution.

It's unclear to me what the usage pattern here is.  This simple types definition is put in
the wsdl.  But what then?  How do you access the enumeration from client code?

>From Liviu's example, it seems like the sequence of events is:
1) client calls the service to ask what options are available
2) service responds with options
3) client calls with the chosen option

But if using simple types in xml schema in the wsdl of the service, are you querying the service?
 Just reading the wsdl?

thanks,
+jeff

> -----Original Message-----
> From: Liviu Chiriac [mailto:liviuc@inetsoft.com]
> Sent: Friday, February 07, 2003 6:23 AM
> To: axis-user@ws.apache.org
> Subject: RE: how to serialize/deserialize static final fields
> 
> 
> 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:btomasini@neteverything.com] 
> Sent: Thursday, February 06, 2003 7:45 PM
> To: axis-user@ws.apache.org
> 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
> > 
> 
> 
> 
> 
> 

Mime
View raw message