BluesZhang / gdata-objectivec-client

Automatically exported from code.google.com/p/gdata-objectivec-client
Other
0 stars 0 forks source link

404 data:Contact not found #85

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. New a GDataEntryContact object with contact name (first name and last name)
2. Insert contact entry by calling fetchEntryByInsertingEntry with 
"addContactTicket:addedEntry:error:" finish-selector
3. I received inserting-contact result in the finish-selector 
"addContactTicket:addedEntry:error" with nil error status code
4. Update phone number property of the added entry by calling 
fetchEntryByUpdatingEntry with "updateContactTicket:updatedEntry:error:" 
finish-selector
5. I received updating-contact result in the finish-selector 
"updateContactTicket:updatedEntry:error" with 404 error status code

What version of the product are you using? On what operating system?
1. I'm using the latest gdata-objectivec-client version
2. Developing apps on iPhone device

Please provide any additional information below.

Below are Insert and Update fetcher finish-selectors declaration:

- (void)addContactTicket:(GDataServiceTicket *)ticket
              addedEntry:(GDataEntryContact *)contactEntry
                   error:(NSError *)error;

- (void)updateContactTicket:(GDataServiceTicket *)aTicket
        updatedEntry:(GDataEntryContact *)contactEntry
         error:(NSError *)error;

Original issue reported on code.google.com by AppRank...@gmail.com on 25 Feb 2011 at 6:48

GoogleCodeExporter commented 9 years ago
Oh, i forgot to mention: this only started happening recently.

Original comment by AppRank...@gmail.com on 25 Feb 2011 at 6:58

GoogleCodeExporter commented 9 years ago
Since this changed recently, it would be a server issue unrelated to the 
Objective-C library.

If you can turn on the library's http logging and get a log of the insert and 
the update requests and responses, that will be useful to the server team.

Original comment by gregrobbins on 25 Feb 2011 at 7:31

GoogleCodeExporter commented 9 years ago
thanks for your quick reply, i will turn on the library's http logging and send 
log info to you. 

Original comment by AppRank...@gmail.com on 25 Feb 2011 at 7:51

GoogleCodeExporter commented 9 years ago

updateContactTicket:updatedEntry:error:

2011-02-25 08:45:51 +0000
Request: PUT 
https://www.google.com/m8/feeds/contacts/apprank001%40gmail.com/full/3075fbae8dd
cdaae
Request headers:
  Accept: application/atom+xml, text/xml
  Authorization: GoogleLogin auth=DQAAAJ4AAADJ0AZ3P1vNyAMKAGuJmW9XvjWlKxNIgYly1tQ-Q0ZLJg-ZJIFWdLPCJIp9-EDe1VXRM-2G1r49x3bMac8ue4hT7MrNenBhEGNrFWlpdpFhRrGb9PtBl3Gbjp5L30ky28cH5O5RENWtdIWSi1c7azsNiR-ki3ATp-91UFdE0XMTFlvCUUNgtkabN9nPCheF6103H6Up2sHLIB8mh9f73sNB
  Cache-Control: no-cache
  Content-Length: 1619
  Content-Type: application/atom+xml; charset=utf-8
  Gdata-Version: 3.0
  If-Match: "RnozcDVSLyt7I2A9Wx9bFk8JQgE."
  User-Agent: com.yufanapp.GoogleContactsSync-3.0.3 GData-ObjectiveC/1.11 iPhone/4.2.1 (gzip)

Request body: (1619 bytes)
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" 
xmlns:batch="http://schemas.google.com/gdata/batch" 
xmlns:gd="http://schemas.google.com/g/2005" 
xmlns:gContact="http://schemas.google.com/contact/2008" 
gd:etag=""RnozcDVSLyt7I2A9Wx9bFk8JQgE.""><category 
term="http://schemas.google.com/contact/2008#contact" 
scheme="http://schemas.google.com/g/2005#kind"/><updated>2011-02-25T08:45:57.488
Z</updated><id>http://www.google.com/m8/feeds/contacts/apprank001%40gmail.com/ba
se/3075fbae8ddcdaae</id><app:edited 
xmlns:app="http://www.w3.org/2007/app">2011-02-25T08:45:57.488Z</app:edited><gd:
name><gd:givenName>联系人</gd:givenName><gd:fullName>联系人</gd:fullName><
/gd:name><link rel="http://schemas.google.com/contacts/2008/rel#photo" 
type="image/*" 
href="https://www.google.com/m8/feeds/photos/media/apprank001%40gmail.com/3075fb
ae8ddcdaae"/><link rel="self" type="application/atom+xml" 
href="https://www.google.com/m8/feeds/contacts/apprank001%40gmail.com/full/3075f
bae8ddcdaae"/><link rel="edit" type="application/atom+xml" 
href="https://www.google.com/m8/feeds/contacts/apprank001%40gmail.com/full/3075f
bae8ddcdaae"/><gd:phoneNumber 
rel="http://schemas.google.com/g/2005#mobile">15837922819</gd:phoneNumber><gCont
act:groupMembershipInfo deleted="false" 
href="http://www.google.com/m8/feeds/groups/apprank001%40gmail.com/base/6"/><gCo
ntact:groupMembershipInfo 
href="http://www.google.com/m8/feeds/groups/apprank001%40gmail.com/base/6"/><gCo
ntact:groupMembershipInfo 
href="http://www.google.com/m8/feeds/groups/apprank001%40gmail.com/base/d"/><tit
le>联系人</title></entry>

Response: status 404
Response headers:
  Cache-Control: private, max-age=0
  Content-Encoding: gzip
  Content-Type: text/html; charset=UTF-8
  Date: Fri, 25 Feb 2011 08:45:58 GMT
  Expires: Fri, 25 Feb 2011 08:45:58 GMT
  Server: GSE
  Transfer-Encoding: Identity
  X-Content-Type-Options: nosniff
  X-Frame-Options: SAMEORIGIN
  X-Xss-Protection: 1; mode=block

Response body: (50 bytes)
Contact not found, contact ID: 3491973813218630318
-----------------------------------------------------------

Original comment by AppRank...@gmail.com on 25 Feb 2011 at 9:15

GoogleCodeExporter commented 9 years ago
A sequence showing add then update would be more useful, since that would allow 
the server devs to confirm that the contact just added is the one that can't be 
updated.

Original comment by grobb...@google.com on 25 Feb 2011 at 8:42

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Thanks a lot!
Is this a gdata-objectives-client's issue or google server's issue? 
How to fix the issue now? 
Best regards!

Original comment by AppRank...@gmail.com on 26 Feb 2011 at 1:30

GoogleCodeExporter commented 9 years ago
I just tried using the ContactsSample application to create a contact, then 
update it by editing the email address, and had no difficulty. So I think both 
the client library and the server are working properly.

Can you provide the request/response logs of both the insert and the following 
update? That would enable us to inspect the sequence and perhaps find the 
problem.

Original comment by grobb...@google.com on 26 Feb 2011 at 3:06

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
1. This issue only started happening recently.
2. The insert and update network logs have already been sent to server team's 
mail box yesterday.
3. The ContactsSample always fetchs all contacts feed after created a contact 
or updated contact's field,
    this is very slow and no effective when there are large records. Have you any idea for the issue?

Thanks a lot! I'm looking forward to your reply!

Original comment by AppRank...@gmail.com on 26 Feb 2011 at 3:40

GoogleCodeExporter commented 9 years ago
I don't know what the "server team's mailbox" is. I only work with the client 
library. 

This does not sound like a client library issue, but without seeing the 
sequence of fetches, I cannot begin to guess what may be going wrong. 

Original comment by grobb...@google.com on 26 Feb 2011 at 3:54

GoogleCodeExporter commented 9 years ago
Below is INSERT network logs:

-----------------------------------------------------------

addContactTicket:addedEntry:error:

2011-02-25 08:45:51 +0000
Request: POST 
https://www.google.com/m8/feeds/contacts/apprank001%40gmail.com/full
Request headers:
  Accept: application/atom+xml, text/xml
  Authorization: GoogleLogin auth=DQAAAJ4AAADJ0AZ3P1vNyAMKAGuJmW9XvjWlKxNIgYly1tQ-Q0ZLJg-ZJIFWdLPCJIp9-EDe1VXRM-2G1r49x3bMac8ue4hT7MrNenBhEGNrFWlpdpFhRrGb9PtBl3Gbjp5L30ky28cH5O5RENWtdIWSi1c7azsNiR-ki3ATp-91UFdE0XMTFlvCUUNgtkabN9nPCheF6103H6Up2sHLIB8mh9f73sNB
  Cache-Control: no-cache
  Content-Length: 505
  Content-Type: application/atom+xml; charset=utf-8
  Gdata-Version: 3.0
  User-Agent: com.yufanapp.GoogleContactsSync-3.0.3 GData-ObjectiveC/1.11 iPhone/4.2.1 (gzip)

Request body: (505 bytes)
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" 
xmlns:gd="http://schemas.google.com/g/2005" 
xmlns:app="http://www.w3.org/2007/app" 
xmlns:gContact="http://schemas.google.com/contact/2008"><gContact:groupMembershi
pInfo 
href="http://www.google.com/m8/feeds/groups/apprank001%40gmail.com/base/6"/><cat
egory term="http://schemas.google.com/contact/2008#contact" 
scheme="http://schemas.google.com/g/2005#kind"/><gd:name><gd:givenName>联系人
</gd:givenName></gd:name></entry>

Response: status 201
Response headers:
  Cache-Control: private, max-age=0, must-revalidate, no-transform
  Content-Encoding: gzip
  Content-Location: https://www.google.com/m8/feeds/contacts/apprank001%40gmail.com/full/3075fbae8ddcdaae
  Content-Type: application/atom+xml; charset=UTF-8; type=entry
  Date: Fri, 25 Feb 2011 08:45:57 GMT
  Etag: "RnozcDVSLyt7I2A9Wx9bFk8JQgE."
  Expires: Fri, 25 Feb 2011 08:45:57 GMT
  Gdata-Version: 3.1
  Location: https://www.google.com/m8/feeds/contacts/apprank001%40gmail.com/full/3075fbae8ddcdaae
  Server: GSE
  Transfer-Encoding: Identity
  Vary: Accept, X-GData-Authorization, GData-Version
  X-Content-Type-Options: nosniff
  X-Frame-Options: SAMEORIGIN
  X-Xss-Protection: 1; mode=block

Response body: (1315 bytes)
<?xml version='1.0' encoding='UTF-8'?><entry 
xmlns='http://www.w3.org/2005/Atom' 
xmlns:gContact='http://schemas.google.com/contact/2008' 
xmlns:batch='http://schemas.google.com/gdata/batch' 
xmlns:gd='http://schemas.google.com/g/2005' 
gd:etag='"RnozcDVSLyt7I2A9Wx9bFk8JQgE."'><id>http://www.google.com/m8/feeds/cont
acts/apprank001%40gmail.com/base/3075fbae8ddcdaae</id><updated>2011-02-25T08:45:
57.488Z</updated><app:edited 
xmlns:app='http://www.w3.org/2007/app'>2011-02-25T08:45:57.488Z</app:edited><cat
egory scheme='http://schemas.google.com/g/2005#kind' 
term='http://schemas.google.com/contact/2008#contact'/><title>联系人</title><
link rel='http://schemas.google.com/contacts/2008/rel#photo' type='image/*' 
href='https://www.google.com/m8/feeds/photos/media/apprank001%40gmail.com/3075fb
ae8ddcdaae'/><link rel='self' type='application/atom+xml' 
href='https://www.google.com/m8/feeds/contacts/apprank001%40gmail.com/full/3075f
bae8ddcdaae'/><link rel='edit' type='application/atom+xml' 
href='https://www.google.com/m8/feeds/contacts/apprank001%40gmail.com/full/3075f
bae8ddcdaae'/><gd:name><gd:fullName>联系人</gd:fullName><gd:givenName>联系�
��</gd:givenName></gd:name><gContact:groupMembershipInfo deleted='false' 
href='http://www.google.com/m8/feeds/groups/apprank001%40gmail.com/base/6'/></en
try>
-----------------------------------------------------------

Below is UPDATE network logs:

-----------------------------------------------------------

updateContactTicket:updatedEntry:error:

2011-02-25 08:45:51 +0000
Request: PUT 
https://www.google.com/m8/feeds/contacts/apprank001%40gmail.com/full/3075fbae8dd
cdaae
Request headers:
  Accept: application/atom+xml, text/xml
  Authorization: GoogleLogin auth=DQAAAJ4AAADJ0AZ3P1vNyAMKAGuJmW9XvjWlKxNIgYly1tQ-Q0ZLJg-ZJIFWdLPCJIp9-EDe1VXRM-2G1r49x3bMac8ue4hT7MrNenBhEGNrFWlpdpFhRrGb9PtBl3Gbjp5L30ky28cH5O5RENWtdIWSi1c7azsNiR-ki3ATp-91UFdE0XMTFlvCUUNgtkabN9nPCheF6103H6Up2sHLIB8mh9f73sNB
  Cache-Control: no-cache
  Content-Length: 1619
  Content-Type: application/atom+xml; charset=utf-8
  Gdata-Version: 3.0
  If-Match: "RnozcDVSLyt7I2A9Wx9bFk8JQgE."
  User-Agent: com.yufanapp.GoogleContactsSync-3.0.3 GData-ObjectiveC/1.11 iPhone/4.2.1 (gzip)

Request body: (1619 bytes)
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" 
xmlns:batch="http://schemas.google.com/gdata/batch" 
xmlns:gd="http://schemas.google.com/g/2005" 
xmlns:gContact="http://schemas.google.com/contact/2008" 
gd:etag=""RnozcDVSLyt7I2A9Wx9bFk8JQgE.""><category 
term="http://schemas.google.com/contact/2008#contact" 
scheme="http://schemas.google.com/g/2005#kind"/><updated>2011-02-25T08:45:57.488
Z</updated><id>http://www.google.com/m8/feeds/contacts/apprank001%40gmail.com/ba
se/3075fbae8ddcdaae</id><app:edited 
xmlns:app="http://www.w3.org/2007/app">2011-02-25T08:45:57.488Z</app:edited><gd:
name><gd:givenName>联系人</gd:givenName><gd:fullName>联系人</gd:fullName><
/gd:name><link rel="http://schemas.google.com/contacts/2008/rel#photo" 
type="image/*" 
href="https://www.google.com/m8/feeds/photos/media/apprank001%40gmail.com/3075fb
ae8ddcdaae"/><link rel="self" type="application/atom+xml" 
href="https://www.google.com/m8/feeds/contacts/apprank001%40gmail.com/full/3075f
bae8ddcdaae"/><link rel="edit" type="application/atom+xml" 
href="https://www.google.com/m8/feeds/contacts/apprank001%40gmail.com/full/3075f
bae8ddcdaae"/><gd:phoneNumber 
rel="http://schemas.google.com/g/2005#mobile">15837922819</gd:phoneNumber><gCont
act:groupMembershipInfo deleted="false" 
href="http://www.google.com/m8/feeds/groups/apprank001%40gmail.com/base/6"/><gCo
ntact:groupMembershipInfo 
href="http://www.google.com/m8/feeds/groups/apprank001%40gmail.com/base/6"/><gCo
ntact:groupMembershipInfo 
href="http://www.google.com/m8/feeds/groups/apprank001%40gmail.com/base/d"/><tit
le>联系人</title></entry>

Response: status 404
Response headers:
  Cache-Control: private, max-age=0
  Content-Encoding: gzip
  Content-Type: text/html; charset=UTF-8
  Date: Fri, 25 Feb 2011 08:45:58 GMT
  Expires: Fri, 25 Feb 2011 08:45:58 GMT
  Server: GSE
  Transfer-Encoding: Identity
  X-Content-Type-Options: nosniff
  X-Frame-Options: SAMEORIGIN
  X-Xss-Protection: 1; mode=block

Response body: (50 bytes)
Contact not found, contact ID: 3491973813218630318
-----------------------------------------------------------

Original comment by AppRank...@gmail.com on 26 Feb 2011 at 4:13

GoogleCodeExporter commented 9 years ago
I have still been unable to reproduce the problem.

It looks like the updated contact has two groupMembershipInfo elements added, 
one of which is a duplicate of the element that was in the contact previously. 
Does the error still occur if the contact is updated without adding those two 
elements?

Original comment by grobb...@google.com on 26 Feb 2011 at 8:44

GoogleCodeExporter commented 9 years ago
This issue still exists even if i only updates contact phonenumber elements.

Original comment by AppRank...@gmail.com on 27 Feb 2011 at 12:05

GoogleCodeExporter commented 9 years ago
The strange thing is some records are updated successfully, some records are 
updated unsuccessfully

Original comment by AppRank...@gmail.com on 27 Feb 2011 at 12:12

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hi, gdata-objectivec-client team, i can reproduce the problem by using google 
offical sample "ContactsSample". Following these steps can reproduce the 
problem:

1. Modify addContact selector in ContactsSampleWindowController.m file

- (void)addAContact {

    for (int i = 0; i < 10; i++) {   ///////////// MY ADDED CODES //////////////
        NSString *title = [mAddTitleField stringValue];
        NSString *email = [mAddEmailField stringValue];

        if ([title length] > 0) {

            GDataEntryContact *newContact;
            newContact = [GDataEntryContact contactEntryWithFullNameString:title];

            if ([email length] > 0) {
                // all items must have a rel or a label, but not both
                GDataEmail *emailObj = [GDataEmail emailWithLabel:nil
                                                          address:email];
                [emailObj setRel:kGDataContactOther];
                [emailObj setIsPrimary:YES];

                [newContact addEmailAddress:emailObj];
            }

            if ([mMyContactsCheckbox state] == NSOnState) {
                // add this to the MyContacts group too
                GDataFeedContactGroup *groupFeed = [self groupFeed];
                GDataEntryContactGroup *myContactsGroup
                = [groupFeed entryForSystemGroupID:kGDataSystemGroupIDMyContacts];

                NSString *myContactsGroupID = [myContactsGroup identifier];

                GDataGroupMembershipInfo *groupInfo
                = [GDataGroupMembershipInfo groupMembershipInfoWithHref:myContactsGroupID];

                [newContact addGroupMembershipInfo:groupInfo];
            }

            GDataServiceGoogleContact *service = [self contactService];

            NSURL *postURL = [[mContactFeed postLink] URL];

            [service fetchEntryByInsertingEntry:newContact
                                     forFeedURL:postURL
                                       delegate:self
                              didFinishSelector:@selector(addContactTicket:addedEntry:error:)];
        }
    }  
}

2. Modify addContactTicket:addedEntry:error: selector in 
ContactsSampleWindowController.m file

// add contact callback
- (void)addContactTicket:(GDataServiceTicket *)ticket
              addedEntry:(GDataEntryContact *)object
                   error:(NSError *)error {
  if (error == nil) {
         ///////////// MY CODES START HERE //////////////

      // now update the entry on the server
      GDataPhoneNumber *phonenumberObj = [GDataPhoneNumber phoneNumberWithString:@"888-888-888"];
      [phonenumberObj setLabel:kGDataPhoneNumberWorkMobile];
      [object addPhoneNumber:phonenumberObj];

      GDataServiceGoogleContact *service = [self contactService];

      [service fetchEntryByUpdatingEntry:object
                                delegate:self
                       didFinishSelector:@selector(updateItemAfterInsertTicket:finishedWithEntry:error:)];

      return ;
   ///////////// END! //////////////

    // tell the user that the add worked
    NSBeginAlertSheet(@"Added contact", nil, nil, nil,
                      [self window], nil, nil,
                      nil, nil, @"Contact added");

    [mAddTitleField setStringValue:@""];
    [mAddEmailField setStringValue:@""];

    // refetch the current contacts
    [self fetchAllGroupsAndContacts];
    [self updateUI];
  } else {
    // failure to add contact
    NSBeginAlertSheet(@"Add failed", nil, nil, nil,
                      [self window], nil, nil,
                      nil, nil, @"Contact add failed: %@", error);
  }
}

3. New updateItemAfterInsertTicket:finishedWithEntry:error: selector in 
ContactsSampleWindowController.m file

- (void)updateItemAfterInsertTicket:(GDataServiceTicket *)ticket
                  finishedWithEntry:(GDataEntryContact *)object
                              error:(NSError *)error {
    if (error == nil) {
        NSLog(@"Successfully!");
    }
    else {
        NSLog(@"%@", error);
    }
}

////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////

Now, you can run ContactsSmaple application and input contact's name (and email 
address) then click "Add" button to new contact. Error occured ...

////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////

BELOW are my console logs:

2011-02-27 10:41:49.171 ContactsSample[7772:a0f] Successfully!
2011-02-27 10:41:49.442 ContactsSample[7772:a0f] 
serviceBase:<GDataServiceGoogleContact: 0x366b70> 
objectFetcher:<GDataHTTPFetcher: 0x65f660> failedWithStatus:404 data:Contact 
not found, contact ID: 444299708189075872
2011-02-27 10:41:49.528 ContactsSample[7772:a0f] Error 
Domain=com.google.GDataServiceDomain Code=404 UserInfo=0x3b4da0 "The operation 
couldn’t be completed. (Contact not found, contact ID: 444299708189075872)"
2011-02-27 10:41:49.536 ContactsSample[7772:a0f] Successfully!
2011-02-27 10:41:49.536 ContactsSample[7772:a0f] Successfully!
2011-02-27 10:41:49.537 ContactsSample[7772:a0f] Successfully!
2011-02-27 10:41:49.679 ContactsSample[7772:a0f] Successfully!
2011-02-27 10:41:49.745 ContactsSample[7772:a0f] 
serviceBase:<GDataServiceGoogleContact: 0x366b70> 
objectFetcher:<GDataHTTPFetcher: 0x670830> failedWithStatus:404 data:Contact 
not found, contact ID: 3058084309200748256
2011-02-27 10:41:49.746 ContactsSample[7772:a0f] Error 
Domain=com.google.GDataServiceDomain Code=404 UserInfo=0x3c63a0 "The operation 
couldn’t be completed. (Contact not found, contact ID: 3058084309200748256)"
2011-02-27 10:41:49.852 ContactsSample[7772:a0f] 
serviceBase:<GDataServiceGoogleContact: 0x366b70> 
objectFetcher:<GDataHTTPFetcher: 0x664720> failedWithStatus:404 data:Contact 
not found, contact ID: 4147151643810794597

////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////

Original comment by AppRank...@gmail.com on 27 Feb 2011 at 3:03

GoogleCodeExporter commented 9 years ago
Thanks, I can reproduce the problem reliably now. The Contacts API server team 
is investigating the issue. The internal tracking number for the bug is 
b/3496809

Original comment by grobb...@google.com on 1 Mar 2011 at 12:01

GoogleCodeExporter commented 9 years ago
Thanks, How can I know the repare progress info ?

Original comment by AppRank...@gmail.com on 1 Mar 2011 at 10:05

GoogleCodeExporter commented 9 years ago
The Contacts API server team believes this is now resolved. A change in how the 
server stores contacts hurt latency of availability of changed data, but they 
have reverted the change.

Thank you for reporting this issue, and for persisting in helping us to 
reproduce it.

Original comment by grobb...@google.com on 2 Mar 2011 at 12:38

GoogleCodeExporter commented 9 years ago
Good work. Thanks Contacts API server team.

Original comment by AppRank...@gmail.com on 2 Mar 2011 at 7:19