0

I make a request from Android to Grails controller. Request change the data in the database, but the Grails server returns an error:

2015-11-28 19:23:31,973 [http-bio-8080-exec-5] ERROR errors.GrailsExceptionResolver - MissingPropertyException occurred when processing request: [POST] /ServerReg/saveReg/regSave No such property: success for class: org.apache.catalina.connector.ResponseFacade. Stacktrace follows: Message: No such property: success for class: org.apache.catalina.connector.ResponseFacade 

my Grails controller:

def saveRegLink = new HTTPBuilder("http://db.likepay.me:80/rest/checkReg/registration/?fields=id"); saveRegLink.request(POST, JSON) { req -> headers.'X-DreamFactory-Session-Token' = session_id headers.'X-DreamFactory-Application-Name' = serviceName body = [ telNum: telNum, IMEI: IMEI, DeviceName: DeviceName, SIM_SN: SIM_SN ] } response.success = {resp, json -> println resp.status render json return json } response.failure = { resp -> println 'request failed' assert resp.status >= 400 } 

I shall be grateful for the help.

1 Answer 1

1

You have the response.success/response.failure scoped outside of the closure that is passed to the request method.

It should be something like this:

def saveRegLink = new HTTPBuilder("http://db.likepay.me:80/rest/checkReg/registration/?fields=id"); saveRegLink.request(POST, JSON) { req -> headers.'X-DreamFactory-Session-Token' = session_id headers.'X-DreamFactory-Application-Name' = serviceName body = [ telNum: telNum, IMEI: IMEI, DeviceName: DeviceName, SIM_SN: SIM_SN ] response.success = {resp, json -> println resp.status render json return json } response.failure = { resp -> println 'request failed' assert resp.status >= 400 } } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.