Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: SOAP response structure for GetContactsRequest

  1. #11
    parin is offline Active Member
    Join Date
    Feb 2013
    Location
    India
    Posts
    28
    Rep Power
    2

    Default

    @liverpoolfcfan

    I got it for parsing Emails.we can do same in Java like above code.. but how will you parse addresses..to make the case more worsen enter random single values in multiple address like in adress 1 with type home enter only City. in address 2 with type Other enter only Street. and in address 3 with type Home again enter State or Country. now this is my ultimate and most dangerous parsing case ever.

  2. #12
    liverpoolfcfan's Avatar
    liverpoolfcfan is offline Outstanding Member
    Join Date
    Oct 2009
    Location
    Dublin, IRELAND
    Posts
    712
    Rep Power
    6

    Default

    Same principle applies.

    All are stored in sets.
    homeStreet,homeCity,homePostalCode,homeCountry make up the first set.
    homeStreet2,homeCity2,homePostalCode2,homeCountry2 make up the second set.
    etc.

    Same goes for work... and other...

    You just need to adjust your isset checks to look for the existence of any one of the 4 pieces of information for any given address set

    NOTE: The zimbra web UI does a bad job of SAVING these if you do as you said - just enter random single pieces of information in for each address.
    Last edited by liverpoolfcfan; 11-28-2013 at 07:56 AM. Reason: changed parsing to SAVING

  3. #13
    liverpoolfcfan's Avatar
    liverpoolfcfan is offline Outstanding Member
    Join Date
    Oct 2009
    Location
    Dublin, IRELAND
    Posts
    712
    Rep Power
    6

    Default

    By the way, I have opened a bug on the behaviour of the Web Client saving these partially entered addresses
    Bug 85145 ? Addresses muddled if not all fields filled in for Contact

  4. #14
    parin is offline Active Member
    Join Date
    Feb 2013
    Location
    India
    Posts
    28
    Rep Power
    2

    Default

    Actually we can not say it is a bug of the web ui.. that is the only problem i am talking about.. user can enter anything of any type inside address.like you tried to enter 5 addresses of same type HOME. now what happens is when we try to fetch that contact from SOAP request,the resulting response has muddled attributes. this is the default behavior and we can not say it is a bug.so that is why i am suggesting to have some arragement of attribute data. now imagine a worst case having 5 addresses and each having only City field. now when we will fetch that contact, the response will contain something like this.

    <a n="firstName">Jhon</a>
    <a n="homeCity">XYZ</a>
    <a n="lastName">smith</a>
    <a n="email">test@test.com</a>
    <a n="homeCity1">XYZ</a>
    <a n="email1">test@test.com</a>
    <a n="email2">test@test.com</a>
    <a n="homeCity2">XYZ</a>
    ..
    .
    .
    .
    .
    <a n="homeCity5">XYZ</a>


    Now this is the usual response we get through SOAP request. so once we get this data,arrays of A tag is prepared.now think how you will parse addresses. because you dont know the arrangement ! also to parse simple data like firstName or lastName, we must travers entire array. and according to me this is not efficient. so i suggest they must have some proper ordering. so it is a severe problem of arrangement and not a bug.

  5. #15
    gren is offline Zimbra Employee
    Join Date
    Aug 2010
    Location
    England
    Posts
    37
    Rep Power
    5

    Default

    Quote Originally Posted by parin View Post
    @liverpoolfcfan

    exactly correct.. we see a response part only. but my question is how it is going to store in underlying database. take an example of emails just as above and we have table relationship like Contact Table for contact details and Email table for contactEmail details. now Contact and ContactEmail have O2M relationship.means one contact can have 0 or more emails. so now the problem arises. json response will simply return _attr element with list of contact attribute. so my question is how we will find multiple emails from that Map. also the problem becomes more complecated when user enters multiple addresses. and in that case it becomes more worsen when users like me adds single value like city in one address,street in second address and state in another address for testing.so now finding out how many addresses user have entered is very tough. can you help me in this case. ???
    I think the other replies to this are probably more useful than what I'm saying here but one of your questions was about how this is stored in the server. The contact fields are actually stored encoded in the metadata column in the database. A command like:
    Code:
    # zmmetadump -m user2@coco.local -i 257
    will decode the contents of the metadata column (along with other database columns) to produce output like:
    Code:
    [Database Columns]
      mailbox_id: 2
      id: 257
      type: 6
      parent_id: <null>
      folder_id: 7
      index_id: 0
      imap_id: 257
      date: 1385847060 (Sat 2013/11/30 21:31:00 GMT)
      size: 0
      locator: <null>
      blob_digest: <null>
      unread: <null>
      flags: 0
      tags: 0
      tag_names: <null>
      sender: Goose, Gray
      recipients: <null>
      subject: <null>
      name: <null>
      mod_metadata: 2
      change_date: 1385847060 (Sat 2013/11/30 21:31:00 GMT)
      mod_content: 2
      uuid: <null>
    
    [Metadata]
    {
      fld = {
        email = gg@example.com
        email2 = ggoose@eg.com
        email3 = gray.goose@example.com
        firstName = Gray
        lastName = Goose
      }
    }
    If you download the Zimbra source, the file responsible for encoding/decoding this field is ZimbraServer/src/java/com/zimbra/cs/mailbox/Metadata.java.
    The zmmetadata source is in ZimbraServer/src/java/com/zimbra/cs/mailbox/util/MetadataDump.java
    Gren Elliot
    Lead Engineer - Server
    Zimbra | Community & Collaboration

  6. #16
    parin is offline Active Member
    Join Date
    Feb 2013
    Location
    India
    Posts
    28
    Rep Power
    2

    Default

    @gren,@liverpoolfcfan

    Thank you both of you for giving responses. but still i am unable to express what problem i am facing. you will think this as a counter argument. but the fact is i am unable to make you understand what my problem is. i request you to read my actual problem in the post below.


    Same principle applies.

    All are stored in sets.
    homeStreet,homeCity,homePostalCode,homeCountry make up the first set.
    homeStreet2,homeCity2,homePostalCode2,homeCountry2 make up the second set.
    etc.

    Same goes for work... and other...

    You just need to adjust your isset checks to look for the existence of any one of the 4 pieces of information for any given address set

    NOTE: The zimbra web UI does a bad job of SAVING these if you do as you said - just enter random single pieces of information in for each address.
    and what i replyed to this response..

    Actually we can not say it is a bug of the web ui.. that is the only problem i am talking about.. user can enter anything of any type inside address.like you tried to enter 5 addresses of same type HOME. now what happens is when we try to fetch that contact from SOAP request,the resulting response has muddled attributes. this is the default behavior and we can not say it is a bug.so that is why i am suggesting to have some arragement of attribute data. now imagine a worst case having 5 addresses and each having only City field. now when we will fetch that contact, the response will contain something like this.

    <a n="firstName">Jhon</a>
    <a n="homeCity">XYZ</a>
    <a n="lastName">smith</a>
    <a n="email">test@test.com</a>
    <a n="homeCity1">XYZ</a>
    <a n="email1">test@test.com</a>
    <a n="email2">test@test.com</a>
    <a n="homeCity2">XYZ</a>
    ..
    .
    .
    .
    .
    <a n="homeCity5">XYZ</a>


    Now this is the usual response we get through SOAP request. so once we get this data,arrays of A tag is prepared.now think how you will parse addresses. because you dont know the arrangement ! also to parse simple data like firstName or lastName, we must travers entire array. and according to me this is not efficient. so i suggest they must have some proper ordering. so it is a severe problem of arrangement and not a bug.

    so actually this post asks multiple questions about the algorithm and both database structure. so according to my problem,user can enter anything any number of times in address fields. the resulting soap request will contatin whataver non-null values in form of <a n="..."></a>.. so this is not at all a problem for me. it is just a soap request structure. my problem starts when we actually try to fetch those data back in order to store into my local database.when we try to fetch that contact containing multiple addresses, it is mearly impossible to construct a whole address out of that list of attributes. because the resulting response contains list of <a n=""/> in no order. so we have no clue whether user has enter address or if so wht fields user has entered. in order to answer those questions,we must loop through that list. so my actual question is something like this. how the web client displays muddled addresses field into correct address type.

    for database structure i am using one main Contact table with number of other tables like Phone,Address,Email for multiple values. so another question is that ,is my db structure is correct?? if not what modification should be done in order to store contact details.

Page 2 of 2 FirstFirst 12

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Refresh tab with soap response
    By bud in forum Developers
    Replies: 0
    Last Post: 09-04-2012, 03:14 AM
  2. How to read attribute value in soap response
    By hugo@dlshk in forum Zimlets
    Replies: 1
    Last Post: 04-12-2012, 07:59 PM
  3. Zimbra 6 SOAP response changes ?
    By Aderium in forum Developers
    Replies: 0
    Last Post: 09-22-2009, 02:36 PM
  4. How to handle SOAP body response in PHP
    By ferdinant in forum Developers
    Replies: 1
    Last Post: 07-03-2007, 01:21 PM
  5. Whitespaces in SOAP response
    By smies in forum Developers
    Replies: 2
    Last Post: 11-05-2005, 03:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •