2012-03-01 143 views
0

這來源於此方法javax.xml.bind.UnmarshalException:意外的元素

@WebResult(name = "logoutResponse", 
targetNamespace = "http://schemas.novell.com/2005/01/GroupWise/methods", 
partName = "logoutRes") 
@WebMethod(action = "logoutRequest") 
    public com.novell.schemas._2005._01.groupwise.methods.LogoutResponse 
    logoutRequest(
    @WebParam(partName = "logoutReq", name = "logoutRequest", 
    targetNamespace = "http://schemas.novell.com/2005/01/GroupWise/methods") 
    com.novell.schemas._2005._01.groupwise.methods.LogoutRequest logoutReq, 
    @WebParam(partName = "sessionId", name = "session", 
    targetNamespace = "http://schemas.novell.com/2005/01/GroupWise/types", 
    header = true) 
    java.lang.String sessionId, 
    @WebParam(partName = "gwTrace", name = "gwTrace", 
    targetNamespace = "http://schemas.novell.com/2005/01/GroupWise/types", 
    header = true) 
    boolean gwTrace 
    ); 

得到的錯誤是:

javax.xml.bind.UnmarshalException: unexpected element 
(uri:"http://schemas.novell.com/2005/01/GroupWise/methods", local:"code"). 
Expected elements are <{http://schemas.novell.com/2005/01/GroupWise/types}info>, 
<{http://schemas.novell.com/2005/01/GroupWise/types}code>, 
<{http://schemas.novell.com/2005/01/GroupWise/types}description>, 
<{http://schemas.novell.com/2005/01/GroupWise/types}problems> 

我不明白什麼是錯的,因爲代碼屬性在那裏。這些預期的元素是Status對象的一部分,其他使用相同Status對象的響應方法完全沒有問題

回答

0

請檢查您的@XmlSchema Annotationpackage-info.java。嘗試再次重新生成您的Java類。

+0

我看到的全是@ javax.xml.bind.annotation.XmlSchema(namespace =「http://schemas.novell.com/2005/01/GroupWise/methods」,elementFormDefault = javax.xml.bind.annotation。 XmlNsForm.QUALIFIED),每次都會重新編譯Java類。如果你閱讀的只是50中的一種方法不起作用 – javaNoober 2012-05-17 22:24:00

+1

基本上發生了什麼是解組錯誤,當你解組時。我在反序列化xmls時遇到了類似的異常;當我添加package-info類時已解決。順便說一句,你的包信息看起來不錯。 – 2012-05-18 11:36:44

相關問題