我正在嘗試開發一個Java程序,它將簡單地調用目標URL上的Web服務。從Java調用Web服務
請求方法是POST,(GET不支持)。
對於這個在我的程序中我使用的是java.net.*
庫。我想在發佈請求中發送一個xml文件。每當我運行客戶端程序,它給了我以下錯誤:
java.io.IOException:server returned response code 500
然後當我在服務器日誌中檢查有以下異常:
org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [spring] in context with path [/targetdirectory] threw exception [Request processing failed; nested exception is org.springframework.oxm.UnmarshallingFailureException: JAXB unmarshalling exception; nested exception is javax.xml.bind.UnmarshalException - with linked exception:.....
在我使用jaxb2marshaller服務器端,框架春天3.0 mvc。
所有其他的客戶端,如在PHP中都能夠使用php cURL調用相同的webservice。