Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

minOccurs and maxOccurs in wsdl being igored by Axis WSDL2Java

 
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!

 
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.
     
    passwords must contain 14 characters, a number, punctuation, a small bird, a bit of cheese and a tiny ad.
    Thread Boost feature
    https://coderanch.com/t/674455/Thread-Boost-feature
      Bookmark Topic Watch Topic
    • New Topic