You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Martin Grotzke <ma...@javakaffee.de> on 2005/09/02 18:34:29 UTC
Re: java to wsdl: How to generate minOccurs="0" instead of
nillable="true"
On Fri, 2005-09-02 at 08:54 -0400, Anne Thomas Manes wrote:
> I suggest that you file a feature enhancement request to add a
> parameter to generate minOccurs="0".
good idea, just submitted.
cheers,
martin
>
> Anne
>
> On 8/31/05, Martin Grotzke <ma...@javakaffee.de> wrote:
> On Wed, 2005-08-31 at 10:57 -0400, Mike Woinoski wrote:
> > Martin Grotzke wrote:
> > > Btw, the concrete problem that we had has to do with
> C# / .NET 1.1:
> > > if you send an empty xml-element (as you showed below)
> for
> > > some primitive C#-type (e.g. int, long), then the .NET
> > > deserializer crashes, as it cannot parse the empty value.
> > > If you do not send this empty element (which is forced by
> > > minOccurs="0" as it seems), the .NET deserializer does
> his
> > > job.
> >
> > I've only seen Java2WSDL define nillable="true" on
> non-primitives (Strings,
> > value types, etc.) If Java2WSDL is adding nillable="true" to
> primitives, it may
> > be an Axis bug. You may want to look on Bugzilla to see if
> anyone has reported
> > it yet.
> In java we use the wrapper types, not the primitives. But a
> java Integer
> is represented by an xsd:int, which is mapped to the C#
> primitive int.
> So it's not an axis bug...
>
> Cheers,
> Martin
>
>
> >
> > Regards,
> > Mike
> >
> > >
> > > Thanx again,
> > > Martin
> > >
> > >
> > >
> > > On Tue, 2005-08-30 at 10:16 -0400, Mike Woinoski wrote:
> > >
> > >>Martin,
> > >>I don't think there is a Java2WSDL option that adds
> minOccurs="0" to an element
> > >>definition. However, you can edit the WSDL manually and
> add it yourself (sounds
> > >>like a good job for an Ant task or shell script.)
> > >>
> > >>BTW, an element can have both nillable="true" and
> minOccurs="0". The semantics
> > >>of these attributes is different: nillable="true" allows
> an XML element to have
> > >>a value equivalent to a Java null reference:
> > >> <...
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> > >> <myelement xsi:nil="true"/>
> > >>
> > >>This is different than a plain empty element:
> > >> <myelement/>
> > >>which is equivalent to a Java String object with length
> 0.
> > >>
> > >>Mike
> > >>
> > >>Martin Grotzke wrote:
> > >>
> > >>>Hello,
> > >>>
> > >>>when creating the wsdl from java classes, is there's any
> way
> > >>>to change the default behavior from generating
> nillable="true"
> > >>>to minOccurs="0" (for interop with .net)?
> > >>>
> > >>>thanx in advance,
> > >>>martin
> > >>>
> > >>
> > >>
> > >>
> >
> >
> >
> --
> Martin Grotzke
> Hohenesch 38, 22765 Hamburg
> Tel. +49 (0) 40.39905668
> Mobil +49 (0) 170.9365656
> E-Mail martin.grotzke@javakaffee.de
> Online http://www.javakaffee.de
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2 (GNU/Linux)
>
> iD8DBQBDFf4R7FvOl7Te
> +pYRAjTlAJwOEU5rLSqG27uBdANQYpJtf3v7DwCfVdg5
> xfTXy/ZJKgVjB5E2GlN0rXM=
> =ie28
> -----END PGP SIGNATURE-----
>
>
>
--
Martin Grotzke
Hohenesch 38, 22765 Hamburg
Tel. +49 (0) 40.39905668
Mobil +49 (0) 170.9365656
E-Mail martin.grotzke@javakaffee.de
Online http://www.javakaffee.de