PDA

View Full Version : JBoss 7 REST WebServices



execretor
18 Apr 2013, 4:06 AM
Hi guys, when i call http://localhost:8080/atlasservices/Alarm/hello from my browser i have this response:

[
{ "value" : "A" } ,
{ "value" : "B" }
]

I use this code to get an array of data from my web service.


switch(record.data.summaryName) {
case "Sommario allarmi":
Ext.getCmp('center-panel').layout.setActiveItem('alsum-panel');

Ext.define('columnsGet', {
extend: 'Ext.data.Model',

fields: [
'value'
]
});

var alarmStore = Ext.create('Ext.data.Store', {
model: 'columnsGet',
fields: [],
proxy: {
type: 'rest',
url: 'http://localhost:8080/atlasservices/Alarm/hello',
reader: {
type: 'json',
}
}
});

var alarmGrid = Ext.getCmp('alarmSummaryGrid');

alarmStore.load(function(records, operation, success) {
alert(records); //print null
alert(operation); //print object
alert(success); //print false
});

alert(alarmStore.getTotalCount()); //print 0

alarmStore.each(function(obj) {
alarmGrid.addColumn(obj);
});




break;
case "Sommario analogiche":
Ext.getCmp('center-panel').layout.setActiveItem('analogsum-panel');
break;
}


but when i refresh page i don't see anything. How can i get my data?

ChronoT52
18 Apr 2013, 4:35 AM
Try removing the "fields: []," line in your store.


var alarmStore = Ext.create('Ext.data.Store', {
model: 'columnsGet',
//fields: [],
proxy: {
type: 'rest',
url: 'http://localhost:8080/atlasservices/Alarm/hello',
reader: {
type: 'json',
}
}
});

execretor
18 Apr 2013, 7:13 AM
I did but there are no changes

slemmon
19 Apr 2013, 3:54 PM
Are you seeing the response come back from your server in Firebug / Chrome Dev Tools?

execretor
20 Apr 2013, 11:59 AM
This is my response:

[21:56:34.693] OPTIONS http://localhost:8080/atlasservices/Alarm/hello?_dc=1366487793962&page=1&start=0&limit=25 [HTTP/1.1 200 OK 3ms]