PDA

View Full Version : making laszlo and exist talk


neogi_titash
03-03-2006, 01:49 AM
Hello All,

I am a newbie Laszlo user. I am cross posting this on both exist and openlaszlo newsgroups as I am unsure where the solution to my problem lies.


I have a simple form based application that accepts user queries and certain parameters and then passes these to a backend exist layer.

Most of the examples and code that I have been able to see and learn from, are for directly querying the exist db via a laszlo UI. My case is slightly different.

My xquery application takes a string from the user and then does some internal processing of the parameter to get query variables. It then queries the DB using those parameters. I dont want to touch this layer of code since it uses quite a few exist-specific functions.

Till now I was using a simple html form to send data to the xquery backend. Now I am trying to do this with laszlo. Here is my laszlo code for better understanding of the problem -

__________________________________________________ ________________________________________
<canvas>

<window id="main"> <form>

<submit name="xquery"/><text>RUbiCon ver 1.0 </text>

<edittext width="150" name="val1"></edittext>

<button isdefault="true" onclick="submitter(parent.val1.text)">submit

<method name="submitter" args="val"> <![CDATA[

url_exist_db = "http://localhost:8080/exist/servlet/db/rubicon_bk_1.xq";

URLstring = (url_exist_db + "?" +"val1="+ val);

LzBrowser.loadURL(URLstring, '_blank');

]]>

</method>

</button></form></window></canvas>

]]>

</method></button> </form>

</window></canvas>

__________________________________________________ __________________________

When I run this, I get the search results as html in a browser.

What I am trying to achieve now is that when rubicon_bk_1.xq returns the search results, they should be picked up by laszlo and rendered on the canvas.

I am not sure how to handle this part, please advise.
Any ideas would be most welcome.

Thanks and Regards
Titash

d~l
03-03-2006, 04:26 AM
I might be able to text with installed eXist webapp if I could find the file rubicon_bk_1.xq

Where is this file in eXist?

...

And as an alternative .. why not use PHP-exist API? Or SOAP?

neogi_titash
03-03-2006, 08:12 PM
Hi,

Not sure what you are asking here. rubicon_bk_1.xq is code written by me.I am attaching that file here. But it depends on a database in the backend.

And about using PHP-exist API or SOAP. Honestly, I am not sure how to go about doing this.

Thanks in advance.


Kind Regards
Titash

d~l
03-04-2006, 02:56 AM
The idea was to try to understand your rubicon query and database .. but I am non the wiser after reading your file.

Your posting at exist mailing list suggests that you are getting XML back in an HTML browser .. so you just need to get this XML response into openlaszlo.

But I would start with some simpler examples using the test database supplied with exist .. DB/Shakespeare is a good start ..

Here is an openlaszlo app which uses SOAP to echo back the exist methods from the wsdl.


<?xml version="1.0" standalone="no"?>
<!DOCTYPE canvas SYSTEM "http://www.laszlosystems.com/lps/tools/lzx.dtd">
<canvas width="500" height="500" debug="true">

<debug x="20" y="20" width="400" height="400" />

<soap name="eXist" wsdl="http://localhost:8080/exist/services/Query?WSDL">

<method event="onload">
Debug.write('eXist soap service loaded');
Debug.write('Compare proxy stubs with WSDL SOAP operations.');
Debug.write('eXist WSDL at ' + this.wsdl);
Debug.write('proxy:');
Debug.inspect(this.proxy);
</method>

<method event="onerror" args="error">
Debug.write('error:', error);
</method>

</soap>
</canvas>



and you should see this in debugger window ..


eXist soap service loaded
Compare proxy stubs with WSDL SOAP operations.
eXist WSDL at http://localhost:8080/exist/services/Query?WSDL
proxy:
{} {
connect: «Function#0»
disconnect: «Function#1»
getResource: «Function#2»
getResourceData: «Function#3»
listCollection: «Function#4»
query: «Function#5»
retrieve: «Function#6»
retrieveByDocument: «Function#7»
retrieveData: «Function#8»
xquery: «Function#9»
}