Do you think this can work :
1. have an embeded dataset with all the XML but without values in it.
2. Have a form or just some field (inputtext, Grid, ...) bound to the embeded dataset 3. the submit buttun could set type, src and just call doRequest on the embeded dataset

This would save time of receiving via http the first XML stream.


Jens Richnow wrote:
I would need to look up the method but I'm pretty sure (as far as my memory can be sure these days) that the third parameter sets the flag to do a encoding or not. With XML data you will need to do the encoding.

Please be aware that you need to bind all your form fields to a dataSet and after the user pressed the 'Save' button (or whatever) you will need to update the datapath and then send the dataset as serialised stream.

Your dataset defined the URL such as:

<dataset name='dsMyForm' src='http:uri' request='false'/>

After you updated the datapath as described above (using formView.datapath.updateData()) you can define your request string and send it of:

var params = new LzParams();
var _dataPointer = formView.datapath.getPointer();
params.addValue('xmlData', _dataPointer.p.serialize(), true);
params.addValue('action', 'saveFormData');
dsMyForm.setQueryString(params);
dsMyForm.setQueryType('POST');
dsMyForm.doRequest();

The overhead is quite small, well the same overhead with all XML data transfer ;-). Obviously, the XML will have the same structure as you defined in the first place when calling it with empty values. The only difference is that you now have the values. And it will not be bigger than the datasets you send from the server to bind to oyur view widgets.

Also note, that if you use the same dataset in a different context that does not require a POST type, you will need to reset it to dsMyForm.setQueryType('GET'); (Context is everything ;-)

Cheers

Jens


Jean-Baptiste BRIAUD wrote:
Just one question about params.addValue('xmlData', _dataPointer.p.serialize(), true); Will that use URL or not ? Is it just that last parameter to switch to false ? Also, as it will put a great amount of text for only one parameter, is there any drawback ?
Is that synonym of "put the data in the body of an HTTP request" ?

dp.p.serialize(), what a good method :-)
and that let OL do the conversion from field to XML !

Thanks for your help !

Jens Richnow wrote:
Hi Jean-Baptiste,

I'm not sure how you work with your forms to capture the data. Generally, I use a dataset, with empty values, to bind to all form fields and, after client-side validation, send the entire dataset back to the server in its serialised form (using HTTP POST):

var params = new LzParams();
var _dataPointer = datasetName.getPointer();
params.addValue('xmlData', _dataPointer.p.serialize(), true);

Cheers

Jens

Jean-Baptiste BRIAUD wrote:
Hi Geoff,

Yes, I'm developping the server, so I everything is open.
I used SOAP on a previous project and it is dam' slow.
XML-RPC could be OK but I would prefer having my own XML.

I fully agree : nothing by the URL.

Could you confirm that the following code snipset ensure that data won't be transmitted via URL :
LzParam.addValue("xml", theXmlText, false)
// I assumed the last parameter set to false ensure that.

So, how do I build my XML on laszlo side ?
Is it just string concatenation ?
Is there more efficient than that ?
Do I just pass that XML as a request paremeter ?
Or is there other way than parameter to pass a large text to an HTTP request ?

Thanks !

Geoff Crawford wrote:
At 05:01 PM 5/20/2007, Jean-Baptiste BRIAUD wrote:
More precision : in fact, I have to send back to the server in XML the content of a form. For simple value, it is simple : one name in the form could be one parameter with 'name' as a key. It become more difficult for multiple values like several book in a basket for example.
I could add several books with keys like 'book1', 'book2', ...

What kind of mecanism would you advice me to use ?
I'm seeking for a mecanism that could work on any possible cases.
Including not only multiple simple object but also multiple complex object like several Addresses.

Any idea ?

#1 issue you haven't really described - what's at the other
end on the server?  If it's formalized and you want many
integration possibilities on the client side, SOAP is a
good solution and probably the most portable, but then
it's the most complicated.  JSON is a potential alternative
but what ever is at your server may not support it.

If the server is entirely in your control and not built
yet, you may want to keep it simple and simply pass info
back and forth through CGI scripts.

1. There are potentially limits in some web servers on
the size of URL parameters.  Don't do that.  Use a POST
where web servers expect data

2. Use LZ built in functionality if possible, SOAP, XML-RPC, etc.
the idea is Laszlo takes care of compiling for the right platforms,
etc. so let it deal with the issues.  This is better than just
grabbing some open source J/S (like soapclient.js or the like)

3. In the end HttpXMLRequest is what it's all going to translate
down to.  Just don't use the URL to pass data, get it in the
POST request whether you use a built-in Laszlo class or create
your own.


======================================================================= Geoff Crawford Phone: (973) 361 - 4224 Innov8 Computer Solutions, LLC FAX: (973) 537 - 6946 711 Route 10 East, Suite 204 Email: [EMAIL PROTECTED] Randolph NJ 07869 Web: http://www.processware.biz

                 ProcessWare ERP for the Chemical Industry







Reply via email to