Figure 2   Response to PROPFIND Request
HTTP/1.1 207 Multi-Status
Server: Microsoft-IIS/5.0
Date: Mon, 15 Mar 1999 02:44:41 GMT
Content-Type: text/xml
Content-Length: 369


<?xml version="1.0"?>
<a:multistatus xmlns:a="DAV:" 
               xmlns:b="urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/">
    <a:response>
        <a:href>
            http://mattpo-nt5/davroot/foo.htm
        </a:href>
        <a:propstat>
            <a:status>
                HTTP/1.1 200 OK
            </a:status>
            <a:prop>
                <a:displayname>
                    foo.htm
                </a:displayname>
                <a:getcontentlength b:dt="int">
                    32
                </a:getcontentlength>
            </a:prop>
        </a:propstat>
    </a:response>
</a:multistatus>

Figure 3   _sc multi-resp


HTTP/1.1 207 Multi-Status
Server: Microsoft-IIS/5.0
Date: Wed, 17 Mar 1999 03:36:09 GMT
Content-Type: text/xml
Content-Length: 1582

<?xml version="1.0"?>
<a:multistatus xmlns:a="DAV:" 
xmlns:b="urn:uuid:c2f41010-65b3-11d1-a29f-0aa00c14882/">
  <a:response>
    <a:href>http://mattpo-nt5/davroot/</a:href>
    <a:propstat>
      <a:status>HTTP/1.1 200 OK</a:status>
      <a:prop>
        <a:displayname>davroot</a:displayname>
        <a:getcontentlength b:dt="int">0</a:getcontentlength>
      </a:prop>
    </a:propstat>
  </a:response>
  <a:response>
    <a:href>http://mattpo-nt5/davroot/default.htm</a:href>
    <a:propstat>
      <a:status>HTTP/1.1 200 OK</a:status>
      <a:prop>
        <a:displayname>default.htm</a:displayname>
        <a:getcontentlength b:dt="int">36</a:getcontentlength>
      </a:prop>
    </a:propstat>
  </a:response>
  <a:response>
    <a:href>http://mattpo-nt5/davroot/foo.htm</a:href>
    <a:propstat>
      <a:status>HTTP/1.1 200 OK</a:status>
      <a:prop>
        <a:displayname>foo.htm</a:displayname>
        <a:getcontentlength b:dt="int">32</a:getcontentlength>
      </a:prop>
    </a:propstat>
  </a:response>
  <a:response>
    <a:href>http://mattpo-nt5/davroot/newcol/</a:href>
    <a:propstat>
      <a:status>HTTP/1.1 200 OK</a:status>
      <a:prop>
        <a:displayname>newcol</a:displayname>
        <a:getcontentlength b:dt="int">0</a:getcontentlength>
      </a:prop>
    </a:propstat>
  </a:response>
</a:multistatus>

Figure 4   Lock Response


HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Date: Thu, 18 Mar 1999 14:40:01 GMT
Content-Type: text/xml
Content-Length: 404


<?xml version="1.0"?>
<a:prop xmlns:a="DAV:">
    <a:lockdiscovery>
        <a:activelock>
            <a:locktype><a:write/></a:locktype>
            <a:lockscope><a:exclusive/></a:lockscope>
            <a:owner>
                <a:href>http://mattpo</a:href>
            </a:owner>
            <a:locktoken>
                <a:href>
         opaquelocktoken:D7CF5874-DB6B-11D2-A7C4-00A0C9153577:214748364900
                  </a:href>
              </a:locktoken>
              <a:depth>0</a:depth>
              <a:timeout>Second-180</a:timeout>
        </a:activelock>
    </a:lockdiscovery>
</a:prop>

Figure 6   DAV

Dav.h

class Dav
{
public:
    Dav();
    virtual ~Dav();
    BOOL ParseAndConnect(const CString& cstr_IncommingUrl);
    BOOL RetrieveDocument(CString& cstr_BufferToFill, CString& cstr_RespHeaders,
                          CString& cstr_RequestHeaders );
    inline const CString& GetErrorText() const{return cstr_LastError;};
    inline const CString& GetObject() const{return strObject;};
    inline BOOL IsWritable() const{return bWritable;};
    inline BOOL IsDavSupport() const{return bDavSupport;};
    inline DWORD GetStatusCode() const{return dwRet;};
    
    // Call Options see if DAV is enabled
    BOOL IsDav(CString& AllDavReplyHeaders, CString& DavHeader,
               CString& cstr_RequestHeaders); 
    // PUT
    BOOL SaveDocument(CString& cstr_BufferToFill, CString& cstr_ReplyBody, 
                      CString& cstr_RespHeaders, CString& cstr_RequestHeaders,
                      const CString& optReqHrd);
private:
    DWORD dwServiceType;
    DWORD dwRet;
    CString strServer;
    CString strObject;
    INTERNET_PORT nPort;
    CString m_Url;
    CInternetSession session;
    CHttpConnection* pServer;
    CHttpFile* pFile;
    LPSTR *AcceptTypes;
    CString cstr_LastError;
    BOOL SendRequest(LPCTSTR Verb, const CString HeadersIn,
                     LPVOID BodyIn, DWORD dwSizeOfBody,
                     CString& HeadersOut, CString& BodyOut,
                     CString& SpecificHeader, CString& RequestHeaders);
    DWORD dwSecureFlag;
    BOOL bDavSupport;
    BOOL bWritable;
    BOOL GetCustomQueryInformation(DWORD dwFlags,  CString& HeaderBuffer);
};
Davxml.cpp

BOOL DavXML::Lock()
{
    // Do we already have a lock?
if (m_LockToken[0] != 0)
        return TRUE;          // Already have a lock

    // Create instance of XMLHTTPRequest Object
HRESULT hRes = CoCreateInstance(__uuidof(XMLHTTPRequest),
                                    NULL,
                                    CLSCTX_INPROC_SERVER,
                                    __uuidof(IXMLHttpRequest),
                                    (LPVOID*)&m_pXMLHttpReq);
    
    // Build Request
    _variant_t vAsync = (bool)FALSE; // Block
    _variant_t vUser = (BSTR)NULL;   // Don't change the user
    _variant_t vPassword = (BSTR)NULL;
    hRes = m_pXMLHttpReq->open(L"LOCK",              // HTTP Method
                             m_Url.AllocSysString(), // URL
                               vAsync,     // Async Mode
                               vUser,      // User
                               vPassword); // Password

    // Create the XML Document to be sent
    // in the body of the HTTP request.
hRes = CoCreateInstance(__uuidof(DOMDocument),
                        NULL,
                    CLSCTX_INPROC_SERVER,
                    __uuidof(IXMLDOMDocument),
                    (LPVOID*)&m_pXMLRequest);

    // We will initialize the XML document object with a string
// that creates all the XML entities for us.
    CString LockInfoXML;
    LockInfoXML =  "<?xml version=\"1.0\"?>\n";
    LockInfoXML += "<a:lockinfo xmlns:a=\"DAV:\">\n";
    LockInfoXML += "<a:lockscope><a:exclusive /></a:lockscope>\n";
    LockInfoXML += "<a:locktype><a:write /></a:locktype>\n";
    LockInfoXML += "<a:owner><a:href /></a:owner>\n";
    LockInfoXML += "</a:lockinfo>";
    VARIANT_BOOL bSuccess;
    
// Load the XML String into the XML Document Object
    m_pXMLRequest->loadXML(LockInfoXML.AllocSysString(), &bSuccess);

    // Use XSL to get the node for the owner href
    IXMLDOMNode *pOwnerHRef;
    _bstr_t bstrXsl = "a:lockinfo/a:owner/a:href";
    hRes = m_pXMLRequest->selectSingleNode(bstrXsl, 
                                           &pOwnerHRef);
    // Set the owner href
pOwnerHRef->put_text(m_OwnerHRef.AllocSysString());

    // Send method requires a variant so create one to 
    // hold our XML Doc Object.
    _variant_t varReq = m_pXMLRequest;

    // Send the HTTP request!!
    hRes = m_pXMLHttpReq->send(varReq);

    // Get the HTTP status code.
    long lStatus;
    m_pXMLHttpReq->get_status(&lStatus);

    // Put the HTTP Response body into an XML Doc Object.
    hRes = m_pXMLHttpReq->get_responseXML((IDispatch **)&m_pXMLResponse);

    // If the HTTP response code is not 200 OK then the lock failed.
    if (lStatus != 200)
        return FALSE;

    // Use XSL to get a pointer to the node in the XML response
    // that has the locktoken in it.
IXMLDOMNode *pLockToken;
    bstrXsl = "a:prop/a:lockdiscovery/a:activelock/a:locktoken/a:href";
    hRes = m_pXMLResponse->selectSingleNode(bstrXsl,
                                            &pLockToken);
    // Get the locktoken text
    pLockToken->get_text(&m_LockToken);
    
    return TRUE;
}