You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by Pietro Michelucci <pe...@experimentaldata.com> on 2003/03/01 06:36:46 UTC

Newbie: Xindice + Delphi

Greetings.  I would like to access Xindice from a Delphi v6 application.  I
understand that Xindice now has support for transactions via HTTP using
XML-RPC.  I recently discovered a Delphi API for XML-RPC, so I would like to
try to access my Xindice database using that mechanism.  Can anyone provide
some guidance on how to do this?

At this point I have a rudimentary understanding of XML-RPC in that it sends
a request in XML format according to certain guidelines and the receives a
response, which is also in XML.  Is this correct?  I get the impression that
it is like a Biztalk schema.  What commands does the XML-RPC interface in
Xindice accept?  Can someone point me to a resource for this?

Also, I have an unrelated question.  Is it possible, in principle, to use
XML-RPC calls to create a new XML document in Xindice?  In other words, is
it necessary to begin by creating an XML file and then adding it to a
collection, or can one simply build a document programmatically using just
XML-RPC and XUpdate?

Thank you,
Pietro Michelucci

XML-RPC

Posted by Pietro Michelucci <pe...@experimentaldata.com>.
Hello.  I am trying to interface a Delphi application with Xindice via the
XML-RPC module.

First, here is the documentation example I used as the basis for my XML-RPC
message:

To use the API all you really need to do is create an XmlRpcClient that
connects to Xindice via HTTP. Since the default HTTP port for Xindice is
4080 that is what we use here.
        XmlRpcClient  client = new XmlRpcClient("http://localhost:4080");

Once we have our client we need to create a Vector that contains all the
parameters for the method. In this case we're calling the method
db.getDocumentCount that only takes one parameter. This is the path of the
collection that we want to count the documents in. Parameters in XML-RPC
must be added to the Vector in the order that they are listed in the method
signature. In this case we only have one, so there is no problem, however
you need to be aware of this to call the other methods in the API.
       Vector params = new Vector();
       params.addElement("/db/root");


This is the way I constructed my message based upon the above example:

<methodCall><params><param><value><array><data><value><string>/db/root</stri
ng></value>
</data>
</array></value>
</param>
</params>
<RPCmethodName>db.getDocumentCount</RPCmethodName>
</methodCall>

And this is the reply that I received:

<methodResponse><fault></fault>
<params><param></param>
</params>
</methodResponse>


Somehow, I don't think my message was properly constructed.  I'm not sure
how to interpret the response, but it is now what I was expecting.  I would
be grateful for any insight that someone might have.

Thanks,
Pietro