axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Grotzke <martin.grot...@javakaffee.de>
Subject Re: java to wsdl: How to generate minOccurs="0" instead of nillable="true"
Date Wed, 31 Aug 2005 18:59:29 GMT
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

Mime
View raw message