I followed instructons,

> If you're using AFHTTPClient, set the parameterEncoding property to 
> AFJSONParameterEncoding. Any method on that HTTP client with aparameters 
> argument 
> will now encode the passed object into a JSON string and set the HTTP body 
> and Content-Type header appropriately.


Thanks Niphlod 

On Tuesday, October 23, 2012 10:31:36 AM UTC+2, Niphlod wrote:
>
> in what format are you posting json back to the server (not the format of 
> the json, that is of course json ... just the way you use to transmit data) 
> ? are you using application/x-www-form-urlencoded ? multipart/form-data ? 
> binary post ?
>
> On Tuesday, October 23, 2012 10:23:16 AM UTC+2, Mchurch wrote:
>>
>> Dear all, I'm trying to send json data from an IOS device to web2py 
>> server.
>> I can already receive Json-data from web2py server on my Iphone, but I'm 
>> not able to send it back again!
>> From ios device I'm using Afnetworking framework, but even if i use 
>> something else the error i got is always the same:
>>
>>> *{NSErrorFailingURLKey=http://127.0.0.1:8000/Json/default/ricevo, 
>>> NSLocalizedDescription=Expected status code in (200-299), got 500*
>>
>>
>> I think the problem is with my function "ricevo", what exactly i should 
>> put in my action to receive my Json data? 
>> I've tried many solutions, but with no result.
>> Can You point me in the right direction?
>> Thanks guys.
>> Marco
>> def ricevo():
>>   import gluon.contrib.simplejson as sj 
>>   data=sj.loads(request.body.read()) 
>>   return()
>>
>> def ricevo():
>>     from json import loads, dumps
>>     data =  loads(request.vars.myvar)
>>     return dumps(data)
>>
>>

-- 



Reply via email to