SmartGWT with Rest Data Source Error
I am getting the following error when retrieving data from a rest data source
00:00:52.439 [ERROR] 01:46:57.001:RDQ1:WARN:ResultSet:isc_ResultSet_1 (created by: isc_CustomerDocGrid_0):get: invalid index -1 com.smartgwt.client.core.JsObject$SGWT_WARN: 01:46:57.001:RDQ1:WARN:ResultSet:isc_ResultSet_1 (created by: isc_CustomerDocGrid_0):get: invalid index -1 at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Construc tor.java:513) at com.google.gwt.dev.shell.MethodAdaptor.invoke(Meth odAdaptor.java:105) at com.google.gwt.dev.shell.MethodDispatch.invoke(Met hodDispatch.java:71) at com.google.gwt.dev.shell.OophmSessionHandler.invok e(OophmSessionHandler.java:157) at com.google.gwt.dev.shell.BrowserChannel.reactToMes sages(BrowserChannel.java:1668) at com.google.gwt.dev.shell.BrowserChannelServer.proc essConnection(BrowserChannelServer.java:401) at com.google.gwt.dev.shell.BrowserChannelServer.run( BrowserChannelServer.java:222) at java.lang.Thread.run(Thread.java:619)
Here is my data source (it extends RestDataSource)
Code: public CustomerDataSource(String id) { setID(id); setDataFormat(DSDataFormat.XML); setRecordXPath("customerdoc");
setOperationBindings();
OperationBinding fetch = new OperationBinding();
fetch.setOperationType(DSOperationType.FETCH);
fetch.setDataProtocol(DSProtocol.GETPARAMS);
setOperationBindings(fetch);
setDataURL("/customer");
I know my web service is returning data as I can display the XML file in my browser. Thi开发者_开发问答s doesnt appear to be a parse error (i have seen those before). Not sure what the error means. Any help is appreciated.
I couldn't figure out when this exactly happens but it's normally when no data is received. My guess is your xml does not match the expected format (wrong xpath) so it can't find any data.
try that:
dataSource.setRecordXPath("//customerdoc");
精彩评论