0

I am using following type to generate web service response class:

        <xsd:complexType name="SaveUniversalIdsRequest">
           <xsd:sequence>
              <xsd:element name="persist" type="mu:UniversalIdList" />
              <xsd:element name="remove" type="xsd:long" />
              <xsd:element name="secString" type="xsd:string" />
           </xsd:sequence>
        </xsd:complexType>

And it generates a class with protected long remove;

But i want to generate an array instead. Adding minOccurs="0" maxOccurs="unbounded" generates a List.

Please, assist.

johnny-b-goode
  • 3,512
  • 12
  • 42
  • 62

2 Answers2

0

As you can find this : What is the WSDL declaration for an array of integers?

<element name="ArrayOfLongs">
 <complexType>
  <sequence>
   <element maxOccurs="unbounded" name="remove" type="xsd:long"/>
  </sequence>
 </complexType>
</element>
Community
  • 1
  • 1
0

You need to use the jaxb customized bindings feature - Customizing XML Schema-to-Java Mapping Using Binding Declarations
try with the following command:

wsimport -verbose -b jaxbindings.xml -keep -Xnocompile -p com.vmware.vim25 -s "src" vimService.wsdl

The content of the jaxbingdings.xml is:

<?xml version="1.0" encoding="UTF-8"?>
   <jaxb:bindings xmlns:xsd="http://www.w3.org/2001/XMLSchema"
     jaxb:version="2.1"
     xmlns:jaxb="http://java.sun.com/xml/ns/jaxb">
       <jaxb:globalBindings
           collectionType ="indexed"
           generateIsSetMethod="false">
       </jaxb:globalBindings>
    </jaxb:bindings>

Note the collectionType should be indexed. you can also set this to your own definied list like com.my.List.

scugxl
  • 317
  • 3
  • 14