共用方式為


MDM Enrollment succeeds but SyncML session aborts without errors

When helping customers implement MDM solutions for Windows 8.1, we frequently encounter scenarios where the initial Enrollment with the MDM server succeeds, but right after enrollment, the SyncML session between the client and the MDM server seems to just “abort” without any errors and you are left with a daunting task of understanding what did your MDM server do wrong!

This blog discusses the basic problem most customers report.

OK, so here we go….

After the device has been setup with the initial HTTP request/response message exchange, the SyncML session starts with a HTTP request to the server which includes the basic device information.

In response to the server’s message, if the server expects that the client should continue further communication (such as the response of a command status), the server MUST ensure that the HTTP response – SyncML XML content is sent as a single line without extra line breaks or spaces in between the XML document.

If your server response contains new lines and/or extra spaces between the XML tags, we have noticed that the MDM Agent will just stop without issuing any further HTTP requests. At that point, the server does not quite know why there was no further communication from the client.

For example if your server was to send the following SyncML (I have taken out the actual sections and kept it short for brevity):

 <SyncML xmlns="SYNCML:SYNCML1.2"> 
   <SyncHdr> 
     <VerDTD>1.2</VerDTD> 
     <VerProto>DM/1.2</VerProto> 
     ...other elements... 
   </SyncHdr> 
   <SyncBody> 
     <Status> 
       ...other elements...
     </Status>
     <Replace>
       ...other elements...
     </Replace>
     <Get>
       ...other elements...
     </Get>
     <Final/>
   </SyncBody>
 </SyncML> 

You will notice that although the SyncML response looks syntactically correct and is visually very appealing, the XML parser tries to parse the above XML but actually fails with a XML parsing error! When the parsing error happens, the MDM Client just fails silently and the parsing error does not get relayed back to the server in the form of a HTTP request.

To resolve the problem and avoid the headaches of trying to comprehend why the MDM Agent does not communicate back to your server, you must ensure that your HTTP server response MUST be sent back as a single line without any extra spaces or new lines between the XML tags. Taking the above as an example, your “XML parser friendly response” MUST look like this:

 <SyncML xmlns="SYNCML:SYNCML1.2"><SyncHdr><VerDTD>1.2</VerDTD><VerProto>DM/1.2</VerProto>...other elements...</SyncHdr><SyncBody><Status>...other elements...</Status><Replace>...other elements...</Replace><Get>...other elements...</Get><Final/></SyncBody></SyncML>

Hopefully this blog helps get you over the very first hurdle in the MDM implementation puzzle – which looks quite daunting at first, but then it’s quite simple…or not :)

Until your next MDM issue, wishing you good luck!

- Prashant H Phadke