what is the value of $self->{COLLECTION} ?
perhaps you modify one function to say:
sub queryCollection
{
my $self = shift;
my $query = shift;
my $method= 'db.queryCollection';
my $type = "XPath";
my @args = ($self->{COLLECTION}, $type, $query, {X =>
"http://www.xmldb.org/xpath"});
warn "collection is ".$self->{COLLECTION};
my $result = $self->{SERVER}->call($method, @args);
return $result;
}
that value must begin with '/'.
dave
-----Original Message-----
From: Dr. Klemens Waldh�r [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 30, 2002 10:29 PM
To: [email protected]; [EMAIL PROTECTED]
Subject: Perl and Xindice XMLRPC - exception handling
Hi,
I have written a Perl module which - basoed on the Frontier::Client
module realises all the methods available in the Xindice XMLRPC module.
The problem I have now is that in case of exceptions thrown the module
(resp. The calling application) terminates with a Java error. See below:
Fault returned from XML RPC Server, fault code 0: java.lang.Exception:
java.lang
.Exception: Collection name must begin with a '/'
(I do not understand this error anyway as the collection givenis
supplied with staring '/', but anyway ...).
Now this behaviour is obviously something which does not like if using
the module. I tried to catch this in an eval block, but it did not work.
Any idea how I can resolve this so that the module methods return an
error code instead ?
Methods look like this
sub queryCollection
{
my $self = shift;
my $query = shift;
my $method= 'db.queryCollection';
my $type = "XPath";
my @args = ($self->{COLLECTION}, $type, $query, {X =>
"http://www.xmldb.org/xpath"});
my $result = $self->{SERVER}->call($method, @args);
return $result;
}
Or
sub dropCollection
{
my $self = shift;
eval
{
my $method= 'db.dropCollection';
my @args = ($self->{COLLECTION});
my $result = $self->{SERVER}->call($method, @args);
$self->{COLLECTION} = "";
return $result;
};
$self->{ERROR} = -1;
$self->{ERRORMSG} = $@;
}
Thanks for your help !
Klemens