Hi Vadim,

Thanks for your timely reply.

> 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've corrected the code as you suggested, but the error remains:

XML:DB Exception occured (error code: 0)
org.xmldb.api.base.XMLDBException: Cannot communicate with the server:
http://localhost:8080/xindice/

>
> 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.
>

I now understand the comment. Thanks for clearing this up.

Here is the code I'm using, in case there are more errors you can point out:

import org.xmldb.api.base.*;
import org.xmldb.api.modules.*;
import org.xmldb.api.*;

public class Example1 {
  public static void main(String[] args) throws Exception {
    Collection col = null;
    try {
      String driver = "org.apache.xindice.client.xmldb.DatabaseImpl";
      Class c = Class.forName(driver);

      Database database = (Database)c.newInstance();

      database.setProperty(
        "xmlrpc-password", "...");
      database.setProperty(
        "xmlrpc-user", "xindice");

      DatabaseManager.registerDatabase(database);

      String uri = "xmldb:xindice://localhost:8080/db";

      col = DatabaseManager.getCollection(uri);

      assert col != null : "col = null";
      assert col.getService("XPathQueryService", "1.0") != null : "no
xpathqueryservice 1.0";

      ...

    } catch (XMLDBException e) {
      System.err.println("XML:DB Exception occured (error code: " +
e.errorCode + ") " + e);
      ...
    } finally {
      if (col != null) {
        col.close();
      }
    }
  }
}


> Hope know things are clear. Feel free to amend wiki page with Java code
> snippet.

I'll get right on it once this is up and running :)

Thanks,

Matt


Reply via email to