Share via


4 Protocol Examples

The following example is a complete message exchange between a client and server.

For more information about MDM provider classes, see [MSDN-MDMSetProv].

For more information about configuration service providers, see [MSDN-CSPRef].

  
 //  The client issues a DM session initialization SyncML message to
 //  the management server.  The message includes an Alert command
 //  and a Replace command along with information about the device.
  
 <SyncML xmlns="SYNCML:SYNCML1.2">
  
   <SyncHdr>
     <VerDTD>1.2</VerDTD>
     <VerProto>DM/1.2</VerProto>
     <SessionID>1</SessionID>
     <MsgID>1</MsgID>
     <Target>
       <LocURI>https://contoso.com/management-server</LocURI>
     </Target>
     <Source>
       <LocURI>{unique device id}</LocURI>
     </Source>
   </SyncHdr>
  
   <SyncBody>
     <Alert>
       <CmdID>2</CmdID>
       <Data>1224</Data>
       <Item>
          <Meta>
             <Type xmlns="syncml:metinf">com.microsoft/MDM/LoginStatus</Type>
          </Meta>
          <Data>user</Data>
       </Item>
     </Alert>
     <Replace>
       <CmdID>3</CmdID>
       <Item>
         <Source>
           <LocURI>./DevInfo/DevId</LocURI>
         </Source>
         <Data>{unique device id}</Data>
       </Item>
       <Item>
         <Source>
           <LocURI>./DevInfo/Man</LocURI>
         </Source>
         <Data>Microsoft Corporation</Data>
       </Item>
       <Item>
         <Source>
           <LocURI>./DevInfo/Mod</LocURI>
         </Source>
         <Data>{operating system description}</Data>
       </Item>
       <Item>
         <Source>
           <LocURI>./DevInfo/DmV</LocURI>
         </Source>
         <Data>1.3</Data>
       </Item>
       <Item>
         <Source>
           <LocURI>./DevInfo/Lang</LocURI>
         </Source>
         <Data>en-US</Data>
       </Item>
     </Replace>
     <Final />
   </SyncBody>
 </SyncML>
  
 //  The server responds with the required Status command for the SyncHdr and
 //  Status commands for the requested Alert and Replace commands.  The server 
 //  requests more information from the client with a series of Get commands.
  
 <SyncML xmlns="SYNCML:SYNCML1.2"> 
  
   <SyncHdr> 
     <VerDTD>1.2</VerDTD> 
     <VerProto>DM/1.2</VerProto> 
     <SessionID>1</SessionID> 
     <MsgID>1</MsgID> 
     <Target> 
       <LocURI>{unique device id}</LocURI> 
     </Target> 
     <Source> 
       <LocURI>https://contoso.com/management-server</LocURI> 
     </Source> 
   </SyncHdr> 
  
   <SyncBody> 
     <Status> 
       <CmdID>1</CmdID> 
       <MsgRef>1</MsgRef> 
       <CmdRef>0</CmdRef> 
       <Cmd>SyncHdr</Cmd> 
       <Data>200</Data> 
     </Status> 
  
     <!-- The server issues Get commands on two nodes -->
  
     <Get> 
       <CmdID>4</CmdID> 
       <Item> 
         <Target> 
           <LocURI>./DevDetail/SwV</LocURI> 
         </Target> 
       </Item> 
     </Get> 
     <Get> 
       <CmdID>5</CmdID> 
       <Item> 
         <Target> 
           <LocURI>./ DevDetail/HwV</LocURI> 
         </Target> 
       </Item> 
     </Get>
     <Final /> 
   </SyncBody> 
 </SyncML>
  
 //  The client responds with a Status and Results command for each
 //  of the Get commands issued by the server.
  
 <SyncML xmlns="SYNCML:SYNCML1.2"> 
  
   <SyncHdr> 
     <VerDTD>1.2</VerDTD> 
     <VerProto>DM/1.2</VerProto> 
     <SessionID>1</SessionID> 
     <MsgID>2</MsgID> 
     <Target> 
       <LocURI>https://contoso.com/management-server</LocURI> 
     </Target> 
     <Source> 
       <LocURI>{unique device id}</LocURI> 
     </Source> 
   </SyncHdr> 
  
   <SyncBody> 
     <Status> 
       <CmdID>1</CmdID> 
       <MsgRef>1</MsgRef> 
       <CmdRef>0</CmdRef> 
       <Cmd>SyncHdr</Cmd> 
       <Data>200</Data> 
     </Status> 
     <Status> 
       <CmdID>2</CmdID> 
       <MsgRef>1</MsgRef> 
       <CmdRef>4</CmdRef> 
       <Cmd>Get</Cmd> 
       <Data>200</Data> 
     </Status> 
     <Status> 
       <CmdID>3</CmdID> 
       <MsgRef>1</MsgRef> 
       <CmdRef>5</CmdRef> 
       <Cmd>Get</Cmd> 
       <Data>200</Data> 
     </Status>
     <Results> 
       <CmdID>4</CmdID> 
       <MsgRef>1</MsgRef> 
       <CmdRef>4</CmdRef> 
       <Cmd>Get</Cmd> 
       <Item>
         <Source>
           <LocURI>./DevDetail/SwV</LocURI>
         </Source>
         <Meta>
           <Format xmlns="syncml:metinf">chr</Format>
         </Meta>
         <Data>[software version returned here]</Data>
       </Item>
     </Results>
     <Results> 
       <CmdID>5</CmdID> 
       <MsgRef>1</MsgRef> 
       <CmdRef>5</CmdRef> 
       <Cmd>Get</Cmd> 
       <Item>
         <Source>
           <LocURI>./DevDetail/HwV</LocURI>
         </Source>
         <!-- Class instance - opaque to the server -->
         <Data>[hardware version returned here]</Data>
       </Item>
     </Results>
     <Final /> 
   </SyncBody> 
 </SyncML>