Results 1 to 6 of 6

Thread: Delete a calendar appointment via SOAP

  1. #1
    kkuilla is offline Starter Member
    Join Date
    Jan 2009
    Posts
    2
    Rep Power
    6

    Default Delete a calendar appointment via SOAP

    Dear all,

    I am trying to add and delete Zimbra calendar events via SOAP and PHP. I have ten different users and I try to automatically create and delete events in their calendar. I have solved the authentication and have managed to post events but I can't delete them.

    To get an idea of what the delete message should look like, I delete an appointment manually and then observer the browser console for a delete soap message. I then investigated the soap message and copied and pasted what I thought was relevant.

    This is the soap message for creating an event:

    Request:
    Code:
    <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-
    ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:zimbraMail" 
    xmlns:ns2="urn:zimbra"><SOAP-ENV:Header><ns2:context>
    <authToken>0_ed0dafcfaa3f5497d3d5a29bae35aba7b18d5afc_69643d33363a63343064383963312d383839332d343933652d613738622d6562313161326666643638393b6578703d31333a313233313933373831323730393b6169643d33363a37303335353137332d666464312d343533652d383832362d3933633330666165623034613b747970653d363a7a696d6272613b</authToken>
    </ns2:context></SOAP-ENV:Header><SOAP-ENV:Body>
    <ns1:CreateAppointmentRequest><m xmlns="" l="10"><inv id="abs1"><comp 
    status="CONF" fb="B" class="PUB" transp="O" allDay="0" name="1" loc="316"> <s 
    tz="(GMT) Greenwich Mean Time - Dublin / Edinburgh / Lisbon / London" 
    d="20090113T150000"/><e tz ="(GMT) Greenwich Mean Time - Dublin / Edinburgh / 
    Lisbon / London" d="20090113T153000"/><or a="davidr:kclies001" d=""/><alarm 
    action="DISPLAY"><trigger><rel m="5" related="START" neg="1"/></trigger></alarm>
    </comp></inv><su>Dont know what this is for</su><mp ct="multipart/alternative"><mp 
    ct="text/plain" ><content></content></mp><mp ct="text/html"><content>&lt;html&gt;&lt;
    body&gt;&lt;/body&gt;&lt;/html&gt;</content></mp></mp>
    </m></ns1:CreateAppointmentRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>


    And this is the response:

    Code:
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope
    /"><soap:Header><context xmlns="urn:zimbra"><sessionId id="1598">1598</sessionId>
    <refresh><version>5.0.11_GA_2695.UBUNTU8 20081117052520 20081117-0527 
    FOSS</version><mbx s="343539"/><tags/><folder n="0" l="11" name="USER_ROOT" 
    s="0" id="1" rev="1"><folder view="document" n="0" l="1" name="Briefcase" s="0" 
    id="16" rev="1"/><folder view="appointment" f="#" n="17" l="1" name="Calendar" 
    s="42216" id="10" rev="1"/><folder view="message" n="0" l="1" name="Chats" s="0" 
    id="14" rev="1"/><folder view="contact" n="0" l="1" name="Contacts" s="0" id="7" 
    rev="1"/><folder view="message" n="0" l="1" name="Drafts" s="0" id="6" rev="1"/>
    <folder view="contact" n="0" l="1" name="Emailed Contacts" s="0" id="13" rev="1"/>
    <folder view="message" n="0" l="1" name="Inbox" s="0" id="2" rev="1"/><folder 
    view="message" n="0" l="1" name="Junk" s="0" id="4" rev="1"/><folder view="wiki" 
    n="0" l="1" name="Notebook" s="0" id="12" rev="1"/><folder view="message" n="0" 
    l="1" name="Sent" s="0" id="5" rev="1"/><folder view="task" f="#" n="0" l="1" 
    name="Tasks" s="0" id="15" rev="1"/><folder n="121" l="1" name="Trash" s="301323" 
    id="3" rev="1"/></folder></refresh><change token="1102"/><notify seq="1">
    <created><appt d="1231934212000" uid="933f732c-dbf6-44d8-b5b8-b6ffeb5a8bd7" l="10" 
    s="2479" id="675" rev="1102"><inv type="appt" seq="0" compNum="0" id="674"><tz 
    dayoff="60" stdoff="0" id="(GMT) Greenwich Mean Time - Dublin / Edinburgh / Lisbon / 
    London"><standard sec="0" hour="2" wkday="1" min="0" mon="10" week="-1"/>
    <daylight sec="0" hour="1" wkday="1" min="0" mon="3" week="-1"/></tz><comp 
    d="1231934212000" class="PUB" loc="316" transp="O" seq="0" uid="933f732c-
    dbf6-44d8-b5b8-b6ffeb5a8bd7" fb="B" status="CONF" fba="T" apptId="675" 
    calItemId="675" compNum="0" rsvp="1" x_uid="933f732c-dbf6-44d8-b5b8-b6ffeb5a8bd7" 
    name="1"><alarm action="DISPLAY"><trigger><rel neg="1" m="5" related="START"/>
    </trigger><desc/></alarm><desc/><or a="davidr:kclies001" url="davidr:kclies001"/><s 
    d="20090113T150000" tz="(GMT) Greenwich Mean Time - Dublin / Edinburgh / Lisbon / 
    London"/><e d="20090113T153000" tz="(GMT) Greenwich Mean Time - Dublin / 
    Edinburgh / Lisbon / London"/></comp></inv><replies/></appt></created><modified>
    <folder n="17" s="42216" id="10"/><mbx s="343539"/></modified></notify></context>
    
    
    </soap:Header><soap:Body><CreateAppointmentResponse apptId="675" 
    calItemId="675" invId="675-674" xmlns="urn:zimbraMail"/></soap:Body>
    </soap:Envelope>

    Unfortunately, I get a soap error for my delete message. Does anyone know where I go wrong?

    This is the soap message I managed to compose for deleting an appointment, after watching the browser console:

    Request:

    Code:
    <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-
    ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:zimbraAdmin" 
    xmlns:ns2="urn:zimbra"><SOAP-ENV:Header><ns2:context>
    <authToken>0_a49beecd5e64004a79113e85ef690bcf8f8b5967_69643d33363a63343064383963312d383839332d343933652d613738622d6562313161326666643638393b6578703d31333a313233313933383238383338373b6169643d33363a37303335353137332d666464312d343533652d383832362d3933633330666165623034613b747970653d363a7a696d6272613b</authToken>
    </ns2:context></SOAP-ENV:Header><SOAP-ENV:Body>
    <ns1:CancelAppointmentRequest>xmlns="urn:zimbraMail" id="abs1" comp="0"><m 
    xmlns=""><su>Cancelled: 9</su><mp ct="multipart/alternative"><mp ct="text/plain">
    <content ></content></mp><mp ct="text/html"><content>&lt;html&gt;&lt;body&gt;&
    lt;/body&gt;&lt;/html&gt;</content ></mp></mp></m></ns1:CancelAppointmentRequest>
    </SOAP-ENV:Body></SOAP-ENV:Envelope>


    And this is the response:

    Code:
    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Body><soap:Fault><soap:Code><soap:Value>soap:Receiver</soap:Value>
    </soap:Code><soap:Reason><soap:Text>system failure: 
    com.zimbra.common.soap.Element$ContainerException: cannot set text on element with 
    children</soap:Text></soap:Reason><soap:Detail><Error xmlns="urn:zimbra">
    <Code>service.FAILURE</Code>
    <Trace>btpool0-7:1231934688553:7d35dd8954845b2f</Trace></Error></soap:Detail>
    </soap:Fault></soap:Body></soap:Envelope>

    Thanks,
    Rgds /Sam

  2. #2
    jholder's Avatar
    jholder is offline Former Zimbran
    Join Date
    Oct 2005
    Location
    Thatcher, AZ
    Posts
    5,606
    Rep Power
    20

    Default

    Hello, and welcome Sam!

    I see two problems with your SOAP request.

    Your request is:
    Code:
    <?xml version="1.0" encoding="UTF-8"?> 
        <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:zimbraAdmin" xmlns:ns2="urn:zimbra">
            <SOAP-ENV:Header>
                <ns2:context>
                    <authToken>0_a49beecd5e64004a79113e85ef690bcf8f8b5967_69643d33363a63343064383963312d383839332d343933652d613738622d6562313161326666643638393b6578703d31333a313233313933383238383338373b6169643d33363a37303335353137332d666464312d343533652d383832362d3933633330666165623034613b747970653d363a7a696d6272613b</authToken>
                </ns2:context>
            </SOAP-ENV:Header>
            <SOAP-ENV:Body>
                <ns1:CancelAppointmentRequest>xmlns="urn:zimbraMail" id="abs1" comp="0">
                <m xmlns="">
                    <su>Cancelled: 9</su>
                    <mp ct="multipart/alternative">
                        <mp ct="text/plain">
                            <content ></content>
                        </mp>
                        <mp ct="text/html">
                            <content><html><body>&lt;/body></html></content >
                        </mp>
                    </mp>
                </m>
                </ns1:CancelAppointmentRequest>
    </SOAP-ENV:Body></SOAP-ENV:Envelope>
    Problem one is that xmlns="urn:zimbraMail" isn't properly formatted. It should be:
    Code:
    <xmlns="urn:zimbraMail" id="abs1" comp="0">
    The second issue is that you introduce a body tag, but the closing tag is encoded:
    Code:
    <content><html><body>&lt;/body></html></content >
    should be:
    Code:
    <content><html><body></body></html></content>
    Good luck,
    john

  3. #3
    kkuilla is offline Starter Member
    Join Date
    Jan 2009
    Posts
    2
    Rep Power
    6

    Default

    Thanks for your reply. Very helpful. However, after making changes I still get an error, "Unknown document". What does this unknown document refer to? Is it the SOAP document or the appointment I am trying to access? I first thought that I used the wrong appointment ID but the id appeared to be correct. I can't figure out why I get the error. Do you have any idea?

    I still look in the console of the browser to get an idea of what the SOAP message should look like and adjust it to what I think would fit. This is what I came up with:

    This is my request:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:ns1="urn:zimbraAdmin" xmlns:ns2="urn:zimbra"><SOAP-ENV:Header>
    <ns2:context>
    <authToken>0_abe599b1fbc30df702316cf6eb975432bdb6ded2_69643d33363a34633862343764612d326533312d343031622d386235372d3633313333643633653434363b6578703d31333a313233323435313130383635313b6169643d33363a37303335353137332d666464312d343533652d383832362d3933633330666165623034613b747970653d363a7a696d6272613b</authToken>
    </ns2:context></SOAP-ENV:Header><SOAP-ENV:Body>
    <ns1:CancelAppointmentRequest><CancelAppointmentRequest xmlns="urn:zimbraMail" 
    id="abs1" comp="0"><m xmlns=""><su>Cancelled: kclies</su><mp 
    ct="multipart/alternative"><mp ct="text/plain"><content></content></mp><mp 
    ct="text/html"><content><content><html><body></body></html></content></content
    ></mp></mp></m></CancelAppointmentRequest></ns1:CancelAppointmentRequest>
    </SOAP-ENV:Body></SOAP-ENV:Envelope>
    And this is the response:

    Code:
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope">
    <soap:Header><context xmlns="urn:zimbra"><change token="19"/></context>
    </soap:Header><soap:Body><soap:Fault><soap:faultcode>soap:Client</soap:faultcode>
    <soap:faultstring>unknown document: ns1:CancelAppointmentRequest</soap:faultstring>
    <soap:detail><Error xmlns="urn:zimbra"> 
    Code>service.UNKNOWN_DOCUMENT</Code>
    <Trace>btpool0-13:1232447544387:7d35dd8954845b2f</Trace></Error></soap:detail>
    </soap:Fault></soap:Body></soap:Envelope>


    Thanks,
    Rgds /Sam

  4. #4
    jholder's Avatar
    jholder is offline Former Zimbran
    Join Date
    Oct 2005
    Location
    Thatcher, AZ
    Posts
    5,606
    Rep Power
    20

    Default

    This might be helpful.
    Attached Files Attached Files

  5. #5
    Michael REMY is offline Loyal Member
    Join Date
    Jun 2009
    Posts
    93
    Rep Power
    5

    Default

    hi kkuilla !

    did you success in solving your problem ?

    Shall you publish your solution to create and delete an appointment please ?

    It should be very pretty helpful for the community.

    Thanks by advance

  6. #6
    Michael REMY is offline Loyal Member
    Join Date
    Jun 2009
    Posts
    93
    Rep Power
    5

    Unhappy hi

    Quote Originally Posted by jholder View Post
    This might be helpful.
    hi !

    i have exactly the same problem and i follow the doc you provided. It says :
    //////////////////////////////////////////////////////////////////////
    //
    // CancelAppointment(DEFAULT-INVITE-ID, COMPONENT-NUMBER)
    //
    // NOTE: If canceling an exception, the original instance (ie the one the exception was "excepting") WILL NOT
    // be restored when you cancel this exception.
    //
    // if <inst> is set, then this cancels just the specified instance or range of instances,
    // otherwise it cancels the entire appointment. If <inst> is not set, then id MUST refer to the default
    // invite for the appointment.
    //
    <CancelAppointmentRequest id="ID_OF_DEFAULT_INVITE" comp="COMPONENT_NUM_DEFAULT_INVITE">
    [<tz ...>] // definition for TZID referenced by DATETIME in <inst>
    [<inst [range="THISANDFUTURE|THISANDPRIOR"] DATETTIME/>]?
    [ <m>
    [<e.../>*] // users to send update to
    [<su>{subject of cancellation mail}</su>]
    <mp>...</mp>
    </m> ]
    </CancelAppointmentRequest>
    And the response is :

    <CancelAppointmentResponse>....
    oh my god, the documentation is incompleted for the CancelAppointmentResponse detail.


    Should an expert help us ?

    here the req i send :


    Code:
    <CancelAppointmentRequest id="25017-25016" comp="0">
      <m xmlns=""><su>Annulation: un nom</su><mp ct="multipart/alternative"><mp ct="text/plain"><content></content></mp><mp ct="text/html"><content>&lt;html&gt;&lt;body&gt;&lt;html&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;&lt;/body&gt;&lt;/html&gt;</content></mp></mp></m>   
    </CancelAppointmentRequest>
    and here is the respond i get :
    Array
    (
    [SOAP:FAULT] => Array
    (
    [SOAP:CODE] => Array
    (
    [SOAP:VALUE] => Array
    (
    [DATA] => soap:Sender
    )

    )

    [SOAP:REASON] => Array
    (
    [SOAP:TEXT] => Array
    (
    [DATA] => unknown document: CancelAppointmentRequest
    )

    )

    [SOAPETAIL] => Array
    (
    [ERROR] => Array
    (
    [XMLNS] => urn:zimbra
    [CODE] => Array
    (
    [DATA] => service.UNKNOWN_DOCUMENT
    )

    [TRACE] => Array
    (
    [DATA] => btpool0-37998:http://77.246.84.130:80/service/soap:1272448885411:01b1f7311b8ec6f6
    )

    )

    )

    )

    )

    so, where is the problem ?

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Delete an Appointment via SOAP ?
    By minhle3012 in forum Developers
    Replies: 9
    Last Post: 09-26-2012, 07:47 PM
  2. [SOLVED] Copy appointment to another calendar
    By Cocophone in forum General Questions
    Replies: 9
    Last Post: 01-22-2010, 01:11 PM
  3. Replies: 3
    Last Post: 05-08-2009, 08:26 AM
  4. [SOLVED] php soap to add appointment in calendar
    By underdog in forum Developers
    Replies: 2
    Last Post: 09-18-2008, 06:08 AM
  5. Replies: 0
    Last Post: 08-04-2008, 07:44 AM

Posting Permissions

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