Bonjour à tous,
Après avoir chercher sur google, je reste sur ma faim...
Je n'arrive pas à récupérer le json renvoyé par le webservice...
Est ce que quelqu'un aurait une idée de comment résoudre ? ou comment faire autrement ?
Voilà le code en question
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 SONObject object = new JSONObject(); try { object.put("p1", 2.2); object.put("p2", 3.3); } catch (JSONException e) { e.printStackTrace(); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } WebResource webResource = Client.create().resource(nodeEntryPointUri); ClientResponse response = webResource.path("signalised") .queryParam("representationJSON", object.toString()) .accept("application/json") .get( ClientResponse.class ); if (response.getStatus() != 200) { throw new RuntimeException("Failed : HTTP error code : " + response.getStatus()); } Log.d(TAG,"object " + response); String output = response.getEntity(String.class);Initialement, j'utilisé la version 1.4 de jersey-core et jersey-client. Meme en essayant d'utiliser des versions plus récentes (1.9,1.10), le problème persiste... et là je stagne...01-25 13:27:42.461: W/dalvikvm(199): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
01-25 13:27:42.461: E/AndroidRuntime(199): Uncaught handler: thread main exiting due to uncaught exception
01-25 13:27:42.470: E/AndroidRuntime(199): java.lang.NullPointerException
01-25 13:27:42.470: E/AndroidRuntime(199): at javax.ws.rs.core.MediaType.valueOf(MediaType.java:119)
01-25 13:27:42.470: E/AndroidRuntime(199): at com.sun.jersey.api.client.ClientResponse.getType(ClientResponse.java:615)
01-25 13:27:42.470: E/AndroidRuntime(199): at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:532)
01-25 13:27:42.470: E/AndroidRuntime(199): at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:506)
01-25 13:27:42.470: E/AndroidRuntime(199): at fr.sporta.android.samusocial.service.dataSender.getNearestSignalised(dataSender.java:171)
.............
Merci d'avance ! et s'il manque des infos qui vous serez utile, dites moi le.
Sébastien
nota : ce message est-il a sa place ? ou faut il plutot le mettre au niveau des webservices... ?
Partager