我有一个使用axis + ant + jboss生成的wsdl文件。
SuperClass 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>
SubClass 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文件。两者都按字母顺序给出答复。有没有办法改变响应元素的顺序?
提前致谢。
答案 0 :(得分:0)
您可以在propOrder
注释上指定@XmlType
以指定元素的顺序。
@XmlType(propOrder={"ID", "firstName", "lastName"})
public class Customer {
..
}
了解更多信息