2008-08-22_09:57:57-0400 Jason Rumney <[EMAIL PROTECTED]>: > > >>2008-04-09_06:24:21-0400 Dave <[EMAIL PROTECTED]>: > >> > >>>The AtomPub end-point will be: > >>> http://hostname/roller/roller-services/app > >>> > Ron Peterson wrote: > >>I'm trying this, and if I log in as plain ol' me, I get an > >>authentication error, but if I log in as my admin user, I get in. > >> > > >Am I misunderstanding what the service URI should be? > > >my $SERVICE_URI = "https://pub.mtholyoke.edu/journal/roller-services/rap"; > > Reread what Dave wrote above, and I think you'll have the answer.
I should have mentioned that I've been using the 'app' url. On my last attempt I tried 'rap' is all. Sorry about that. Now I've switched from perl to java, and I'm using the java code from Dave's book, only slightly mogrified (code below). I've taken Apache https/ajp proxy out of the equation - I'm connecting directly to a tomcat http connector. Again, I can retrieve data as my admin user, but not as myself. Maybe this is the way life's meant to be. Are non-admin users disallowed from using APP? Examples below. 5024$ java -jar "/home/rpeterso/data/dev/java/atom/atomget/dist/atomget.jar" normaluser password http://pub.mtholyoke.edu:19080/journal/roller-services/app Aug 22, 2008 10:09:45 AM org.apache.commons.httpclient.auth.AuthChallengeProcessor selectAuthScheme INFO: basic authentication scheme selected Aug 22, 2008 10:09:45 AM org.apache.commons.httpclient.HttpMethodDirector processWWWAuthChallenge INFO: No credentials available for BASIC 'Roller'@pub.mtholyoke.edu:19080 <html><head><title>Apache Tomcat/5.5.26 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 401 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>This request requires HTTP authentication ().</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/5.5.26</h3></body></html> 5025$ java -jar "/home/rpeterso/data/dev/java/atom/atomget/dist/atomget.jar" adminuser adminpassword http://pub.mtholyoke.edu:19080/journal/roller-services/app Aug 22, 2008 10:11:39 AM org.apache.commons.httpclient.HttpMethodBase getResponseBody WARNING: Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended. <?xml version="1.0" encoding="UTF-8"?> <app:service xmlns:app="http://www.w3.org/2007/app"> <app:workspace> <atom:title xmlns:atom="http://www.w3.org/2005/Atom" type="text">MHC Journal</atom:title> <app:collection href="https://pub.mtholyoke.edu/journal/roller-services/app/main/entries" type="text"> <atom:title xmlns:atom="http://www.w3.org/2005/Atom">Weblog Entries</atom:title> <app:categories fixed="yes" scheme="https://pub.mtholyoke.edu/journal/main/"> <atom:category xmlns:atom="http://www.w3.org/2005/Atom" term="Status" label="Status" /> </app:categories> <app:categories fixed="no" /> <app:accept>application/atom+xml;type=entry</app:accept> </app:collection> <app:collection href="https://pub.mtholyoke.edu/journal/roller-services/app/main/resources/" type="text"> <atom:title xmlns:atom="http://www.w3.org/2005/Atom">Media Files</atom:title> </app:collection> </app:workspace> </app:service> ======================================================================== Java code: package atomget; import java.io.*; import org.apache.commons.codec.binary.Base64; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.methods.GetMethod; public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here if (args.length < 3) { System.out.println ("USAGE: authget <username> <password> <url>"); System.exit(-1); } String credentials = args[0] + ":" + args[1]; String url = args[2]; String responseBody; HttpClient httpClient = new HttpClient(); GetMethod method = new GetMethod(url); method.setRequestHeader("Authorization", "Basic " + new String(Base64.encodeBase64(credentials.getBytes()))); try { httpClient.executeMethod(method); } catch ( Exception e ) { System.out.println( "error: exception executing httpClient method" ); } try { responseBody = method.getResponseBodyAsString(); System.out.println( responseBody ); } catch( Exception e ) { System.out.println( "error: exception getting response body" ); } } } -- Ron Peterson Network & Systems Manager Mount Holyoke College http://www.mtholyoke.edu/~rpeterso - I wish my computer would do what I want it to do - not what I tell it to do.
