我正在使用RestWebservice進行少量基本操作,例如創建/搜索。請求XML看起來是這樣的其他WebService錯誤處理
<customer>
<name/>
.....
</customer>
對於成功的操作我回到同一客戶XML與人口中有多餘的領域(如的systenId等我們空白的要求)。 與Response.Status = 2000
對於不成功的操作,我用不同的錯誤代碼返回類似的東西。 如Response.Status = 422(無法處理的實體) Response.Status = 500(內部服務器錯誤)和其他幾個..
<errors>
<error> An exception occurred while creating the customer</error>
<error> blah argument is not valid.</error>
</errors>
現在,我不知道,這是否發送錯誤的正確方法給客戶。也許它應該出現在響應的標題中。
我會很感激任何幫助。 謝謝!
看到這個問題http://stackoverflow.com/questions/942951/rest-api-error-return-good-practices這是幾乎相同的問題。 – 2009-08-24 16:00:28