Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6047745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:23:04+00:00 2026-05-23T07:23:04+00:00

I’m developing a membership sign up app for an organization on Google App Engine,

  • 0

I’m developing a membership sign up app for an organization on Google App Engine, for new members, they can use a sign up page to become a member, is there a way in Google App Engine to add new members as gmail contacts ? So each time a new user clicks a submit button with his info, a new gmail contact is auto generated and added to my contact list [ my gmail address is registered with the GAE app ].

Here is some of my code try to do that, but it doesn’t add new contacts each a submit button is pressed :

  String Add_New_Contact_Url="https://www.google.com/m8/feeds/contacts/default/full";

  protected void processRequest(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException
  {
    request.setCharacterEncoding("UTF-8");
    response.setContentType("text/html; charset=UTF-8");  // UTF-8  GB18030
    PrintWriter out=response.getWriter();
    String Email=request.getParameter("Email");

    if (Email==null || Email.trim().length()<1)
    {
      StrBuf=new StringBuffer("<Html><Head><Title>Signup</Title></Head>\n<Body>\n");
      StrBuf.append("<P><Br><P><Br><P>\n");
      StrBuf.append("<Table Border=1 Align=Center Cellpadding=8 Cellspacing=1><Tr Bgcolor=\"#0088FF\" Colspan=2><Th><Font Color=White>Sign up</Font></Th></Tr></Table>\n<P>\n");
      StrBuf.append("<Center>\n");
      StrBuf.append("<Form Name=Singles_Club_Signup_Form>\n");
      StrBuf.append("<Table Border=1 Cellpadding=6 Cellspacing=1>\n");
...
      StrBuf.append("<Tr><Td Align=Right><B><Font Size=3 Color=#0066FF>Email</Font></B></Td><Td><Input type=text name=Email size=36 /></Td></Tr>\n");
...
      StrBuf.append("</Table>\n");
      StrBuf.append("<P><Br><P>\n");
      StrBuf.append("<Input type=submit value=Sign_Up/>\n");
      StrBuf.append("</Form>\n");
      StrBuf.append("</Center>\n");
      StrBuf.append("</Body>\n</Html>");
    }
    else
    {
      try
      {
        LinkedHashMap<String,String> Key_Value_Pairs=new LinkedHashMap<String,String>();
        String A_Contact=createContact(Email);
        Key_Value_Pairs.put("A",A_Contact);
        getFromUrlDoPost(Add_New_Contact_Url,Key_Value_Pairs);             // Create new contact in Gmail account
      }
      catch (Exception e) { out.println(e.toString()); }
      finally { if (pm!=null) pm.close(); }
    }
  }

  String createContact(String Email)
  {
    return "<atom:entry xmlns:atom='http://www.w3.org/2005/Atom' xmlns:gd='http://schemas.google.com/g/2005'>\n"+
           "<atom:category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/contact/2008#contact' />\n"+
           "<gd:name>\n"+
           "<gd:givenName>AAA</gd:givenName>\n"+
           "<gd:familyName>BBB</gd:familyName>\n"+
           "<gd:fullName>AAA BBB</gd:fullName>\n"+
           "</gd:name>\n"+
           "<atom:content type='text'>Notes</atom:content>\n"+
           "<gd:email rel='http://schemas.google.com/g/2005#work' primary='true' address='"+Email+"' displayName='E. Bennet' />\n"+
           "<gd:email rel='http://schemas.google.com/g/2005#home' address='liz@example.org' />\n"+
           "<gd:phoneNumber rel='http://schemas.google.com/g/2005#work' primary='true'>\n"+
           "(206)555-1212\n"+
           "</gd:phoneNumber>\n"+
           "<gd:phoneNumber rel='http://schemas.google.com/g/2005#home'>\n"+
           "(206)555-1213\n"+
           "</gd:phoneNumber>\n"+
           "<gd:im address='liz@gmail.com' protocol='http://schemas.google.com/g/2005#GOOGLE_TALK' primary='true' rel='http://schemas.google.com/g/2005#home' />\n"+
           "<gd:structuredPostalAddress rel='http://schemas.google.com/g/2005#work' primary='true'>\n"+
           "<gd:city>Mountain View</gd:city>\n"+
           "<gd:street>1600 Amphitheatre Pkwy</gd:street>\n"+
           "<gd:region>CA</gd:region>\n"+
           "<gd:postcode>94043</gd:postcode>\n"+
           "<gd:country>United States</gd:country>\n"+
           "<gd:formattedAddress>\n"+
           "1600 Amphitheatre Pkwy Mountain View\n"+
           "</gd:formattedAddress>\n"+
           "</gd:structuredPostalAddress>\n"+
           "</atom:entry>";
  }

 StringBuffer getFromUrlDoPost(String A_Url,LinkedHashMap Key_Value_Pairs) throws MalformedURLException,IOException
  {
    StringBuffer Text_Out=new StringBuffer(""),Text_In=new StringBuffer("");
    String data="",key,value,inputLine;

    try                                                    //  Sending a POST Request Using a URL
    {
      // Construct data -- List the entries
      for (Iterator it=Key_Value_Pairs.keySet().iterator();it.hasNext();)
      {
        key=it.next().toString();
        value=Key_Value_Pairs.get(key).toString();
        if (data.length()==0) data=URLEncoder.encode(key,"UTF-8")+"="+URLEncoder.encode(value,"UTF-8");
        else data+="&"+URLEncoder.encode(key,"UTF-8")+"="+URLEncoder.encode(value,"UTF-8");
      }
      // Send data
      URLConnection conn=new URL(A_Url).openConnection();
      conn.setRequestProperty("Content-Type","application/atom+xml");
      conn.setDoOutput(true);

      OutputStreamWriter wr=new OutputStreamWriter(conn.getOutputStream());
      wr.write(data);
      wr.flush();

      Text_In.setLength(0);

      // Get the response
      BufferedReader rd=new BufferedReader(new InputStreamReader(conn.getInputStream()));
      while ((inputLine=rd.readLine()) != null) Text_In.append(inputLine+"\n");
      wr.close();
      rd.close();
    }
    catch (Exception e) { }
    return Text_In;
  }

It doesn’t cause error either, what did I do wrong ? I suspect this line :

Key_Value_Pairs.put("A",A_Contact);

Because I don’t know what to put in the place of “A” ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:23:05+00:00Added an answer on May 23, 2026 at 7:23 am

    I found out why : don’t need to include google-collect-*.jar, source of error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I am trying to loop through a bunch of documents I have to put
I have some data like this: 1 2 3 4 5 9 2 6

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.