axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan Powell" <...@Wellogic.com>
Subject RE: Philosophical question about WSDL and web service frameworks
Date Wed, 16 Jan 2002 22:09:52 GMT
Similar to the suggestion below, you could have an int property that
indicates which choice is selected.  On setXXX() just change the index
to the value for that option, thus enforcing "at most one selected".

-dan

-----Original Message-----
From: James Yegerlehner [mailto:james@kamiak.com] 
Sent: Wednesday, January 16, 2002 4:54 PM
To: axis-dev@xml.apache.org
Subject: Re: Philosophical question about WSDL and web service
frameworks

Rich and Russel-

Regarding the xsd:choice compositor and its mapping to java: Russel
said:

> If you have some suggestions as to how we'd map these to Java, we'd
like
to
> hear them.


OK here's an idea. It seems pretty obvious, so maybe you'll have better
ones:

Since Axis already maps "xsd:sequence" and xsd:all" compositors to a
bean,
the same could be done with "xsd:choice" with minor impact. A trivial
(no
methods) interface, called "ChoiceCompositor" could be defined, which,
when
implemented by a bean, implies the choice semantics. That is, it implies
that at most one of the bean's properties can be non-null.

Optionally: the internal storage of each bean property could be "final",
and
in the set function for the property, if any of the other properties is
non-null, an exception is thrown. This will enforce the mutual
exclusivity
of the presence of the members.

I'm not familiar with the Axis internals, but I'd expect this solution
would
impact four pieces:

1. WSDL2Java: "implements ChoiceCompositor" must be part of the bean
declaration when it is emitted.

2. Java2WSDL: detect that the bean implements the "ChoiceCompositor",
and
emit "choice" as against "sequence" or "all"

3. Bean serializer: detect that the ChoiceCompositor interface is
implemented, and serialize only the non-null member.

4. Bean deserializer: ascertain which member of the "choice" is present,
and
assign it. Skip the other members.

Hope that makes sense.

Regards,

------------
James Yegerlehner
Omniopera: XML Schema and WSDL Authoring Software
http://www.omniopera.com




Mime
View raw message