Hi Marcus,

Your code looks good, I only see one problem, AgreedToTerms is a Read-
Only attribute, I think that trying to set this may be triggering the
exception.

Cheers,
Julian.

On Dec 16, 9:01 pm, Marcus Mazzo <[email protected]> wrote:
> Hello,
>
> Im using Google Apps Provisioning API to create user's account. I have
> an application that use AppsForYourDomain jar to create account but i
> want to use an EJB to do this function.
>
> How can i do this?
>
> I tried but isn't work, i receive the error message:
>
> com.google.gdata.util.InvalidEntryException: Bad Request
> Required extensions are missing.lo...@username, lo...@password,
> n...@givenname, and n...@familyname are required fields for user
> creation.
>
> this is the method that im calling:
>
> public boolean create(String username, String pass, String nameUser) {
>                 try {
>
>                 UserEntry user = new UserEntry();
>
>                 Login login = new Login();
>                 login.setUserName(username);
>                 login.setPassword(pass);
>                 login.setAgreedToTerms(true);
>
>                 Name name = new Name();
>                 name.setGivenName(nameUser);
>                 name.setFamilyName("Uece");
>
>                 Quota quota = new Quota();
>                 quota.setLimit(2048);
>
>                 user.addExtension(login);
>                 user.addExtension(name);
>                 user.addExtension(quota);
>
>                 URL url = new URL(domainUrlBase + "user/" + SERVICE_VERSION);
>
>                 user = userService.insert(url, user);
>                 retorno = true;
>                 } catch (Exception e) {
>                         e.printStackTrace();
>                 }
>                 return retorno;
>         }
>
> i tried to do:
>
> AppsForYourDomainClient client = new AppsForYourDomainClient(username,
> pass, DOMAIN);
> client.createUser(username, nameUser, "UECE", pass);
>
> but i get the same error.
>
> how can i implement this in a EJB class?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Apps APIs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-apps-apis?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to