Matt Kenneth Collins wrote:
Last Point "Configure Xindice XML-RPC Driver (Client side)" What do i
have to do where?!
Please read Wiki entry:
This can be done with system properties ... or programmatically.
Details are here:
http://xml.apache.org/xindice/api/org/apache/xindice/client/xmldb/xmlrpc/DatabaseImpl.html
Vadim
Hi Vadim,
I too have had trouble setting programmatic authentication for xindice.
Xindice 1.1b4 was up and running with no problems. I had set up Cocoon's cforms to write data to the xindice database using flowscript/xupdate. It was accessing the database over xmldb:xindice://localhost:8080/db.
The problem came when I enabled Tomcat's BASIC authentication on the xindice directory, as recommended in the wiki entry (http://wiki.apache.org/xindice/BasicAuthentication)
You recommend the code:
driver.setProperty(DatabaseImpl.PROP_XMLRPC_USER, "xindice"); driver.setProperty(DatabaseImpl.PROP_XMLRPC_PASSWORD, "manager");
However, driver is a protected field of DatabaseImpl
(http://xml.apache.org/xindice/api/org/apache/xindice/client/xmldb/DatabaseImpl.html)
and PROP_XMLRPC_[USER|PASSWORD] are private fields of DatabaseImpl
(http://cvs.apache.org/viewcvs.cgi/xml-xindice/java/src/org/apache/xindice/client/xmldb/xmlrpc/DatabaseImpl.java?view=markup).
Oops. My fault.
Trying to work around this, I set up some test code that included:
try { String driver = "org.apache.xindice.client.xmldb.DatabaseImpl"; Class c = Class.forName(driver);
Database database = (Database)c.newInstance();
Correction:
database.setProperty( "xmlrpc-password", "..."); database.setProperty( "xmlrpc-user", "xindice");
DatabaseManager.registerDatabase(database);
String uri = "xmldb:xindice://localhost:8080/db";
One more:
col = DatabaseManager.getCollection(uri);
assert col != null; } ...
I believed that DatabaseManager would pass on the properties to
DatabaseImpl (the xml-rpc version), which would then pass them on to the
XmlRpcClient, but the output I get is
Well, I don't believe in this. I simply don't know what would happen with DatabaseManager properties. But I happen to know what happens with DatabaseImpl properties :-)
trying to register database XML:DB Exception occured (error code: 0) org.xmldb.api.base.XMLDBException: Cannot communicate with the server: http://localhost:8080/xindice
Looking through the code (http://cvs.apache.org/viewcvs.cgi/xml-xindice/java/src/org/apache/xindice/client/xmldb/xmlrpc/DatabaseImpl.java?view=markup), I found the comment
/* TODO: introduce authentication some day */
Please don't confuse basic HTTP authentication on XML-RPC protocol which is *global* to all databases deployed with per-collection authentication of XML:DB API. While former works, latter is not implemented yet, as well as user and role management.
Yet the code seems to be present
XmlRpcClient client = new XmlRpcClient(xmlRpcURL);
if (basicUser != null) {
client.setBasicAuthentication(basicUser, basicPassword);
}
return client;
Yup.
Could you please give me some guidance on this?
Hope know things are clear. Feel free to amend wiki page with Java code snippet.
Thanks, Vadim