cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthias Karlsson" <>
Subject SV: minOccurs removed?
Date Thu, 28 Feb 2008 16:23:26 GMT

All these elements are part of a <xsd:sequence>, so that shouldn't be the problem. I'll
try to find time to create a small test case, though unfortunately my time currently rather
limited. I'm using 2.0.4 anyway, which is also what we use in production.


-----Ursprungligt meddelande-----
Från: Daniel Kulp [] 
Skickat: den 28 februari 2008 17:13
Kopia: Matthias Karlsson
Ämne: Re: minOccurs removed?

Quick question:
Are those elements "top level" elements or do they just occur inside 
other structures (like xsd:sequence/xsd:choice)?

It it's the former, then they are NOT supposed to have 
minOccurs/maxOccurs constraints at all.  Both should actually be 
dropped.    If you check section 3.3.2 of the XmlSchema spec  of "Part 
1: Structures", global scoped elements should not have 
minOccurs/maxOccurs.   They are only valid on element defs used as 
particals (aka: in a seq/choice).

If they are being discard when used as a partical, that's definitely a 
problem.  Any chance you can create a small test case that shows the 
problem?   Most likely, it's an XmlSchema issue.  :-(

Also, what version of CXF are you using?   2.0.4?  2.1 snapshot?


On Thursday 28 February 2008, Matthias Karlsson wrote:
> Hi,
> I'm experiencing a rather strange problem using the latest version of
> CXF. I'm creating a web service by generating code from a hand-written
> WSDL which works fine in all our tests, but now we have received a
> notification from one of our customers that the WSDL that is outputted
> does not appear to be correct.
> Example:
> <xsd:element name="company" maxOccurs="unbounded" minOccurs="0">
> 	<xsd:complexType>
> 		<xsd:sequence>
> 			<xsd:element name="name" type="xsd:string"/>
> 			<xsd:element name="category" type="xsd:string"/>
> 		</xsd:sequence>
> 	</xsd:complexType>
> </xsd:element>
> This is an example of a declared element that has a sequence (= is
> implemented as a list in the generated code). It has minOccurs="0"
> specified, but when I append ?wsdl to the web service to get its WSDL,
> I notice that this attribute as been removed. That is, it is identical
> to the element above, save for minOccurs="0".
> This is not an isolated case, but all of our elements specified in
> this way "suffer" from this.
> At first, I figured it didn't matter because minOccurs="0" might be
> the default value anyway, but after checking the specification it
> seems like both minOccurs and maxOccurs has a default value of 1,
> which means that the generated service is not identical to the WSDL I
> generated from.
> Now, I have successfully verified that I *can* send a list with zero
> entries so I know that CXF regards the list as being from 0 to
> unbounded internally, but seeing as the specification says 1 is
> default, I have to assume that depending on the framework you are
> using to generate access code, it is very much possible that code is
> generated that refuse to validate without at least one entry.
> Without going into more detail than this, has anyone else experienced
> this? Am I wrong in regard to the specification, or did I perhaps
> declare the element wrong in the WSDL?
> Thanks in advance,
> Matthias Karlsson

J. Daniel Kulp
Principal Engineer, IONA

View raw message