我尝试过使用Retrofits" Rest Builder"使用包含Java"集合"的接口方法或"阵列列表"作为参数,但总是以400或500类型错误结束。
Method in interface SvcApi
@POST(PATIENT_MEDSTAKEN + "/{patientID}")
public boolean submitMedsTaken(@Body ArrayList<MedicationTaken> medstaken, @Path("patientID") long id);
API build by:
private SvcApi symptomManagementService = new RestAdapter.Builder()
.setEndpoint(TEST_URL)
.setLogLevel(LogLevel.FULL).build()
.create(SvcApi.class);
结果:
JUnit Failure trace: retrofit.RetrofitError:500 Server Error
Eclipse控制台:
---> HTTP POST http://10.0.0.5:8080/patient/medicationstaken/1
Content-Type: application/json; charset=UTF-8
Content-Length: 63
[{"Id":0,"taken":true,"timeTaken":1415132592031,"checkinId":2}]
---> END HTTP (63-byte body)
<--- HTTP 500 http://localhost:8080/patient/medicationstaken/1 (35ms)
: HTTP/1.1 500 Server Error
Content-Language: en-US
Content-Length: 501
Content-Type: text/html;charset=ISO-8859-1
X-Application-Context: application
Server: Jetty(8.1.14.v20131031)