2.2.2.2 Session

A client MUST attach a <Session> header to a DSML SOAP message that contains a <dsml:batchRequest> payload in order to instruct the server that the payload MUST be processed in the context of a previously allocated session.

The client specifies the <Session> header as follows:

  • The "urn:schema-microsoft-com:activedirectory:dsmlv2" XML namespace MUST be specified.<3>

  • The soap:mustUnderstand attribute MUST be set to 1.

Subsequently, the server MUST attach a <Session> header to a DSML SOAP response message that contains a <dsml:batchResponse> payload in order to indicate that the corresponding <dsml:batchRequest> payload was processed in the context of a session.

The server MUST attach a <Session> header when responding to a DSML SOAP message from a client that contained a <BeginSession> header (section 2.2.2.1), a <Session> header, or an <EndSession> header (section 2.2.2.3).

The following XML shows a <Session> header and a <dsml:batchRequest> payload as sent by a client in a SOAP message.

[SOAP]

 <soap:Envelope>
   <soap:Header>
     <ad:Session xmlns:ad="urn:schema-microsoft-com:activedirectory:dsmlv2"
       ad:SessionID="sessionId" soap:mustUnderstand="1" />
   </soap:Header>
   <soap:Body>
     <dsml:batchRequest>
       DSML payload
     </dsml:batchRequest>
   </soap:Body>
 </soap:Envelope>
  

In the preceding script, sessionId MUST be the identifier that was returned from the server in a preceding <Session> header. Its type is sessionId (section 2.2.5.1).

The following XML shows a <Session> header and a <dsml:batchResponse> payload as sent by the server in a SOAP message.

[SOAP]

 <soap:Envelope>
   <soap:Header>
     <ad:Session xmlns:ad="urn:schema-microsoft-com:activedirectory:dsmlv2"
       ad:SessionID="sessionId" />
   </soap:Header>
   <soap:Body>
     <dsml:batchResponse>
       DSML payload
     </dsml:batchResponse>
   </soap:Body>
 </soap:Envelope>
  

In the preceding script, if the server is returning this <Session> header in response to a BeginSession operation performed by the client, then the sessionId MUST be a unique value that is freshly allocated by the server and associated with the newly-created session.

Instead, if the server is returning this <Session> header in response to a Session or EndSession operation performed by the client, then the sessionId MUST be the same value as that passed in by the client.