RE: Problem with proppatchMethod for property group-member-set

2004-08-03 Thread Krishna Kankipati
James,
Your trick # 1 worked. I had to use the same method that the
commandline client was using. Here is the method I used to make it work. I
could keep the CDATA element.

Code that worked:


PropertyName pName = new PropertyName(DAV:, group-member-set);


if(webDavResource.proppatchMethod(sRolePathURI, pName,
sbNewMemberSetProperty.toString(), true))
{
write(Prop patch worked);
bSuccess = true;
}



I appreciate your timely help .

thanks,

Krishna



-Original Message-
From: James Mason [mailto:[EMAIL PROTECTED]
Sent: Monday, August 02, 2004 10:13 PM
To: [EMAIL PROTECTED]
Subject: RE: Problem with proppatchMethod for property
group-member-set


Two things to try:

1) Look at the code the command line client uses to send proppatches to
the server. The client library supports multiple methods for most
operations, and whichever one the command line client uses seems to get
the most testing ::shrug::.

2) Try dropping the enclosing !CDATA[ ]]. I could be wrong, but I
don't think it's necessary, and it may be interfering.

Post back to list after you've looked at those two options. Maybe with
more data to go on someone who knows the client library well will be
able to give you a better answer.

-James

 Krishna Kankipati [EMAIL PROTECTED] 08/02/04 3:54 PM 
James,
I did not get any responses from anyone, i am assuming no one
has
tried this yet. What is your opinion, I did some debugging and found
that
Webdav Client is doing its job of sending data to servlet. I think Slide
Server is not handling the XML data for group-member-set property
properly.
Can you please let me know what you think about this issue .

thanks,

Krishna


-Original Message-
From: Krishna Kankipati [mailto:[EMAIL PROTECTED]
Sent: Monday, August 02, 2004 11:46 AM
To: [EMAIL PROTECTED]; '[EMAIL PROTECTED]'
Subject: Problem with proppatchMethod for property group-member-set


Hi,
I am writing a wrapper on top of WebDav Client 2.1 M1 (with
latest
CVS code for DOMUtils.java). I am having a problem executing
proppatchMethod() for the property group-member-set. I am trying to
assign
user john to role root. If I try the same through DAVExplorer 0.9,
it is
working fine. The group-member-set property value that my algorithm
generates before it calls proppatchMethod is:

The group-member-set property value that I am trying to set using
webdavResource.proppatchMethod

[CDATA[D:href xmlns:D='DAV:'/Slide/users/root/D:hrefD:href
xmlns:D='DAV:'/Slide/users/john/D:hrefD:href
xmlns:D='DAV:'/Slide/users/guest/D:href]]


I get the following error:

[CDATA[D:href xmlns:D='DAV:'/Slide/users/root/D:hrefD:href
xmlns:D='DAV:'/Slide/users/john/D:hrefD:href
xmlns:D='DAV:'/Slide/users/guest/D:href]]

Prop patch failed::Bad Request (400)


If I take this same string and add the property through DAVExplorer it
works
fine. So I am sure that the string that I am generating for the property
is
right. I guess there is a bug with the Slide2.1 M1 Webdav Client while
handling XML data.

Has anyone worked on this, any clues what could be wrong, or can anyone
validate that this is a bug with Webdav Client .

any help is appreciated ...

thanks and regards,

Krishna

PS: Source code for the method that assigns user to role

public boolean assignUserToRole(String sUserName, String
sRoleName)
throws IOException
{
// URI pointing to the given role 
String sURI = BASE_URL + roles/ + sRoleName;
String sNewUserURI = /Slide/users/ + sUserName;

boolean bSuccess = false;
boolean bUserAlreadyBelongsToRole = false;

try
{
// Connect to Slide resource
if(connect(sURI))
{
write(Connected to slide
successfully);

// Try to set the group-member-set
property
as follows
/*
 *  proppatch /roles/role1 
 *  group-member-set =
[CDATA[D:href
xmlns:D='DAV:'/users/user1/D:hrefD:href
xmlns:D='DAV:'/users/user2/D:href

Problem with proppatchMethod for property group-member-set

2004-08-02 Thread Krishna Kankipati
Hi,
I am writing a wrapper on top of WebDav Client 2.1 M1 (with latest
CVS code for DOMUtils.java). I am having a problem executing
proppatchMethod() for the property group-member-set. I am trying to assign
user john to role root. If I try the same through DAVExplorer 0.9, it is
working fine. The group-member-set property value that my algorithm
generates before it calls proppatchMethod is:

The group-member-set property value that I am trying to set using
webdavResource.proppatchMethod

![CDATA[D:href xmlns:D='DAV:'/Slide/users/root/D:hrefD:href
xmlns:D='DAV:'/Slide/users/john/D:hrefD:href
xmlns:D='DAV:'/Slide/users/guest/D:href]]


I get the following error:

![CDATA[D:href xmlns:D='DAV:'/Slide/users/root/D:hrefD:href
xmlns:D='DAV:'/Slide/users/john/D:hrefD:href
xmlns:D='DAV:'/Slide/users/guest/D:href]]

Prop patch failed::Bad Request (400)


If I take this same string and add the property through DAVExplorer it works
fine. So I am sure that the string that I am generating for the property is
right. I guess there is a bug with the Slide2.1 M1 Webdav Client while
handling XML data.

Has anyone worked on this, any clues what could be wrong, or can anyone
validate that this is a bug with Webdav Client .

any help is appreciated ...

thanks and regards,

Krishna

PS: Source code for the method that assigns user to role

public boolean assignUserToRole(String sUserName, String sRoleName)
throws IOException
{
// URI pointing to the given role 
String sURI = BASE_URL + roles/ + sRoleName;
String sNewUserURI = /Slide/users/ + sUserName;

boolean bSuccess = false;
boolean bUserAlreadyBelongsToRole = false;

try
{
// Connect to Slide resource
if(connect(sURI))
{
write(Connected to slide successfully);

// Try to set the group-member-set property
as follows
/*
 *  proppatch /roles/role1 
 *  group-member-set = ![CDATA[D:href
xmlns:D='DAV:'/users/user1/D:hrefD:href
xmlns:D='DAV:'/users/user2/D:href]] 
 *  namespace = DAV:
*/
String sPropertyName = group-member-set;
Enumeration enumProperties =
webDavResource.propfindMethod(group-member-set);


String sListOfUsersInRole =
(String)enumProperties.nextElement();

// Split the output into the multiple user
URI's
String[] saUsersInRole =
sListOfUsersInRole.split(\n);
String sUserInRoleURI;

// Build the new group-member-set property
including existing users and additionally the new user
// Ex: ![CDATA[D:href
xmlns:D='DAV:'/users/user1/D:hrefD:href
xmlns:D='DAV:'/users/user2/D:href]]
StringBuffer sbNewMemberSetProperty = new
StringBuffer();

// Add the CDATA elemet header
sbNewMemberSetProperty.append(![CDATA[);

// Loop through each exisitng user URI
belonging to the role
for(int j = 0; j  saUsersInRole.length;
j++)
{
sUserInRoleURI = saUsersInRole[j];
sUserInRoleURI =
sUserInRoleURI.trim();

// Check if the user alrady belongs
to the role, if yes do not execute propPatch

if(sNewUserURI.equals(sUserInRoleURI))
bUserAlreadyBelongsToRole =
true;

write(sUserInRoleURI);

if(sUserInRoleURI.length()  0)
{

// Add the href element
with user URI for each existing user

sbNewMemberSetProperty.append(D:href xmlns:D='DAV:');