Martin Grotzke wrote:
Thank you for your answer, Mike!
We're using beehive for webservice development, and until
now we tried to do as most as possible starting from java.
If there's no way to tell java2wsdl to use minOccurs, it's
probably the best to define the types using schema, to go
partially the contract-first way.
In many cases, this seems to be the most reliable way to get what you want.
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.
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