webservice接口問題:Payload: No message body writer has been found for class domain, ContentType: application/xml


當在使用cxf-rs的webservice的時候,有時候在傳輸數據,會發生這種錯誤

錯誤代碼:

Response-Code: 500
Content-Type: text/plain
Headers: {Content-Type=[application/xml], Date=[Thu, 10 Aug 2017 06:41:49 GMT]}
Payload: No message body writer has been found for class cn.itcast.bos.domain.base.Area, ContentType: application/xml

這是由於實體類上,沒有配置@XmlRootElement注解,這樣一來,webservice就沒辦法去把元素給解析成xml格式或者json格式了


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM