[英]How to generate array of long from wsdl?
I am using following type to generate web service response class: 我正在使用以下类型来生成Web服务响应类:
<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; 并生成带有受保护的long remove的类;
But i want to generate an array instead. 但是我想生成一个数组来代替。 Adding minOccurs="0" maxOccurs="unbounded" generates a List.
添加minOccurs =“ 0” maxOccurs =“ unbounded”会生成一个列表。
Please, assist. 请协助。
As you can find this : What is the WSDL declaration for an array of integers? 如您所见: 整数数组的WSDL声明是什么?
<element name="ArrayOfLongs">
<complexType>
<sequence>
<element maxOccurs="unbounded" name="remove" type="xsd:long"/>
</sequence>
</complexType>
</element>
You need to use the jaxb customized bindings feature - Customizing XML Schema-to-Java Mapping Using Binding Declarations 您需要使用jaxb自定义绑定功能- 使用绑定声明自定义XML模式到Java的映射
try with the following command: 尝试使用以下命令:
wsimport -verbose -b jaxbindings.xml -keep -Xnocompile -p com.vmware.vim25 -s "src" vimService.wsdl wsimport-详细-b jaxbindings.xml-保持-Xnocompile -p com.vmware.vim25 -s“ src” vimService.wsdl
The content of the jaxbingdings.xml is: jaxbingdings.xml的内容为:
<?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. 注意collectionType应该被索引。 you can also set this to your own definied list like com.my.List.
您还可以将其设置为自己的定义列表,例如com.my.List。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.