xcodeios6activesyncwbxml

xml to wbxml conversion for activesync in iOS


I have been trying to built an app which will communicate with MS-ActiveSync Exchange. I am stuck at the provisioning part. I need to send a post HTTP request with WBXML content in body. But I could not find anything anywhere to convert xml to wbxml for active sync.

There are some C based libraries available like wbxml2, but can I use them for active sync. There are no code pages provided in the library as mentioned in MS-Activesync Exchange documentation. Please help!!!


Solution

  • Use libwbxml. The package has xml2wbxml and wbxml2xml. Code pages are included.

    save this as prov.xml:

    <?xml version="1.0"?>
    <!DOCTYPE ActiveSync PUBLIC "-//MICROSOFT//DTD ActiveSync//EN" "http://www.microsoft.com/">
    <Provision xmlns="Provision:">
    <Policies>
    <Policy>
    <PolicyType>MS-WAP-Provisioning-XML</PolicyType>
    </Policy></Policies></Provision>
    

    then:

    xml2wbxml -a prov.xml -o prov.wbxml
    

    You can manipulate wbxml as text. In https://code.google.com/p/tz-push/

    In javascript:

     prov.wbxml = string.fromCharCode(0x03,0x01,0x6A,0x00,0x00,0x0E,0x45,0x46,0x47,0x48,0x03,0x4D,0x53,0x2D,0x57,0x41,0x50,0x2D,0x50,0x72,0x6F,0x76,0x69,0x73,0x69,0x6F,0x6E,0x69,0x6E,0x67,0x2D,0x58,0x4D,0x4C,0x00,0x01,0x01,0x01,0x01)