iosiphoneactivesync

Activesync Protocol integration


I am implementing AES Protocol on my iOS application. I am implementing folder sync command and i getting 200 response code with 341 length of data. When i am trying to convert the data in NSString it is showing meaningless data. So far i am assuming i must get WBXML data which i can parse. Below is my post request.

POST : Microsoft-Server-ActiveSync?Cmd=FolderSync&User=username&DeviceId=121213123&DeviceType=iOS

[request setValue:[NSString stringWithFormat:@"Basic %@",base64String] forHTTPHeaderField:@"Authorization"];
    [request setValue:@"iPhone" forHTTPHeaderField:@"DeviceType"];
    [request setValue:@"application/vnd.ms-sync.wbxml" forHTTPHeaderField:@"Content-Type"];
    [request setValue:msgLength forHTTPHeaderField:@"Content-Length"];
    [request setValue:@"14.0" forHTTPHeaderField:@"MS-ASProtocolVersion"];
    [request setValue:@"*/*" forHTTPHeaderField:@"Accept"];
    [request setValue:@"en-us" forHTTPHeaderField:@"Accept-Language"];
    [request setValue:nil forHTTPHeaderField:@"X-MS-PolicyKey"];

Here is my folder sync command.

<?xml version="1.0" encoding="utf-8"?>    
<FolderSync xmlns="FolderHierarchy:">    
<SyncKey> 0 </SyncKey>    
</FolderSync>

Here is the response hex data.

<03016a00 0007564c 03310001 52033100 014e5703 31310001 4f480331 00014903 30000147 0343616c 656e6461 7200014a 03380001 014f4803 32000149 03300001 4703436f 6e746163 74730001 4a033900 01014f48 03330001 49033000 01470344 656c6574 65642049 74656d73 00014a03 34000101 4f480334 00014903 30000147 03447261 66747300 014a0333 0001014f 48033500 01490330 00014703 496e626f 7800014a 03320001 014f4803 36000149 03300001 47034a6f 75726e61 6c00014a 03313100 01014f48 03370001 49033000 0147034a 756e6b20 456d6169 6c00014a 03313200 01014f48 03380001 49033000 0147034e 6f746573 00014a03 31300001 014f4803 39000149 03300001 47034f75 74626f78 00014a03 36000101 4f480331 30000149 03300001 47035365 6e742049 74656d73 00014a03 35000101 4f480331 31000149 03300001 47035461 736b7300 014a0337 00010101 01>


Solution

  • Finally i used library from https://github.com/jasenhuang/ASWBXml-c which solve my problem. :)