1 pièce(s) jointe(s)
Erreur conversion données au format JSON
Bonjour,
je développe une appli web qui utilisera entre autres du REST pour l'accès aux différents services qu'elle propose.
J'ai commencé par une page de test pour vérifier que l'un des service fonctionne bien mais là j'ai eu une erreur.
Mes déclarations sont les suivantes:
Dans le fichier javascript, j'ai déclaré ceci pour l'appel au service:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
$.ajax({
type: 'GET',
url: "http://localhost:9080/reportsfroml/rest/search/searchbycriteria",
data:{
beginDate: "'"+this.dateInputFrom()+"'",
endDate: "'"+this.dateInputTo()+"'",
ipnTech: "'"+this.items()[this.selectedIndex()]+"'"
},
cache : false,
dataType: "json",
success: function(datla){
alert("test "+datla);
},
error: function(jqXHR, textStatus, errorThrown){
alert('get error: ' + textStatus);
}
}); |
Dans la classe JAVA qui est appelé, voici le code:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
@Path("/search")
public class FindLogsbyRestService {
public FindLogsbyRestService(){
}
@GET
@Path("searchbycriteria")
//@Produces({MediaType.APPLICATION_JSON})
@Produces("application/json")
public Response getLogsbyCriteria(@QueryParam("beginDate")String pStartDate, @QueryParam("endDate")String pEndDate,
@QueryParam("ipnTech")String pIpnTech){
System.out.println("pStartDate "+pStartDate+" endDate "+pEndDate+" ipnTech "+pIpnTech);
String lQueryParam = "pStartDate "+pStartDate+" endDate "+pEndDate+" ipnTech "+pIpnTech;
EltLog t = new EltLog();
t.setFData(lQueryParam);
return Response.ok(t).build();
}
} |
Enfin la classe EltLog correspond à:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
@XmlAccessorType(XmlAccessType.FIELD)
public class EltLog {
public EltLog(){
}
@XmlElement(name = "fdata")
private String fData;
public String toString(){
return fData;
}
public String getFData() {
return fData;
}
public void setFData(String data) {
fData = data;
}
} |
Pour des contraintes techniques, j'utilise la jdk 1.5 et je travaille avec Websphere 6.1.
L'erreur qui m'est remontée est la suivante: (voir en pj : Pièce jointe 160305 )
Pourrez vous avoir une idée de ce qui pose problème?:?