PDA

View Full Version : Problem to send an json message in the request like jsonData in the JsonStore



Irving Flores
28 Jul 2010, 1:11 PM
Can halp me


I need to send an json structure in the request message from the Ext.data.JsonStore because we have a RESTful web services and this services work with a json structure.


I did this with the class Ext.Ajax.request and jsonData option and fine . . . but i can do it with the JsonStore.



Code js:

var strEstadoFederativo = new Ext.data.JsonStore
({
proxy : new Ext.data.HttpProxy({
method: 'POST',
url : "/ExtJSInterface/RestModuleProcessWeb"

}),
root : "regs",
totalProperty : "numReg",
id : 'idEF',
fields : ['IdEstadoFederativo', 'DescripcionEstadoFederativo'],
remoteSort : false,
autoLoad : false,
baseParams : {IdPais:'1',IdProceso:'3'},
writer :new Ext.data.JsonWriter({
encode: false,
writeAllFields: true
})
});
------------
//We need to send this message:

POST /RestModuleProcessWeb/ConsultaEstadoFederativoJsonRESTFulServices/consultaEstadoFederativoOperation HTTP/1.1
Content-Length: 30
Content-Type: text/plain; charset=UTF-8
Host: localhost:9080
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.0.1 (java 1.5)
Expect: 100-Continue

{"IdPais":"1","IdProceso":"2"}
------------------
//And right now we can send this message:

POST /RestModuleProcessWeb/ConsultaEstadoFederativoJsonRESTFulServices/consultaEstadoFederativoOperation.ajax HTTP/1.1
Host: localhost:9080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 ( .NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: es-es,es;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
X-Requested-With: XMLHttpRequest
Content-Type: text/plain; charset=UTF-8
Referer: http://localhost:9080/ExtJSInterface/mit/Ejemplo1/AnalisaSolicitud.html
Content-Length: 40
Pragma: no-cache
Cache-Control: no-cache

IdPais=1&IdProceso=3&query=&xaction=read

Irving Flores
28 Jul 2010, 9:21 PM
Ok thanks for all....

I have the solution, good day

danderson
20 Aug 2010, 12:39 PM
What was the solution?

TonyBones
16 Sep 2010, 2:45 PM
I've having this same EXACT problem right now. I'm even setting the encode: false property on the HttpProxy and its still not working. Please can you post your solution?

Found another post here, and it worked!
http://www.sencha.com/forum/showthread.php?105679-JsonStore-sent-over-in-JSON-format