I tried to replace the RestDataSource in GWT sample code: RestfuleDataSourceSample.java with actual RestDataSource from our server (Progress OpenEdge REST server).
The response from our server is as follows:-
{"response":{"status":0,"ttCountry":{"ttCountry":[{"continent":"EU","countryName":"United Kingdom","countryCode":"UK"},{"continent":"Asia","countryName":"China","countryCode":"CN"}]}}}
It does not conform to the format as shown in SmartGWT document, which says format should be:-
{"response":{"status":0,"data"[......]....
The response from my server does not get loaded into the grid in RestfulDataSource.
I specify my RestDataSource as follows:-
countryDS.setDataFormat( DSDataFormat.JSON);
countryDS.setFetchDataURL("http://localhost:8980/TestREST2Service/rest/TestREST2Service/country");
countryDS.setJsonRecordXPath("ttCountry");
The following is the entry in the console window in eclipse:-
=== 2015-01-29 17:49:08,452 [2-29] DEBUG HttpProxyServlet - HttpProxy - ProxyData is: {
xsi:"http://www.w3.org/2000/10/XMLSchema-instance",
url:"http://localhost:8980/TestREST2Service/rest/TestREST2Service/country",
httpMethod:"POST",
params:{
isc_dataFormat:"json"
},
contentType:"application/json",
requestBody:"{\r \"dataSource\":\"isc_RestfulDataSourceSample_1_0\", \r \"operationType\":\"fetch\", \r \"startRow\":0, \r \"endRow\":50, \r \"sortBy\":[\r \"countryCode\"\r ], \r \"textMatchStyle\":\"substring\", \r \"componentId\":\"isc_ListGrid_0\", \r \"data\":{\r }, \r \"oldValues\":null\r}",
callbackParam:""
}
=== 2015-01-29 17:49:08,467 [2-29] INFO HttpProxyServlet - HttpProxy - Method succeeded: HTTP/1.1 200 OK
=== 2015-01-29 17:49:08,468 [2-29] INFO HttpProxyServlet - HttpProxy - Response:
{"response":{"status":0,"ttCountry":{"ttCountry":[{"continent":"EU","countryName":"United Kingdom","countryCode":"UK"},{"continent":"Asia","countryName":"China","countryCode":"CN"}]}}}
=== 2015-01-29 17:49:08,468 [2-29] INFO Compression - /customds/sc/HttpProxy: 184 -> 132 bytes
Smart GWT version : trial version SmartGWTEE 5.0.
Browser : Internet Explorer 10
Thanks and regards
Kay Chee Cheung
The response from our server is as follows:-
{"response":{"status":0,"ttCountry":{"ttCountry":[{"continent":"EU","countryName":"United Kingdom","countryCode":"UK"},{"continent":"Asia","countryName":"China","countryCode":"CN"}]}}}
It does not conform to the format as shown in SmartGWT document, which says format should be:-
{"response":{"status":0,"data"[......]....
The response from my server does not get loaded into the grid in RestfulDataSource.
I specify my RestDataSource as follows:-
countryDS.setDataFormat( DSDataFormat.JSON);
countryDS.setFetchDataURL("http://localhost:8980/TestREST2Service/rest/TestREST2Service/country");
countryDS.setJsonRecordXPath("ttCountry");
The following is the entry in the console window in eclipse:-
=== 2015-01-29 17:49:08,452 [2-29] DEBUG HttpProxyServlet - HttpProxy - ProxyData is: {
xsi:"http://www.w3.org/2000/10/XMLSchema-instance",
url:"http://localhost:8980/TestREST2Service/rest/TestREST2Service/country",
httpMethod:"POST",
params:{
isc_dataFormat:"json"
},
contentType:"application/json",
requestBody:"{\r \"dataSource\":\"isc_RestfulDataSourceSample_1_0\", \r \"operationType\":\"fetch\", \r \"startRow\":0, \r \"endRow\":50, \r \"sortBy\":[\r \"countryCode\"\r ], \r \"textMatchStyle\":\"substring\", \r \"componentId\":\"isc_ListGrid_0\", \r \"data\":{\r }, \r \"oldValues\":null\r}",
callbackParam:""
}
=== 2015-01-29 17:49:08,467 [2-29] INFO HttpProxyServlet - HttpProxy - Method succeeded: HTTP/1.1 200 OK
=== 2015-01-29 17:49:08,468 [2-29] INFO HttpProxyServlet - HttpProxy - Response:
{"response":{"status":0,"ttCountry":{"ttCountry":[{"continent":"EU","countryName":"United Kingdom","countryCode":"UK"},{"continent":"Asia","countryName":"China","countryCode":"CN"}]}}}
=== 2015-01-29 17:49:08,468 [2-29] INFO Compression - /customds/sc/HttpProxy: 184 -> 132 bytes
Smart GWT version : trial version SmartGWTEE 5.0.
Browser : Internet Explorer 10
Thanks and regards
Kay Chee Cheung
Comment