Archive of UserLand's first discussion group, started October 5, 1998.

Re: Search Engine XML-RPC Interface

Author:Ken MacLeod
Posted:1/28/1999; 3:27:50 PM
Topic:Search Engine XML-RPC Interface
Msg #:2550 (In response to 2548)
Prev/Next:2549 / 2551

Stephen, using the new Frontier-RPC Perl module I just released, you can use Frontier-RPC to parse the request, call your procedure, and encode the response to send back to the client:

use Frontier::RPC2;
use DBI;

my $length = $ENV{CONTENT_LENGTH}; my $request_xml;

read STDIN, $request_xml, $length;

my $dbh = DBI->connect("xxx", "xxx", "xxx");

my $rpc_coder = Frontier::RPC2->new;

my $sth = $dbh->prepare($sql); $response_xml = $rpc_coder->serve( $request_xml, { 'nirvanaServer.search.index' => &index } );

print "Content-type: text/xml\n\n"; print "$response_xml";

sub index { if ((scalar @_) < 5) { die ("Not enough parameters\n"); } elsif ((scalar @_) > 5) { die ("Too many parameters\n"); }

my $sql = "insert into engine values(\"$values[0]", "$values[1]", "$values[2]", "$values[3]", "$values[4]")";

my $sth = $dbh->prepare($sql);

$sth->execute or die("Could not execute SQL: " . $sth->errstr);

# return true if SQL execute was successful return Frontier::RPC2::Boolean->new(1); }




There are responses to this message:


This page was archived on 6/13/2001; 4:47:38 PM.

© Copyright 1998-2001 UserLand Software, Inc.