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