This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

minOccurs and maxOccurs in wsdl being igored by Axis WSDL2Java

 
Cindy Jones
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a wsdl file with a webservice method that is supposed to return a list of Java objects.
The element is defined as
<xsd:complexType>
<xsd:sequence minOccurs="1" maxOccurs="1000">

However when I generate the client classes using org.apache.axis.wsdl.WSDL2Java, I am not getting a List as the return type.

Does axis ignore maxOccurs? What can I do to construct the classes correctly?

Thanks in advance!

 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Axis 1.x is based on JAX-RPC 1.1 (JSR-101).

JAX-RPC 1.1 (JSR-101) wrote:An element in a complex type with the maxOccurs attribute set to a non-negative integer greater than 1 or unbounded is mapped to a Java array with a pair of setter and getter methods in the JavaBeans class. The Java type of the array is mapped from the type attribute of the XML element. Refer to the following example. The JAX-RPC specification does not require support for all different combinations of the occurrence constraints (minOccurs, maxOccurs)


In other words the Java type that the XML is being mapped to is under no obligation to actually enforce the actual minOccurs/maxOccurs limits. It's obligations are
  • types with maxOccurs > 1 are mapped to an array
  • types that map to primitive Java types have to map to the corresponding Wrapper type (e.g. int -> Integer) if minOccurs=0 and maxOccurs=1

  • See also the topic Axis2 support for collections for suggestions for general List <-> Array conversions.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic