[Zope] WebDAV lockingproblem with Word
Robert Rottermann
robert@redcor.ch
Thu, 8 Nov 2001 09:39:41 +0100
This is a multi-part message in MIME format.
------=_NextPart_000_0008_01C16839.4AB7D230
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Hi Achim,
I did download their newest XML SDK (MSxml 4)
I did my bunch of COM programming. However it is now 2 years I do not touch
MS Studio that often anymore. And there is that amount of information you
can keep current with ..
attached is the example: I did create a console application using MFC. I
only send the "main" cpp.
Robert
----- Original Message -----
From: "Achim Domma" <achim.domma@syynx.de>
To: "Robert Rottermann" <robert@redcor.ch>; "Andreas Jung"
<andreas@zope.com>; "Joachim Werner" <joe@iuveno-net.de>
Cc: <zope@zope.org>
Sent: Wednesday, November 07, 2001 11:43 PM
Subject: RE: [Zope] WebDAV lockingproblem with Word
> Hi,
>
> > I tried to compile one of their C++ examples but failed since 2
> > identifiers
> > are undeclared
> > IID_IXMLHttpRequest
> > and
> > CLSID_XMLHTTPRequest
> > I found their declaration nowhere.
>
> you will need an up-to-date XML SDK. If you send me the example I could
try
> to look at it. COM development is something I have much more experience
> with, than with ZOPE. ;-)
>
> greetings
> Achim
>
>
------=_NextPart_000_0008_01C16839.4AB7D230
Content-Type: application/octet-stream;
name="Webdav.cpp"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="Webdav.cpp"
// Webdav.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "Webdav.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] =3D __FILE__;
#endif
#include<stdio.h>
//TODO: Change the path here if your Msxml.dll file is in a different =
location.
// for xml 4.0
#import "e:\winnt\system32\msxml4.dll"
using namespace MSXML2;
// for xml 2.0
// #import "c:\winnt\system32\msxml2.dll"
// using namespace MSXML;
int main(int argc, char* argv[])
{
CoInitialize(NULL);
try
{
//TODO: Change the line below to reflect your server.
bstr_t yourServerName =3D "fuerstenau";
bstr_t sUrl =3D "http://" + yourServerName +
"/public/testfolder/test.doc";
bstr_t sMethod =3D "PROPPATCH";
=20
//TODO: Change the 2 lines below to reflect your user name and password.
_variant_t vUser =3D L"admin";
_variant_t vPassword =3D L"admin";
=20
// for xml 4.0
MSXML2::IXMLHTTPRequestPtr pXMLHttpReq=3DNULL;=20
// for xml 2.0
//MSXML::IXMLHTTPRequestPtr pXMLHttpReq=3DNULL;=20
//CLSCTX_INPROC_SERVER =3D 0x1;
HRESULT hr =3D ::CoCreateInstance(
CLSID_XMLHTTPRequest,
NULL,=20
CLSCTX_INPROC_SERVER,=20
IID_IXMLHttpRequest,
(LPVOID*)&pXMLHttpReq);
if (S_OK !=3D hr)
{
printf("XML Http Request pointer creation failed\n");
return 0;
}
// Call open function.
_variant_t vAsync =3D (bool)FALSE;
pXMLHttpReq->open(sMethod,=20
sUrl,=20
vAsync,=20
vUser,=20
vPassword);
pXMLHttpReq->setRequestHeader((bstr_t)"Content-Type",=20
(bstr_t)"text/xml");
bstr_t sReq;
sReq =3D "<?xml version=3D'1.0'?>";
sReq =3D sReq + "<a:propertyupdate xmlns:a=3D'DAV:' xmlns:o=3D" +
"'urn:schemas-microsoft-com:office:office'>";
sReq =3D sReq + "<a:set><a:prop>";
sReq =3D sReq + "<o:Author>someone else</o:Author>";
sReq =3D sReq + "</a:prop></a:set></a:propertyupdate>";
=20
// Send the request to set the search criteria.
pXMLHttpReq->send(sReq);
// OK, get response. =20
long lStatus;
pXMLHttpReq->get_status(&lStatus);
printf("\n~~~~~~~~\n%d\n", lStatus);
BSTR bstrResp;
pXMLHttpReq->get_statusText(&bstrResp);
printf("\n~~~~~~~~\n%s\n", (char*)(bstr_t)bstrResp);
_bstr_t bstrAllHeaders;
bstrAllHeaders =3D pXMLHttpReq->getAllResponseHeaders();
printf("\n~~~~~~~~\n%s\n", (char*)bstrAllHeaders);
BSTR bstrResponseText;
pXMLHttpReq->get_responseText(&bstrResponseText);
printf("\n~~~~~~~~\n%s\n", (char*)(bstr_t)bstrResponseText); =20
}
catch(_com_error &e)
{
printf("Error\a\a\n\tCode =3D %08lx\n"
"\tCode meaning =3D %s\tSource =3D %s\n\tDescription =3D %s\n",
e.Error(),=20
e.ErrorMessage(),=20
(char*)e.Source(),=20
(char*)e.Description());
}
CoUninitialize();=20
=20
return 0;
}
------=_NextPart_000_0008_01C16839.4AB7D230--