none
Exchange Server returns 400 error on uploading meeting RRS feed

  • Question

  • I am trying to build a book your meeting  application using exchange 2010 in Android.
     I am using http://code.google.com/p/corporateaddressbook/  to familiarise myself with activesync.
     I have managed to get ResolveRecipients , SendMail and FolderSync commands working so far. However when I am trying
     to upload a meeting request I am getting a 400 Bad Request Error. I am using http://msdn.microsoft.com/en-us/library/gg675603%28v=exchg.80%29.aspx
       as reference.
     
     My xml

     

       

        <?xml version="1.0" encoding="utf-8"?>
        <Sync xmlns:calendar="Calendar" xmlns="AirSync">
            <Collections>
                <Collection>
                    <SyncKey>1425334024</SyncKey>
                    <CollectionId>4</CollectionId>
                    <GetChanges>1</GetChanges>
                    <Commands>
                        <Add>
                            <ClientId>5644895</ClientId>
                            <ApplicationData>
                                 <calendar:TimeZone>tv7//ygAVQBUAEMAKwAwADUAOgAzADAAKQAgAEMAaABlAG4AbgBhAGkALAAgAEsAbwBsAGsAYQB0AGEALAAgAE0AdQAAAAAAAAAAAAAAAAAAAAAAAAAAACgAVQBUAEMAKwAwADUAOgAzADAAKQAgAEMAaABlAG4AbgBhAGkALAAgAEsAbwBsAGsAYQB0AGEALAAgAE0AdQAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</calendar:TimeZone>
                                <calendar:StartTime>20130109T100000Z</calendar:StartTime>
                                <calendar:Subject>TestMeeting</calendar:Subject>
                                <calendar:UID>040000008200E90074C5B7101A82E0080000000036BD76EAAAD5CA01000000000000000010000000C45185F686A5D542B20BF2CE2F477D55</calendar:UID>
                                <calendar:Attendees>
                                    <calendar:Attendee>
                                        <calendar:Email>Test@test.com</calendar:Email>
                                        <calendar:Name>JohnDoe</calendar:Name>
                                        <calendar:AttendeeStatus>0</calendar:AttendeeStatus>
                                        <calendar:AttendeeType>1</calendar:AttendeeType>
                                    </calendar:Attendee>
                                </calendar:Attendees>
                                <calendar:Location>My Office</calendar:Location>
                                <calendar:EndTime>20130109T110000Z</calendar:EndTime>
                                <calendar:Sensitivity>0</calendar:Sensitivity>
                                <calendar:BusyStatus>1</calendar:BusyStatus>
                                <calendar:AllDayEvent>0</calendar:AllDayEvent>
                                <calendar:MeetingStatus>1</calendar:MeetingStatus>
                            </ApplicationData>
                        </Add>
                    </Commands>
                </Collection>
            </Collections>
        </Sync>


     The CreateHTTPPost function

     

        private HttpPost createHttpPost(String uri, String requestXML,
                    boolean includePolicyKey) throws Exception {
        
                // Set the common headers
                HttpPost httpPost = new HttpPost(uri);
                httpPost.setHeader("User-Agent", "Android");
                httpPost.setHeader("Accept", "*/*");
                httpPost.setHeader("Content-Type", "application/vnd.ms-sync.wbxml");
                //httpPost.setHeader("Content-Type", "message/rfc822");//message/rfc822
        
        
        
                // If we are connecting to Exchange 2010 or above
                // Lets tell the Exchange server that we are a 12.1 client
                // This is so we don't have to support sending of additional
                // information in the provision method
                if(getActiveSyncVersionFloat() >= 14.0)
                    httpPost.setHeader("MS-ASProtocolVersion", "12.1");
                // Else set the version to the highest version returned by the
                // Exchange server
                else
                    httpPost.setHeader("MS-ASProtocolVersion", getActiveSyncVersion());
        
        
                //Log.d(TAG, mActiveSyncVersion);
                httpPost.setHeader("Accept-Language", "en-us");
                httpPost.setHeader("Authorization", mAuthString);
        
                // Include policy key if required
                if (includePolicyKey)
                    httpPost.setHeader("X-MS-PolicyKey", mPolicyKey);
        
                // Add the XML to the request
                if (requestXML != null) {
                    //Log.d(TAG, requestXML);
                    // Set the body
                    // Convert the XML to WBXML
                    ByteArrayInputStream xmlParseInputStream = new ByteArrayInputStream(
                            requestXML.toString().getBytes());
        
                    java.io.ByteArrayOutputStream output = new java.io.ByteArrayOutputStream();
                    wbxml.convertXmlToWbxml(xmlParseInputStream, output);
                    byte[] bytes = output.toByteArray();
        
                    ByteArrayEntity myEntity = new ByteArrayEntity(bytes);
                    myEntity.setContentType("application/vnd.ms-sync.wbxml");
                    httpPost.setEntity(myEntity);
                }
                return httpPost;
            }

      Is there any headers I am missing ? OR Any error with the xml? I will be extremely obliged if somebody can throw some light.
    I am using activesync version 12.1 in headers.

      [1]: http://code.google.com/p/corporateaddressbook/
      [2]: http://msdn.microsoft.com/en-us/library/gg675603%28v=exchg.80%29.aspx
    Tuesday, January 8, 2013 12:52 PM