Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2014
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. package com.xyz.model;
  2. import org.codehaus.jackson.annotate.JsonIgnoreProperties;
  3. import org.codehaus.jackson.map.annotate.JsonSerialize;
  4.  
  5. @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
  6. @JsonIgnoreProperties(ignoreUnknown = true)
  7.  
  8.  
  9. public class Register {
  10. private String Name;
  11. private String Email;
  12. private String Password;
  13.  
  14. public String getName() {
  15. return Name;
  16. }
  17.  
  18. public void setName(String Name) {
  19. this.Name = Name;
  20. }
  21. //other getter and setter
  22.  
  23. public Register()
  24. {}
  25. }
  26.  
  27. public String Register(Register reg) {
  28.  
  29. String url = URL + "/users";
  30.  
  31. String name = reg.getName();
  32. String email = reg.getEmail();
  33. String password = reg.getPassword();
  34. JSONObject jsondata = new JSONObject();
  35. jsondata.put("Name", name);
  36. jsondata.put("Email", email);
  37. jsondata.put("Password", password);
  38.  
  39. HttpEntity<?> requestEntity = new Connection().getConnection(jsondata
  40. .toString());
  41. //......code for connection to url..
  42.  
  43.  
  44. } catch (Exception e) {
  45. System.out.println("failed"+e.getMessage());
  46.  
  47. }
  48.  
  49. failed Could not read JSON: Can not instantiate value of type [simple type, class com.xyz.model.Register] from JSON integral number; no single-int-arg constructor/factory method; nested exception is org.codehaus.jackson.map.JsonMappingException: Can not instantiate value of type [simple type, class com.xyz.model.Register] from JSON integral number; no single-int-arg constructor/factory method.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement