Sending objects over the wire in grails -


i using rest builder plugin send request on http 1 grails server another.

sender

restclient.get(path: "/shipping",                 query:[dress: dress] 

sender log:

2014-03-24 23:32:20,299 [main] debug http.wire  - >> "get /shipping?dress=mydress(paypassid:2,+datecreated:mon+mar+24+23:32:20+gmt+2014,+datelastactive:mon+mar+24+23:32:20+gmt+2014,+nickname:null,+recipientname:null,+defaultaddress:null,+street1:null,+street2:null,+street3:null,+city:null,+state:null,+country:null,+postalcode:12345,+recipientphonenumber:null,+recipientphonenumbercountrycode:null) http/1.1[eol]" 

receiver tries dress object

mydress mydress = params.dress; 

error message is:

cannot cast object 'mydress(paypassid:2,+datecreated:mon+mar+24+23:32:20+gmt+2014,+datelastactive:mon+mar+24+23:32:20+gmt+2014,+nickname:null,+recipientname:null,+defaultaddress:null,+street1:null,+street2:null,+street3:null,+city:null,+state:null,+country:null,+postalcode:12345,+recipientphonenumber:null,+recipientphonenumbercountrycode:null)' class 'java.lang.string' class 'mydress'

is there magic api missing here?

this type of data not compatible grails. need either send data json or send them individual params , create new instance of object with:

myaddress instance = new myaddress(params) 

you're sending tostring() of object instead of data (the restclient needs map instead of mydress).


Comments