javax.xml.bind.UnmarshalException:意外元素

时间:2012-03-01 05:35:27

标签: web-services cxf

这来自这个方法

@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对象的其他响应方法根本没有问题

1 个答案:

答案 0 :(得分:0)

请检查@XmlSchema Annotation中的package-info.java。尝试再次重新生成java类。