K
Kirk Strauser
I'm hoping to build a SOAP server to wrap a FoxPro database.
I built a minimal server:
-----------------------------------------------------------
#!/usr/bin/perl -w
use strict;
use SOAP::Transport::HTTP;
use FoxPro;
my $daemon = SOAP::Transport::HTTP:aemon
-> new (LocalPort => 8080, Reuse => 1)
-> dispatch_to('FoxPro')
;
print "Contact to SOAP server at ", $daemon->url, "\n";
$daemon->handle;
-----------------------------------------------------------
and a package to handle the backend:
-----------------------------------------------------------
#!/usr/bin/perl -w
package FoxPro;
use strict;
use DBI;
# Create a new FoxPro object
sub new
{
my $self = shift;
my $dbpath = shift || '.';
my $class = ref($self) || $self;
bless {'_dbpath' => $dbpath} => $class;
}
# Execute a query on a named table and return a handle to the result.
sub execute
{
my $self = shift;
my $query = shift;
my $limit = shift || 10;
my $dbh = DBI->connect("DBI:XBase:$self->{'_dbpath'}") or die $DBI::errstr;
my $sth = $dbh->prepare($query);
$sth->execute();
return $sth;
}
-----------------------------------------------------------
Now, I can use the FoxPro module locally, but when I run the little server
and try to pull results from it, I get errors like:
dbih_getcom handle DBI::st=HASH(0x86848dc) is not a DBI handle (has no magic)
I've Googled about, and it seems that other people have had similar
problems, but I've never found an answer to their questions. Is there
some problem passing around statement handles via SOAP::Lite that doesn't
exists when calling the modules locally?
I built a minimal server:
-----------------------------------------------------------
#!/usr/bin/perl -w
use strict;
use SOAP::Transport::HTTP;
use FoxPro;
my $daemon = SOAP::Transport::HTTP:aemon
-> new (LocalPort => 8080, Reuse => 1)
-> dispatch_to('FoxPro')
;
print "Contact to SOAP server at ", $daemon->url, "\n";
$daemon->handle;
-----------------------------------------------------------
and a package to handle the backend:
-----------------------------------------------------------
#!/usr/bin/perl -w
package FoxPro;
use strict;
use DBI;
# Create a new FoxPro object
sub new
{
my $self = shift;
my $dbpath = shift || '.';
my $class = ref($self) || $self;
bless {'_dbpath' => $dbpath} => $class;
}
# Execute a query on a named table and return a handle to the result.
sub execute
{
my $self = shift;
my $query = shift;
my $limit = shift || 10;
my $dbh = DBI->connect("DBI:XBase:$self->{'_dbpath'}") or die $DBI::errstr;
my $sth = $dbh->prepare($query);
$sth->execute();
return $sth;
}
-----------------------------------------------------------
Now, I can use the FoxPro module locally, but when I run the little server
and try to pull results from it, I get errors like:
dbih_getcom handle DBI::st=HASH(0x86848dc) is not a DBI handle (has no magic)
I've Googled about, and it seems that other people have had similar
problems, but I've never found an answer to their questions. Is there
some problem passing around statement handles via SOAP::Lite that doesn't
exists when calling the modules locally?