public void addContact(Contact c, String[] groups) { try { // Create the entry to insert ContactEntry contact = new ContactEntry(); Name name = new Name(); final String NO_YOMI = null; name.setFullName(new FullName(c.getName(), NO_YOMI)); name.setGivenName(new GivenName(c.getName(), NO_YOMI)); name.setFamilyName(new FamilyName(c.getSurname(), NO_YOMI)); contact.setName(name); Email primaryMail = new Email(); primaryMail.setAddress(c.getEmail()); primaryMail.setPrimary(true); contact.addEmailAddress(primaryMail); URL postUrl = new URL("https://www.google.com/m8/feeds/contacts/default/full"); try { myService.insert(postUrl, contact); } catch (IOException ex) { Logger.getLogger(ContactsHandlerImpl.class.getName()).log(Level.SEVERE, null, ex); } catch (ServiceException ex) { Logger.getLogger(ContactsHandlerImpl.class.getName()).log(Level.SEVERE, null, ex); } } catch (MalformedURLException ex) { Logger.getLogger(ContactsHandlerImpl.class.getName()).log(Level.SEVERE, null, ex); } }