2012-08-28 20 views
1

我有一個使用axis + ant + jboss生成的wsdl文件。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序列屬性出現在PushActionInf之前o屬性。在這種情況下,它們混合在一起。其結果是:

代碼:

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描述了軸心國的問題。

所以我試着用JbossWS + JAXB生成一個不同的wsdl文件。兩者都按字母順序提供答覆。有什麼方法可以改變響應元素的順序嗎?

在此先感謝。

回答

0

您可以在@XmlType註釋中指定propOrder來指定元素的順序。

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

更多信息

+0

我知道我是應對舊線..但propOrder是不是爲我工作。爲了利用jaxb功能,我需要使用任何特殊功能嗎? – priceline

+0

@priceline - 您可以針對您所看到的問題發佈一個新問題嗎? –