java - Spring Rest operations convert response to class -


this rest call:

restoperations operations; useridentifier resourceresponse = operations.postforobject("...", entity, useridentifier.class); 

the useridentifier class:

public class useridentifier {     private string uid;     private string code;     private string retailid;      public useridentifier() {      }      public useridentifier(string uid, string code, string retailid) {         this.uid = uid;         this.code = code;         this.retailid = retailid;     }      public string getuid() {         return uid;     }      public void setuid(string uid) {         this.uid = uid;     }      public string getcode() {         return code;     }      public void setcode(string code) {         this.code = code;     }      public string getretailid() {         return retailid;     }      public void setretailid(string retailid) {         this.retailid = retailid;     } } 

the json response:

{   "useridentifier": {     "uid": "ee63a52cda7bf411dd8603ac196951aa77",     "code": "63a5297e7bf411dd8603ac196951aa77",     "retailid": "860658787",     "pointofentry": "retail"   },   "resultcode": true } 

but problem when run code, creates resourceresponse fields empty. idea problem is?

edit 1: getting proper json response back, i'm unable put java class object.

it's failing cast response class. according response json, casting object should following

class response {     useridentifier useridentifier;     boolean resultcode;     ... } 

and call

response response = operations.postforobject("...", entity, response.class); response.useridentifier...   // data  

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -