472,142 Members | 1,261 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,142 software developers and data experts.

Exchange WebDAV - PUT Request - 501 not implemented

Hi,

I try to create a calender-item in the personal calendar folder from an
ASP.NET application using XML-HTTP Request (WebDAV).

System: Windows 2003 SP1, Exchange 2003 SP1

Configuration IIS: Default Web Site stopped, OWA running on a second virtual
site, my application is running on a third virtual site.

OWA is configured for Integrated Windows Authentication only, my application
the very same. The application uses impersonate=true without a userName.

The problem:
Some times access succeeds. Some times access fails with exception 501 - not
implemented. The exception occurs during the attempt to open a request stream
(GetRequestStream property of HTTPRequest object) to the private calendar
folder.

thanks for your assistance
Nov 19 '05 #1
3 3937
maria.s wrote:
Hi,

I try to create a calender-item in the personal calendar folder from
an ASP.NET application using XML-HTTP Request (WebDAV).

System: Windows 2003 SP1, Exchange 2003 SP1

Configuration IIS: Default Web Site stopped, OWA running on a second
virtual site, my application is running on a third virtual site.

OWA is configured for Integrated Windows Authentication only, my
application the very same. The application uses impersonate=true
without a userName.

The problem:
Some times access succeeds. Some times access fails with exception
501 - not implemented. The exception occurs during the attempt to
open a request stream (GetRequestStream property of HTTPRequest
object) to the private calendar folder.


Post your code. 501 usually means that a particular HTTP method (e.g.
PUT or DELETE) isn't implemented by the server.

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 19 '05 #2
These are the methods from our XMLHTTPRequest class

public void Open(string Method, string Url, bool Asynch, string User, string
Password)
{
// check parameters
if (lgRequest != null)
throw new InvalidOperationException("Connection Already open");
if (Url == "" || Url==null)
throw new ArgumentNullException("URL must be specified");
System.Uri uriObj = new System.Uri(Url);
if (!((uriObj.Scheme == System.Uri.UriSchemeHttp) || (uriObj.Scheme ==
System.Uri.UriSchemeHttps)))
throw new ArgumentOutOfRangeException("URL Scheme is not http or https");

//if (Method==null || (Method.ToUpper()!="POST" && Method.ToUpper()!="GET"
&& Method.ToUpper()!="PUT" && Method.ToUpper()!="PROPFIND" &&
Method.ToUpper()!="PROPPATCH" && Method.ToUpper()!="SEARCH"))
if (Method==null)
throw new ArgumentOutOfRangeException("Method argument type not defined");

lgbIsAsync = Asynch;

lgRequest = (HttpWebRequest)WebRequest.CreateDefault(uriObj);
lgRequest.Method = Method;
lgRequest.ContentType = "text/xml";
if (User != "")
lgRequest.Credentials = new System.Net.NetworkCredential(User, Password);
else
//lgRequest.Credentials = CredentialCache.DefaultCredentials;
lgRequest.Credentials =
CredentialCache.DefaultCredentials.GetCredential(u riObj, "Windows
Integrated");
uriObj = null;
lgReadyState = eReadyState.LOADING;
}
// here are two points at which the exception may occur (but five minutes
later it may work)
public void Send(string body)
{
if (lgReadyState != eReadyState.LOADING)
throw new InvalidOperationException("Sending a message is not allowed at
this ReadyState");
if (body != null)
{
if(lgbIsAsync)
{
lgMsg = body;
IAsyncResult res = lgRequest.BeginGetRequestStream(new
AsyncCallback(ReqCallback),lgRequest);
lgReadyState = eReadyState.LOADED;
}
else
{
UTF8Encoding encoding = new UTF8Encoding();
byte[] buffer = encoding.GetBytes(body);
lgRequest.ContentLength = buffer.Length;
Stream stream = lgRequest.GetRequestStream(); // exception 501 (point one)
stream.Write(buffer,0,buffer.Length);
stream.Close();
lgResponse = (HttpWebResponse)lgRequest.GetResponse(); // sometimes
exception 501 at this point
lgReadyState = eReadyState.COMPLETED;
}
}
}

This ist the method from our business layer (contents of str=xml data of
appointment below)

Public Shared Sub SendPersonalUrlaubAppointment(ByVal itm As Urlaubsmeldung,
ByVal User As String, ByVal Pwd As String, ByVal Subject As String, ByVal
Mailbox As String, ByVal userServer As String)

Dim strAppURLKalender As String = "http://" + userServer +
"/Exchange/" + Mailbox + "/Kalender/" + System.Guid.NewGuid.ToString + ".EML"
Dim strAppURLCalender As String = "http://" + userServer +
"/Exchange/" + Mailbox + "/calendar/" + System.Guid.NewGuid.ToString + ".EML"

Dim s As New SenderAppointment

With s.objProp.objProps
.MailSubject = itm.Urlaub
.OLEndDate = itm.OutlookEndDate
.OLStartDate = itm.OutlookStartDate
.TextDescription = "Ich bin auf " + itm.Urlaub
End With

Dim ser As New XmlSerializer(GetType(SenderAppointment))
Dim xml As New XMLHTTP.XMLHttpRequest
Dim m As New MemoryStream
Dim sw As New XmlTextWriter(m, System.Text.Encoding.UTF8)
Dim sr As New StreamReader(m)

ser.Serialize(m, s)
Try
xml.Open("PROPPATCH", strAppURLKalender, False, User, Pwd)
Catch ex1 As Exception
xml.Open("PROPPATCH", strAppURLCalender, False, User, Pwd)
End Try

xml.SetRequestHeader("Content-Type", "text/xml")
m.Position = 0

Dim str As String = sr.ReadToEnd
xml.Send(str)

Dim strResult As String = xml.GetResponseXML.InnerXml
xml.Dispose()

sw.Close()
End Sub

//str
"<?xml version="1.0"?>
<propertyupdate xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="DAV:">
<set>
<prop>
<contentclass>urn:content-classes:appointment</contentclass>
<outlookmessageclass
xmlns="http://schemas.microsoft.com/exchange/">IPM.Appointment</outlookmessageclass>
<location xmlns="urn:schemas:calendar:" />
<dtstart
xmlns="urn:schemas:calendar:">2005-09-01T00:00:00.0000000+02:00</dtstart>
<dtend
xmlns="urn:schemas:calendar:">2005-09-02T00:00:00.0000000+02:00</dtend>
<instancetype xmlns="urn:schemas:calendar:">0</instancetype>
<busystatus xmlns="urn:schemas:calendar:">OOF</busystatus>
<meetingstatus xmlns="urn:schemas:calendar:">TENTATIVE</meetingstatus>
<alldayevent xmlns="urn:schemas:calendar:">0</alldayevent>
<responserequested xmlns="urn:schemas:calendar:">1</responserequested>
<method xmlns="urn:schemas:calendar:">REQUEST</method>
<sequence xmlns="urn:schemas:calendar:">0</sequence>
<priority xmlns="urn:schemas:httpmail:">0</priority>
<read xmlns="urn:schemas:httpmail:">1</read>
<subject xmlns="urn:schemas:httpmail:">URLAUB</subject>
<textdescription xmlns="urn:schemas:httpmail:">Ich bin auf
URLAUB</textdescription>
</prop>
</set>
</propertyupdate>"
"Joerg Jooss" wrote:
maria.s wrote:
Hi,

I try to create a calender-item in the personal calendar folder from
an ASP.NET application using XML-HTTP Request (WebDAV).

System: Windows 2003 SP1, Exchange 2003 SP1

Configuration IIS: Default Web Site stopped, OWA running on a second
virtual site, my application is running on a third virtual site.

OWA is configured for Integrated Windows Authentication only, my
application the very same. The application uses impersonate=true
without a userName.

The problem:
Some times access succeeds. Some times access fails with exception
501 - not implemented. The exception occurs during the attempt to
open a request stream (GetRequestStream property of HTTPRequest
object) to the private calendar folder.


Post your code. 501 usually means that a particular HTTP method (e.g.
PUT or DELETE) isn't implemented by the server.

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de

Nov 19 '05 #3
First: it's a PROPPATCH (sorry for communication a PUT first) and ..

If I call it from my develompment environment (Win XP, IIS 5) (not from the
IIS on the Exchange server itself) it works all time.

If I put the application into the same Web Site as OWA an exception 400 (Bad
Request) occurs. (OWA doesn't run in the Default Web Site)

Maybe its something with the configuration? But I have no more idea where to
look.

"maria.s" wrote:
These are the methods from our XMLHTTPRequest class

public void Open(string Method, string Url, bool Asynch, string User, string
Password)
{
// check parameters
if (lgRequest != null)
throw new InvalidOperationException("Connection Already open");
if (Url == "" || Url==null)
throw new ArgumentNullException("URL must be specified");
System.Uri uriObj = new System.Uri(Url);
if (!((uriObj.Scheme == System.Uri.UriSchemeHttp) || (uriObj.Scheme ==
System.Uri.UriSchemeHttps)))
throw new ArgumentOutOfRangeException("URL Scheme is not http or https");

//if (Method==null || (Method.ToUpper()!="POST" && Method.ToUpper()!="GET"
&& Method.ToUpper()!="PUT" && Method.ToUpper()!="PROPFIND" &&
Method.ToUpper()!="PROPPATCH" && Method.ToUpper()!="SEARCH"))
if (Method==null)
throw new ArgumentOutOfRangeException("Method argument type not defined");

lgbIsAsync = Asynch;

lgRequest = (HttpWebRequest)WebRequest.CreateDefault(uriObj);
lgRequest.Method = Method;
lgRequest.ContentType = "text/xml";
if (User != "")
lgRequest.Credentials = new System.Net.NetworkCredential(User, Password);
else
//lgRequest.Credentials = CredentialCache.DefaultCredentials;
lgRequest.Credentials =
CredentialCache.DefaultCredentials.GetCredential(u riObj, "Windows
Integrated");
uriObj = null;
lgReadyState = eReadyState.LOADING;
}
// here are two points at which the exception may occur (but five minutes
later it may work)
public void Send(string body)
{
if (lgReadyState != eReadyState.LOADING)
throw new InvalidOperationException("Sending a message is not allowed at
this ReadyState");
if (body != null)
{
if(lgbIsAsync)
{
lgMsg = body;
IAsyncResult res = lgRequest.BeginGetRequestStream(new
AsyncCallback(ReqCallback),lgRequest);
lgReadyState = eReadyState.LOADED;
}
else
{
UTF8Encoding encoding = new UTF8Encoding();
byte[] buffer = encoding.GetBytes(body);
lgRequest.ContentLength = buffer.Length;
Stream stream = lgRequest.GetRequestStream(); // exception 501 (point one)
stream.Write(buffer,0,buffer.Length);
stream.Close();
lgResponse = (HttpWebResponse)lgRequest.GetResponse(); // sometimes
exception 501 at this point
lgReadyState = eReadyState.COMPLETED;
}
}
}

This ist the method from our business layer (contents of str=xml data of
appointment below)

Public Shared Sub SendPersonalUrlaubAppointment(ByVal itm As Urlaubsmeldung,
ByVal User As String, ByVal Pwd As String, ByVal Subject As String, ByVal
Mailbox As String, ByVal userServer As String)

Dim strAppURLKalender As String = "http://" + userServer +
"/Exchange/" + Mailbox + "/Kalender/" + System.Guid.NewGuid.ToString + ".EML"
Dim strAppURLCalender As String = "http://" + userServer +
"/Exchange/" + Mailbox + "/calendar/" + System.Guid.NewGuid.ToString + ".EML"

Dim s As New SenderAppointment

With s.objProp.objProps
.MailSubject = itm.Urlaub
.OLEndDate = itm.OutlookEndDate
.OLStartDate = itm.OutlookStartDate
.TextDescription = "Ich bin auf " + itm.Urlaub
End With

Dim ser As New XmlSerializer(GetType(SenderAppointment))
Dim xml As New XMLHTTP.XMLHttpRequest
Dim m As New MemoryStream
Dim sw As New XmlTextWriter(m, System.Text.Encoding.UTF8)
Dim sr As New StreamReader(m)

ser.Serialize(m, s)
Try
xml.Open("PROPPATCH", strAppURLKalender, False, User, Pwd)
Catch ex1 As Exception
xml.Open("PROPPATCH", strAppURLCalender, False, User, Pwd)
End Try

xml.SetRequestHeader("Content-Type", "text/xml")
m.Position = 0

Dim str As String = sr.ReadToEnd
xml.Send(str)

Dim strResult As String = xml.GetResponseXML.InnerXml
xml.Dispose()

sw.Close()
End Sub

//str
"<?xml version="1.0"?>
<propertyupdate xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="DAV:">
<set>
<prop>
<contentclass>urn:content-classes:appointment</contentclass>
<outlookmessageclass
xmlns="http://schemas.microsoft.com/exchange/">IPM.Appointment</outlookmessageclass>
<location xmlns="urn:schemas:calendar:" />
<dtstart
xmlns="urn:schemas:calendar:">2005-09-01T00:00:00.0000000+02:00</dtstart>
<dtend
xmlns="urn:schemas:calendar:">2005-09-02T00:00:00.0000000+02:00</dtend>
<instancetype xmlns="urn:schemas:calendar:">0</instancetype>
<busystatus xmlns="urn:schemas:calendar:">OOF</busystatus>
<meetingstatus xmlns="urn:schemas:calendar:">TENTATIVE</meetingstatus>
<alldayevent xmlns="urn:schemas:calendar:">0</alldayevent>
<responserequested xmlns="urn:schemas:calendar:">1</responserequested>
<method xmlns="urn:schemas:calendar:">REQUEST</method>
<sequence xmlns="urn:schemas:calendar:">0</sequence>
<priority xmlns="urn:schemas:httpmail:">0</priority>
<read xmlns="urn:schemas:httpmail:">1</read>
<subject xmlns="urn:schemas:httpmail:">URLAUB</subject>
<textdescription xmlns="urn:schemas:httpmail:">Ich bin auf
URLAUB</textdescription>
</prop>
</set>
</propertyupdate>"
"Joerg Jooss" wrote:
maria.s wrote:
Hi,

I try to create a calender-item in the personal calendar folder from
an ASP.NET application using XML-HTTP Request (WebDAV).

System: Windows 2003 SP1, Exchange 2003 SP1

Configuration IIS: Default Web Site stopped, OWA running on a second
virtual site, my application is running on a third virtual site.

OWA is configured for Integrated Windows Authentication only, my
application the very same. The application uses impersonate=true
without a userName.

The problem:
Some times access succeeds. Some times access fails with exception
501 - not implemented. The exception occurs during the attempt to
open a request stream (GetRequestStream property of HTTPRequest
object) to the private calendar folder.


Post your code. 501 usually means that a particular HTTP method (e.g.
PUT or DELETE) isn't implemented by the server.

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de

Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by George Durzi | last post: by
2 posts views Thread by George Durzi | last post: by
1 post views Thread by Gerhard | last post: by
4 posts views Thread by Radek | last post: by
reply views Thread by arjen1984 | last post: by
7 posts views Thread by Wiebe Tijsma | last post: by
5 posts views Thread by krasman | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.