1

我有一个使用axis+ant+jboss生成的wsdl文件。

超类 ActionInfo wsdl 定义:

代码:

<complexType abstract="true" name="ActionInfo">
 <sequence>
  <element name="configUnitId" nillable="true" type="xsd:string"/>
  <element name="configUnitType" nillable="true" type="xsd:string"/>
  <element name="desc" nillable="true" type="xsd:string"/>
  <element name="errorCode" nillable="true" type="xsd:int"/>
  <element name="id" nillable="true" type="tns2:ResourceIdentityInfo"/>
  <element name="result" nillable="true" type="xsd:string"/>
  <element name="status" nillable="true" type="xsd:string"/>
 </sequence>
</complexType>

子类 PushActionInfo wsdl 定义:

代码:

<complexType name="PushActionInfo">
<complexContent>
 <extension base="tns19:ActionInfo">
  <sequence>
   <element name="activationMethod" nillable="true" type="xsd:string"/>
   <element name="activationRequired" type="xsd:boolean"/>
   <element name="binaryContent" type="xsd:boolean"/>
   <element name="category" nillable="true" type="xsd:string"/>
   <element name="contentType" nillable="true" type="xsd:string"/>
   <element name="destinationName" nillable="true" type="xsd:string"/>
   <element name="dynamic" type="xsd:boolean"/>
   <element name="maskableContent" nillable="true" type="tns2:MaskableContentInfo"/>
   <element name="payloadName" nillable="true" type="xsd:string"/>
   <element name="postOps" nillable="true" type="impl:ArrayOf_xsd_string"/>
   <element name="pushMechanism" type="xsd:int"/>
   <element name="rollback" type="xsd:boolean"/>
   <element name="snmpEnabled" type="xsd:boolean"/>
  </sequence>
 </extension>
 </complexContent>
 </complexType>

根据 WSDL 定义,预计 ActionInfo 序列属性出现在 PushActionInfo 属性之前。在这种情况下,它们是混合的。结果是:

代码:

PushActionInfo (current)
activationMethod
activationRequired
binaryContent
category
configUnitId – extension of ActionInfo
configUnitType - extension of ActionInfo
contentType
desc - extension of ActionInfo
destinationName
dynamic
errorCode - extension of ActionInfo
id - extension
maskableContent
payloadName
postOps
pushMechanism
result - extension of ActionInfo
rollback
snmpEnabled
status - extension of ActionInfo

但我的期望是:

代码:

configUnitId – extension of ActionInfo
configUnitType - extension of ActionInfo
desc - extension of ActionInfo
errorCode - extension of ActionInfo
result - extension of ActionInfo
status - extension of ActionInfo
activationMethod
activationRequired
binaryContent
category
contentType
destinationName
dynamic
id - extension
maskableContent
payloadName
postOps
pushMechanism
rollback
snmpEnabled

此链接https://issues.apache.org/jira/browse/AXIS-2677描述了 Axis 的问题。

所以我尝试使用 JbossWS+JAXB 来生成不同的 wsdl 文件。两者都按字母顺序给出响应。有没有办法改变响应元素的顺序?

提前致谢。

4

1 回答 1

0

您可以propOrder@XmlType注解上指定 a 来指定元素的顺序。

@XmlType(propOrder={"ID", "firstName", "lastName"})
public class Customer {
   ..
}

了解更多信息

于 2012-08-28T18:37:17.543 回答