views:

209

answers:

5

Hi everybody,

I have a flex app which allows user to create some content. this content will then be sent via xml back to the server:

private function saveBackXMLToServer():void {
            var params:Object = {};
            params["xml_file"] = XML_content();
            http_Service.send(params);
        }

My problem is, that the transport of the data this way is very slow... It takes about 20 sec for 10'000 lines of XML... How can this be done better?

Thanks in advance!

Markus

UPDATE: Hi guy's Thanks for all your comments. I'm trying to follow all of your hints, but they don't seem to be simple to change. My code is done in a way that I can't get access to every Object, and save it. So what I do is to load the swf file with one xml, and return the whole xml after I run it. My guess is, that the time isn't spent on transporting those lines to the web server (this task gets done quickly normally), I thing that there happens something on the send function of the HTTPService that every object must get changed, before sending...

UPDATE2: I just realized that it is not a matter of the flex app it is a matter of the rails app. It receives a 700 KB String. I guess it is not done for handling such a object. How to transport it then? I tryed to work with the file upload but couldn't get it done... Error 2037 was occuring! I'll go on trying.

+1  A: 

You can break the data down into smaller pieces. That can be done by breaking apart the xml you are already sending or perhaps use json (or some compressed format) instead.

Jason W
+1  A: 

did you thought using blazeDS? I think that if you still can make big changes on your app just do it!

with blazeDS you get much much faster communication with server, almost x10 faster!

here a useful link: adobe blazeDS tutorial

if you need any help of how to use it just write me.

FLEXpert
it seams to be too big of a change but thanks for your hint
Markus
+1  A: 

Maybe for data that large you could packaging it up and using File upload (FileReference::upload) to get better throughput.

OR

Look at some of the LZW compression libraries for Actionscript. I know with WebService WSDL XML data, I was able to compress 500KB of data down to something like 40 KB.

taudep
hi taudep, I tried to use the FileReference, but how can I get my String into a File?
Markus
I guess this doesn't work. It seams that only locally stored file can get uploaded like that...
Markus
+5  A: 

I highly recommend using AMF instead of XML I believe the 20 seconds can be shrunk to few seconds or even less. There are AMF libraries for all languages PHP, Ruby, Java, Python..It's not that hard to switch over and it will improve the performance of you app

Tam
A: 

Hi everybody,

I finally solved the issue in a more or less nice manner.

The problem is, that rails is very efficient in hangling requests with small parameters, but it is extremely slow if you put a xml file in a parameter...

As there is no way to put the xml in a file to send it, we just used rack middleware to put the request in a file on the server.

Thanks for your answers anyway! Markus

Markus