You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by Michel Bohn <bo...@hotmail.com> on 2004/08/19 02:03:11 UTC
Re: When setting up the webdavResource, How do I set custom properties.
James,
Thanks for your response on the webdavResource error (previous post title ->
Re: PLEASE HELP WebdavResource init error, invalid port number.) I
monitored the packets using Ethereal and found that my request and the
request the webdav server wants were different. My inital request has to
have xml data as indicated below as well as some properties that are
different from the 'vanilla' properties that are passed to the webdav server
when the resource is constructed. Do I have to extend the session and
create my own resource to accomplish this or can I use the webdavResource?
Or in other words.....
HOW DO I GET FROM HERE (My current request)-->
Hypertext Transfer Protocol
PROPFIND /cgi-bin/hmdata HTTP/1.1\r\n
Request Method: PROPFIND
Authorization: Basic Ym9obm1hbkBob3RtYWlsLmNvbTpsb3ZlMWRheQ==\r\n
Credentials: xxxxx@hotmail.com:xxxxxxx
Content-Type: text/xml; charset=utf-8\r\n
User-Agent: Jakarta Commons-HttpClient/2.0final\r\n
Host: oe.hotmail.com\r\n
Content-Length: 207\r\n
Depth: 0\r\n
\r\n
TO HERE? -->
Hypertext Transfer Protocol
PROPFIND /svcs/hotmail/httpmail.asp HTTP/1.1\r\n
Request Method: PROPFIND
Host: services.msn.com\r\n
Content-Length: 343\r\n
Content-Type: text/xml\r\n
User-Agent: Outlook Express/5.5 (MSIE 5.0; Windows 98; TmstmpExt)\r\n
\r\n
Line-based text data: text/xml
<?xml version="1.0"?>
<D:propfind xmlns:D="DAV:"
xmlns:h="http://schemas.microsoft.com/hotmail/"
xmlns:hm="urn:schemas:httpmail:">
\t<D:prop>
\t\t<h:adbar/>
\t\t<hm:contacts/>
\t\t<hm:inbox/>
\t\t<hm:outbox/>
\t\t<hm:sendmsg/>
\t\t<hm:sentitems/>
\t\t<hm:deleteditems/>
\t\t<hm:drafts/>
\t\t<hm:msgfolderroot/>
\t\t<h:maxpoll/>
\t\t<h:sig/>
\t</D:prop>
</D:propfind>
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org
Re: When setting up the webdavResource, How do I set custom properties.
Posted by James Mason <ma...@apache.org>.
Michel,
I know what you mean about frustration :). Here's some code that may
help. No guarantees, but I'll try to help you through any kinks if it
doesn't work.
--------------------------------------------------------------
String user = "root";
String pass = "root";
String url = "http://localhost:8080/slide/";
Vector propnames = new Vector();
propnames.add(
new PropertyName("http://schemas.microsoft.com/hotmail/", "adbar"));
propnames.add(
new PropertyName("urn:schemas:httpmail:", "contacts"));
propnames.add(
new PropertyName("urn:schemas:httpmail:", "inbox"));
propnames.add(
new PropertyName("urn:schemas:httpmail:", "outbox"));
propnames.add(
new PropertyName("urn:schemas:httpmail:", "sendmsg"));
propnames.add(
new PropertyName("urn:schemas:httpmail:", "sentitems"));
propnames.add(
new PropertyName("urn:schemas:httpmail:", "deleteditems"));
propnames.add(
new PropertyName("urn:schemas:httpmail:", "drafts"));
propnames.add(
new PropertyName("urn:schemas:httpmail:", "msgfolderroot"));
propnames.add(
new PropertyName(
"http://schemas.microsoft.com/hotmail/", "maxpoll"));
propnames.add(
new PropertyName("http://schemas.microsoft.com/hotmail/", "sig"));
HttpURL httpURL = new HttpURL(url);
httpURL.setUserinfo(user,pass);
WebdavResource res = new WebdavResource(httpURL);
Enumeration enum = res.propfindMethod(DepthSupport.DEPTH_0, propnames);
while (enum.hasMoreElements()) {
System.out.println("------------------------");
ResponseEntity ent = (ResponseEntity)enum.nextElement();
System.out.println("href: " + ent.getHref());
Enumeration props = ent.getProperties();
while (props.hasMoreElements()) {
System.out.println(
((Property)props.nextElement()).getPropertyAsString());
}
}
--------------------------------------------------------------
-James
Michel Bohn wrote:
> Thanks for both of your responses. I got the body to set correctly.
>
> I am really struggling here. I am sure you both have been to the point
> where even pounding your head on the wall doesn't work. Could you
> provide me with a snippet of code that would create a request like the
> one below. The default properties don't work for this server so it
> fails. I can't find any working examples on the web and don't want to
> have to extend any classes if I don't have to.
>
> It seems that if I set up my resource
>
> wdr = new WebdavResource(HUrl);
>
> it uses the DEFAULT action to set properties. You can also specify ALL
> and BASIC and maybe a few others when instantiating. What if those
> aren't what I need? I must not be understanding this properly, It can't
> be this difficult. I have custom properties that need to be set for the
> instatiating of the webdavresource.
>
> ***THIS IS WHAT MY INITIAL REQUEST SHOULD LOOK LIKE***
> PROPFIND /svcs/hotmail/httpmail.asp HTTP/1.1\r\n
> Host: services.msn.com\r\n
> Content-Length: 343\r\n
> Content-Type: text/xml\r\n
> User-Agent: Outlook Express/5.5 (MSIE 5.0; Windows 98; TmstmpExt)\r\n
> \r\n
>
> <?xml version="1.0"?>
> <D:propfind xmlns:D="DAV:"
> xmlns:h="http://schemas.microsoft.com/hotmail/"
> xmlns:hm="urn:schemas:httpmail:">
> \t<D:prop>
> \t\t<h:adbar/>
> \t\t<hm:contacts/>
> \t\t<hm:inbox/>
> \t\t<hm:outbox/>
> \t\t<hm:sendmsg/>
> \t\t<hm:sentitems/>
> \t\t<hm:deleteditems/>
> \t\t<hm:drafts/>
> \t\t<hm:msgfolderroot/>
> \t\t<h:maxpoll/>
> \t\t<h:sig/>
> \t</D:prop>
> </D:propfind>
>
> ***THIS IS WHAT IT LOOKS LIKE ***
> PROPFIND /cgi-bin/hmdata HTTP/1.1
> Content-Type: text/xml; charset=utf-8
> User-Agent: Jakarta Commons-HttpClient/2.0final
> Host: oe.hotmail.com
> Content-Length: 207
> Depth: 0
>
> <?xml version="1.0" encoding="utf-8" ?>
> <D:propfind xmlns:D="DAV:">
> <D:prop>
> <D:displayname/>
> <D:getcontentlength/>
> <D:getcontenttype/>
> <D:resourcetype/>
> <D:getlastmodified/>
> <D:lockdiscovery/>
> </D:prop>
> </D:propfind>
>
> Thank you for your patience.
> Michel Bohn
>
> James Mason wrote:
>
>> Ya, it's strange that there's a Content-Length header but no body
>> information. Maybe try specifying the properties you want when you make
>> your propfind request. The first step is going to be getting an actual
>> request body to be generated. Then you can work on getting it looking
>> right.
>>
>> -James
>>
>> Ingo Brunberg wrote:
>>
>>> You can of course request those custom properties with WebdavResource.
>>>
>>> But I guess your problem is still not solved. If you have a look at
>>> the request you generated you will see that it is missing the request
>>> body. You got a URIException, right? So again, please check your
>>> username.
>>>
>>> Ingo
>>>
>>>
>>>> James,
>>>>
>>>> Thanks for your response on the webdavResource error (previous post
>>>> title ->
>>>> Re: PLEASE HELP WebdavResource init error, invalid port number.) I
>>>> monitored the packets using Ethereal and found that my request and the
>>>> request the webdav server wants were different. My inital request
>>>> has to
>>>> have xml data as indicated below as well as some properties that are
>>>> different from the 'vanilla' properties that are passed to the
>>>> webdav server
>>>> when the resource is constructed. Do I have to extend the session and
>>>> create my own resource to accomplish this or can I use the
>>>> webdavResource?
>>>> Or in other words.....
>>>>
>>>> HOW DO I GET FROM HERE (My current request)-->
>>>>
>>>> Hypertext Transfer Protocol
>>>> PROPFIND /cgi-bin/hmdata HTTP/1.1\r\n
>>>> Request Method: PROPFIND
>>>> Authorization: Basic Ym9obm1hbkBob3RtYWlsLmNvbTpsb3ZlMWRheQ==\r\n
>>>> Credentials: xxxxx@hotmail.com:xxxxxxx
>>>> Content-Type: text/xml; charset=utf-8\r\n
>>>> User-Agent: Jakarta Commons-HttpClient/2.0final\r\n
>>>> Host: oe.hotmail.com\r\n
>>>> Content-Length: 207\r\n
>>>> Depth: 0\r\n
>>>> \r\n
>>>>
>>>> TO HERE? -->
>>>>
>>>> Hypertext Transfer Protocol
>>>> PROPFIND /svcs/hotmail/httpmail.asp HTTP/1.1\r\n
>>>> Request Method: PROPFIND
>>>> Host: services.msn.com\r\n
>>>> Content-Length: 343\r\n
>>>> Content-Type: text/xml\r\n
>>>> User-Agent: Outlook Express/5.5 (MSIE 5.0; Windows 98;
>>>> TmstmpExt)\r\n
>>>> \r\n
>>>> Line-based text data: text/xml
>>>> <?xml version="1.0"?>
>>>> <D:propfind xmlns:D="DAV:"
>>>> xmlns:h="http://schemas.microsoft.com/hotmail/"
>>>> xmlns:hm="urn:schemas:httpmail:">
>>>> \t<D:prop>
>>>> \t\t<h:adbar/>
>>>> \t\t<hm:contacts/>
>>>> \t\t<hm:inbox/>
>>>> \t\t<hm:outbox/>
>>>> \t\t<hm:sendmsg/>
>>>> \t\t<hm:sentitems/>
>>>> \t\t<hm:deleteditems/>
>>>> \t\t<hm:drafts/>
>>>> \t\t<hm:msgfolderroot/>
>>>> \t\t<h:maxpoll/>
>>>> \t\t<h:sig/>
>>>> \t</D:prop>
>>>> </D:propfind>
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>>
>> .
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org
Re: When setting up the webdavResource, How do I set custom properties.
Posted by Michel Bohn <bo...@hotmail.com>.
Thanks for both of your responses. I got the body to set correctly.
I am really struggling here. I am sure you both have been to the point
where even pounding your head on the wall doesn't work. Could you
provide me with a snippet of code that would create a request like the
one below. The default properties don't work for this server so it
fails. I can't find any working examples on the web and don't want to
have to extend any classes if I don't have to.
It seems that if I set up my resource
wdr = new WebdavResource(HUrl);
it uses the DEFAULT action to set properties. You can also specify ALL
and BASIC and maybe a few others when instantiating. What if those
aren't what I need? I must not be understanding this properly, It can't
be this difficult. I have custom properties that need to be set for the
instatiating of the webdavresource.
***THIS IS WHAT MY INITIAL REQUEST SHOULD LOOK LIKE***
PROPFIND /svcs/hotmail/httpmail.asp HTTP/1.1\r\n
Host: services.msn.com\r\n
Content-Length: 343\r\n
Content-Type: text/xml\r\n
User-Agent: Outlook Express/5.5 (MSIE 5.0; Windows 98; TmstmpExt)\r\n
\r\n
<?xml version="1.0"?>
<D:propfind xmlns:D="DAV:"
xmlns:h="http://schemas.microsoft.com/hotmail/"
xmlns:hm="urn:schemas:httpmail:">
\t<D:prop>
\t\t<h:adbar/>
\t\t<hm:contacts/>
\t\t<hm:inbox/>
\t\t<hm:outbox/>
\t\t<hm:sendmsg/>
\t\t<hm:sentitems/>
\t\t<hm:deleteditems/>
\t\t<hm:drafts/>
\t\t<hm:msgfolderroot/>
\t\t<h:maxpoll/>
\t\t<h:sig/>
\t</D:prop>
</D:propfind>
***THIS IS WHAT IT LOOKS LIKE ***
PROPFIND /cgi-bin/hmdata HTTP/1.1
Content-Type: text/xml; charset=utf-8
User-Agent: Jakarta Commons-HttpClient/2.0final
Host: oe.hotmail.com
Content-Length: 207
Depth: 0
<?xml version="1.0" encoding="utf-8" ?>
<D:propfind xmlns:D="DAV:">
<D:prop>
<D:displayname/>
<D:getcontentlength/>
<D:getcontenttype/>
<D:resourcetype/>
<D:getlastmodified/>
<D:lockdiscovery/>
</D:prop>
</D:propfind>
Thank you for your patience.
Michel Bohn
James Mason wrote:
> Ya, it's strange that there's a Content-Length header but no body
> information. Maybe try specifying the properties you want when you make
> your propfind request. The first step is going to be getting an actual
> request body to be generated. Then you can work on getting it looking
> right.
>
> -James
>
> Ingo Brunberg wrote:
>
>> You can of course request those custom properties with WebdavResource.
>>
>> But I guess your problem is still not solved. If you have a look at
>> the request you generated you will see that it is missing the request
>> body. You got a URIException, right? So again, please check your
>> username.
>>
>> Ingo
>>
>>
>>> James,
>>>
>>> Thanks for your response on the webdavResource error (previous post
>>> title ->
>>> Re: PLEASE HELP WebdavResource init error, invalid port number.) I
>>> monitored the packets using Ethereal and found that my request and the
>>> request the webdav server wants were different. My inital request
>>> has to
>>> have xml data as indicated below as well as some properties that are
>>> different from the 'vanilla' properties that are passed to the
>>> webdav server
>>> when the resource is constructed. Do I have to extend the session and
>>> create my own resource to accomplish this or can I use the
>>> webdavResource?
>>> Or in other words.....
>>>
>>> HOW DO I GET FROM HERE (My current request)-->
>>>
>>> Hypertext Transfer Protocol
>>> PROPFIND /cgi-bin/hmdata HTTP/1.1\r\n
>>> Request Method: PROPFIND
>>> Authorization: Basic Ym9obm1hbkBob3RtYWlsLmNvbTpsb3ZlMWRheQ==\r\n
>>> Credentials: xxxxx@hotmail.com:xxxxxxx
>>> Content-Type: text/xml; charset=utf-8\r\n
>>> User-Agent: Jakarta Commons-HttpClient/2.0final\r\n
>>> Host: oe.hotmail.com\r\n
>>> Content-Length: 207\r\n
>>> Depth: 0\r\n
>>> \r\n
>>>
>>> TO HERE? -->
>>>
>>> Hypertext Transfer Protocol
>>> PROPFIND /svcs/hotmail/httpmail.asp HTTP/1.1\r\n
>>> Request Method: PROPFIND
>>> Host: services.msn.com\r\n
>>> Content-Length: 343\r\n
>>> Content-Type: text/xml\r\n
>>> User-Agent: Outlook Express/5.5 (MSIE 5.0; Windows 98;
>>> TmstmpExt)\r\n
>>> \r\n
>>> Line-based text data: text/xml
>>> <?xml version="1.0"?>
>>> <D:propfind xmlns:D="DAV:"
>>> xmlns:h="http://schemas.microsoft.com/hotmail/"
>>> xmlns:hm="urn:schemas:httpmail:">
>>> \t<D:prop>
>>> \t\t<h:adbar/>
>>> \t\t<hm:contacts/>
>>> \t\t<hm:inbox/>
>>> \t\t<hm:outbox/>
>>> \t\t<hm:sendmsg/>
>>> \t\t<hm:sentitems/>
>>> \t\t<hm:deleteditems/>
>>> \t\t<hm:drafts/>
>>> \t\t<hm:msgfolderroot/>
>>> \t\t<h:maxpoll/>
>>> \t\t<h:sig/>
>>> \t</D:prop>
>>> </D:propfind>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>
> .
>
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org
Re: When setting up the webdavResource, How do I set custom properties.
Posted by James Mason <ma...@apache.org>.
Ya, it's strange that there's a Content-Length header but no body
information. Maybe try specifying the properties you want when you make
your propfind request. The first step is going to be getting an actual
request body to be generated. Then you can work on getting it looking right.
-James
Ingo Brunberg wrote:
> You can of course request those custom properties with WebdavResource.
>
> But I guess your problem is still not solved. If you have a look at
> the request you generated you will see that it is missing the request
> body. You got a URIException, right? So again, please check your
> username.
>
> Ingo
>
>
>>James,
>>
>>Thanks for your response on the webdavResource error (previous post title ->
>>Re: PLEASE HELP WebdavResource init error, invalid port number.) I
>>monitored the packets using Ethereal and found that my request and the
>>request the webdav server wants were different. My inital request has to
>>have xml data as indicated below as well as some properties that are
>>different from the 'vanilla' properties that are passed to the webdav server
>>when the resource is constructed. Do I have to extend the session and
>>create my own resource to accomplish this or can I use the webdavResource?
>>Or in other words.....
>>
>>HOW DO I GET FROM HERE (My current request)-->
>>
>>Hypertext Transfer Protocol
>> PROPFIND /cgi-bin/hmdata HTTP/1.1\r\n
>> Request Method: PROPFIND
>> Authorization: Basic Ym9obm1hbkBob3RtYWlsLmNvbTpsb3ZlMWRheQ==\r\n
>> Credentials: xxxxx@hotmail.com:xxxxxxx
>> Content-Type: text/xml; charset=utf-8\r\n
>> User-Agent: Jakarta Commons-HttpClient/2.0final\r\n
>> Host: oe.hotmail.com\r\n
>> Content-Length: 207\r\n
>> Depth: 0\r\n
>> \r\n
>>
>>TO HERE? -->
>>
>>Hypertext Transfer Protocol
>> PROPFIND /svcs/hotmail/httpmail.asp HTTP/1.1\r\n
>> Request Method: PROPFIND
>> Host: services.msn.com\r\n
>> Content-Length: 343\r\n
>> Content-Type: text/xml\r\n
>> User-Agent: Outlook Express/5.5 (MSIE 5.0; Windows 98; TmstmpExt)\r\n
>> \r\n
>>Line-based text data: text/xml
>> <?xml version="1.0"?>
>> <D:propfind xmlns:D="DAV:"
>>xmlns:h="http://schemas.microsoft.com/hotmail/"
>>xmlns:hm="urn:schemas:httpmail:">
>> \t<D:prop>
>> \t\t<h:adbar/>
>> \t\t<hm:contacts/>
>> \t\t<hm:inbox/>
>> \t\t<hm:outbox/>
>> \t\t<hm:sendmsg/>
>> \t\t<hm:sentitems/>
>> \t\t<hm:deleteditems/>
>> \t\t<hm:drafts/>
>> \t\t<hm:msgfolderroot/>
>> \t\t<h:maxpoll/>
>> \t\t<h:sig/>
>> \t</D:prop>
>> </D:propfind>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org
Re: When setting up the webdavResource, How do I set custom properties.
Posted by Ingo Brunberg <ib...@fiz-chemie.de>.
You can of course request those custom properties with WebdavResource.
But I guess your problem is still not solved. If you have a look at
the request you generated you will see that it is missing the request
body. You got a URIException, right? So again, please check your
username.
Ingo
> James,
>
> Thanks for your response on the webdavResource error (previous post title ->
> Re: PLEASE HELP WebdavResource init error, invalid port number.) I
> monitored the packets using Ethereal and found that my request and the
> request the webdav server wants were different. My inital request has to
> have xml data as indicated below as well as some properties that are
> different from the 'vanilla' properties that are passed to the webdav server
> when the resource is constructed. Do I have to extend the session and
> create my own resource to accomplish this or can I use the webdavResource?
> Or in other words.....
>
> HOW DO I GET FROM HERE (My current request)-->
>
> Hypertext Transfer Protocol
> PROPFIND /cgi-bin/hmdata HTTP/1.1\r\n
> Request Method: PROPFIND
> Authorization: Basic Ym9obm1hbkBob3RtYWlsLmNvbTpsb3ZlMWRheQ==\r\n
> Credentials: xxxxx@hotmail.com:xxxxxxx
> Content-Type: text/xml; charset=utf-8\r\n
> User-Agent: Jakarta Commons-HttpClient/2.0final\r\n
> Host: oe.hotmail.com\r\n
> Content-Length: 207\r\n
> Depth: 0\r\n
> \r\n
>
> TO HERE? -->
>
> Hypertext Transfer Protocol
> PROPFIND /svcs/hotmail/httpmail.asp HTTP/1.1\r\n
> Request Method: PROPFIND
> Host: services.msn.com\r\n
> Content-Length: 343\r\n
> Content-Type: text/xml\r\n
> User-Agent: Outlook Express/5.5 (MSIE 5.0; Windows 98; TmstmpExt)\r\n
> \r\n
> Line-based text data: text/xml
> <?xml version="1.0"?>
> <D:propfind xmlns:D="DAV:"
> xmlns:h="http://schemas.microsoft.com/hotmail/"
> xmlns:hm="urn:schemas:httpmail:">
> \t<D:prop>
> \t\t<h:adbar/>
> \t\t<hm:contacts/>
> \t\t<hm:inbox/>
> \t\t<hm:outbox/>
> \t\t<hm:sendmsg/>
> \t\t<hm:sentitems/>
> \t\t<hm:deleteditems/>
> \t\t<hm:drafts/>
> \t\t<hm:msgfolderroot/>
> \t\t<h:maxpoll/>
> \t\t<h:sig/>
> \t</D:prop>
> </D:propfind>
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org