1

json 配列 (listobjs) を投稿しようとしています:

List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("data", listobjs.toString()));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs, HTTP.UTF_8));
response = client.execute(httppost);

私はこのサーバーの応答を受け取ります:

11-23 13:14:23.873: E/WebServicesManager(9059): response =500
11-23 13:14:23.873: E/WebServicesManager(9059): response ={"error":{"message":"data is required","type":"Api_Exception","code":201}}

サーバーがデータ JSONArray を取得しないのはなぜですか?

多分これが役立つかもしれません、これが私がiPhoneで行う方法です:

data=[{"scan_user":"2289","scan_status":"2","scan_date":"2012-10-23 10:29:53","id_participant":"2969113"},{"scan_user":"2280","scan_status":"2","scan_date":"2012-10-23 10:40:53","id_participant":"2969112"}]
NSString * stringToPost =  [NSString stringWithFormat: @"data=%@", [participantsListToPost JSONRepresentation]];
4

3 に答える 3

0

listobjs単一の として送信する代わりにstring、すべての単一オブジェクトをループし、NameValueペアでデータを送信します。

于 2012-10-23T11:30:24.260 に答える