Hi Isomorphic,
I want to consume a third party rest service using RestDataSource.
e.g. I have a sample rest service http://localhost:8080//accountsInfo , returned json is : {"balance":1000,"type":"savings"}
Below is my code to consume this:
RestDataSource countryDS = new RestDataSource() {
@Override
protected Object transformRequest(DSRequest dsRequest) {
return super.transformRequest(dsRequest);
}
@Override
protected void transformResponse(DSResponse response, DSRequest request, Object data) {
super.transformResponse(response, request, data);
}
};
OperationBinding fetch = new OperationBinding();
fetch.setOperationType(DSOperationType.FETCH);
fetch.setDataProtocol(DSProtocol.POSTMESSAGE);
fetch.setDataFormat(DSDataFormat.JSON);
countryDS.setFetchDataURL("http://localhost:8080//accountsInfo");
countryDS.setJsonPrefix("");
countryDS.setJsonSuffix("");
countryDS.setDataFormat(DSDataFormat.JSON);
countryDS.setUseStrictJSON(false);
DataSourceTextField balance = new DataSourceTextField("balance", "balance");
DataSourceTextField type = new DataSourceTextField("type", "type");
countryDS.setFields(balance, type);
ListGridField codeField = new ListGridField("balance");
ListGridField nameField = new ListGridField("type");
grid.setDataSource(countryDS);
grid.setFields(codeField, nameField);
grid.setAutoFetchData(true);
Attached is the screenshot of console.
My grid doesn't get loaded with data. On browser console i get warning:
ISC_Core.js:1197 *21:23:33.379:XRP4:WARN:RestDataSource:isc_HomeTabView_1_0:RestDataSouce transformResponse(): JSON response text does not appear to be in standard response format.
Please suggest?
I want to consume a third party rest service using RestDataSource.
e.g. I have a sample rest service http://localhost:8080//accountsInfo , returned json is : {"balance":1000,"type":"savings"}
Below is my code to consume this:
RestDataSource countryDS = new RestDataSource() {
@Override
protected Object transformRequest(DSRequest dsRequest) {
return super.transformRequest(dsRequest);
}
@Override
protected void transformResponse(DSResponse response, DSRequest request, Object data) {
super.transformResponse(response, request, data);
}
};
OperationBinding fetch = new OperationBinding();
fetch.setOperationType(DSOperationType.FETCH);
fetch.setDataProtocol(DSProtocol.POSTMESSAGE);
fetch.setDataFormat(DSDataFormat.JSON);
countryDS.setFetchDataURL("http://localhost:8080//accountsInfo");
countryDS.setJsonPrefix("");
countryDS.setJsonSuffix("");
countryDS.setDataFormat(DSDataFormat.JSON);
countryDS.setUseStrictJSON(false);
DataSourceTextField balance = new DataSourceTextField("balance", "balance");
DataSourceTextField type = new DataSourceTextField("type", "type");
countryDS.setFields(balance, type);
ListGridField codeField = new ListGridField("balance");
ListGridField nameField = new ListGridField("type");
grid.setDataSource(countryDS);
grid.setFields(codeField, nameField);
grid.setAutoFetchData(true);
Attached is the screenshot of console.
My grid doesn't get loaded with data. On browser console i get warning:
ISC_Core.js:1197 *21:23:33.379:XRP4:WARN:RestDataSource:isc_HomeTabView_1_0:RestDataSouce transformResponse(): JSON response text does not appear to be in standard response format.
Please suggest?
Comment