×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    3

    Question XML onLoad with background http server problem

    Hi,

    I have a strange issue while using XML and a background HTTP server implemented in Symbian which is used for retrieving local resources (like call log, pictures, etc..). Inside the HTTP server i have a global note which displays the information what the server is going to retrieve and the user has to confirm (press OK) before continuing - if OK I send back the response with OK http status code, otherwise ERROR code.

    When I try to use the server inside flash lite (calling http://127.0.0.1/action)i see the above global note, if I press OK within one second I get back the normal response (XML) which I am able to use. But if I delay pressing the OK button for a couple of seconds (1+s) I never get anything back from the server (although I see that the server send back the proper response within the log file). So in this case my onLoad event handler never get's called, not even receives and error. Besides that when trying to call it again it does not even send out a request - it looks like XML is stucked somewhere. Or maybe is if waiting more than 1second send to some sort of background and not put in the foreground at the right time, when the response comes...no idea

    When testing the above procedure in WRT, J2ME, SYMBIAN, PYS60 everything is OK - just the flash lite client is not behaving as it should. The crossdomain.xml is in place, the flash lite file only has one frame, although I tried different scenarios with the same negative result.

    The phone I am testing with is 5800 Express but the same issue occurs also on an E66.

    Any help or a point in the right direction would be helpful, thanks !

    S

  2. #2
    Nokia Developer Champion
    Join Date
    Jul 2008
    Location
    Pakistan
    Posts
    1,065

    Smile Re: XML onLoad with background http server problem

    Quote Originally Posted by simonjuric View Post
    Hi,

    I have a strange issue while using XML and a background HTTP server implemented in Symbian which is used for retrieving local resources (like call log, pictures, etc..). Inside the HTTP server i have a global note which displays the information what the server is going to retrieve and the user has to confirm (press OK) before continuing - if OK I send back the response with OK http status code, otherwise ERROR code.

    When I try to use the server inside flash lite (calling http://127.0.0.1/action)i see the above global note, if I press OK within one second I get back the normal response (XML) which I am able to use. But if I delay pressing the OK button for a couple of seconds (1+s) I never get anything back from the server (although I see that the server send back the proper response within the log file). So in this case my onLoad event handler never get's called, not even receives and error. Besides that when trying to call it again it does not even send out a request - it looks like XML is stucked somewhere. Or maybe is if waiting more than 1second send to some sort of background and not put in the foreground at the right time, when the response comes...no idea

    When testing the above procedure in WRT, J2ME, SYMBIAN, PYS60 everything is OK - just the flash lite client is not behaving as it should. The crossdomain.xml is in place, the flash lite file only has one frame, although I tried different scenarios with the same negative result.

    The phone I am testing with is 5800 Express but the same issue occurs also on an E66.

    Any help or a point in the right direction would be helpful, thanks !

    S
    EDIT : BELOW IS THE INFORMATION ABOUT A SIMPLE HTTP SERVER CONNECTED WITHOUT XML SOCKETS.
    I tested some Python http servers with Flash Lite & they are working quite fine.I try my best to solve ur issue . Most Probably, this issue is arising due to ur server side algorithm . On client side, A key point is that u can only send requests to the server when the server is not busy. Means that while making flash lite client always make a global variable which turns 1 if request is send and turns 0 if request is received & put a if statment before all calls to the server to check out whether server is busy or not like this:
    Code:
    on (press)
    {
    if (busy == 0)
    {
    var result_lv:LoadVars = new LoadVars();
        result_lv.onLoad = function() {
      busy = 0;
        };
        var send_lv:LoadVars = new LoadVars();
        send_lv.dir = "c:\\sajid";
        send_lv.sendAndLoad("http://127.0.0.1:2010/smake_dir", result_lv, "GET");
    busy = 1;
    }
    }
    it solves many unusual results from the server Because many times user press a single button thrice and it makes sever unstable.
    Now come to the server side, remember that if u r calling an http server, u can send one feedback(reply to client) per request(from client) .Another point ,is to always send these headers to the client attach with the reply from the server i.e: (No need to send OK status first)
    Code:
    "HTTP/1.0 200 OK\r\nConnection: Close\r\n\r\n" + Your_Reply
    Your_Reply is the reply from the server and it should be a string like this "&feedback=working dude!&data=yahoo&". One more thing to remember is to run ur global_note function SYNCHORONOUS with the called function (which is called by the client). Third point is to bind a port too with the localhost ip i.e http://127.0.0.1:5050/action (Where 5050 is a port).
    whatever if u dont wana mess with it, u can try some ready made servers which are working fine . For Symbian C++ server , try this open source http server :
    Janus Symbian Open Source
    For Python , Try this :
    Pys60 server source
    M working on J2me Http server now a days. If u have any problem regarding python server , then u can ask without any hesitation .I can write a small server for u for free .Hope it helps u..Best Ov Luck..

    EDIT : After reading ur prob again . I come to know that u r using an xml socket server. Actually, u mixed up http server and xml socket together. There are two ways to extend flash lite one is by using xml socket connections and one is by sending request via loadVariables api (i.e Http Server). The algorithm for xml socket server is somewhat different. While using XML socket connection u have to send just a "/0" null byte attached with the reply from the server instead of http server. Also , there is no limit of sending one reply per request. U can send as many as u want. One of the great xml socket server written in python can be found here:
    Flyer - XML Socket Server (Open Source)
    Ofcourse, u can use the same algorithm in ur symbian c++ & to make a more stable server. .. Hope it helps u..
    Best Regards,
    SajiSoft
    Last edited by sajisoft; 2009-06-07 at 18:27.

  3. #3
    Registered User
    Join Date
    Jun 2008
    Posts
    3

    Re: XML onLoad with background http server problem

    Hi Sajisoft,

    thanks for the informations I will check if they are going to be helpfull in my case. The issue only occurs when running the server (http) and flash lite client on the same phone, i am guesing that something occurs when the global note comes to the foreground for more then 1 second.

    I did implement a simple HTTP server in python to compare the issues, although I am unable to implement a global query dialog inside pys60 to copy the behavior I noticed that the same issue occurs then calling telephone.dial() - i don't get a response back to the client, somehow the python server stops acting as it should.

    I am not using XML socket but just the normal XML (http://help.adobe.com/en_US/FlashLit...5f6e-776e.html) as it should be almost the same as LoadVars. As I am not sending vars back to the client but raw xml i think that the XML class is the one to use, or am I missing something ? I tested the implementation with some external web services which return xml data and it works normal, so I would not say that using XML is an issue.

    Thanks for the help, will keep you posted.

    Cheers, S

  4. #4
    Nokia Developer Champion
    Join Date
    Jul 2008
    Location
    Pakistan
    Posts
    1,065

    Smile Re: XML onLoad with background http server problem

    Quote Originally Posted by simonjuric View Post
    I did implement a simple HTTP server in python to compare the issues, although I am unable to implement a global query dialog inside pys60 to copy the behavior I noticed that the same issue occurs then calling telephone.dial() - i don't get a response back to the client, somehow the python server stops acting as it should.
    There is an issue with telephone.dial() , it only works for the first time. If u want to make a call again , then u have to call telephone.hang_up() first. You can impelement Global Query In Pys60. Please, Upload ur testing FLA and Python HTTP Server PY to some file sharing site(except Rapidshare & 4shared) or upload to ur site & provide me the URL. I will do some tests & surely provide u a better feedback in max 24 hours (After getting Files) .

    Best Regards,
    SajiSoft

  5. #5
    Registered User
    Join Date
    Jun 2008
    Posts
    3

    Re: XML onLoad with background http server problem

    Ok, i just mentioned telephone.dial() as an example. Now my pys60 server works fine, we are still trying to figure out what happens in Symbian / FlashLite combination - will keep you posted if we will be able to resolve the issue.

    Thanks for your help - I really appreciate.

    Cheers, S

  6. #6
    Nokia Developer Champion
    Join Date
    Jul 2008
    Location
    Pakistan
    Posts
    1,065

    Smile Re: XML onLoad with background http server problem

    Quote Originally Posted by simonjuric View Post
    Ok, i just mentioned telephone.dial() as an example. Now my pys60 server works fine, we are still trying to figure out what happens in Symbian / FlashLite combination - will keep you posted if we will be able to resolve the issue.

    Thanks for your help - I really appreciate.

    Cheers, S
    Glad to know that u solve the Python Server issue urself. Best Ov Luck For Making Symbian Http Server. ..

    BTW , i would like to tell u that there is also another BIG open source http server (written in Symbian C++) for flash lite is available. May it solves ur issue.
    Intelligere Flash Lite Server

    Best Regards,
    SajiSoft

Similar Threads

  1. Replies: 3
    Last Post: 2008-09-09, 04:53
  2. Background Console Server!
    By amerzannouneh in forum Symbian
    Replies: 12
    Last Post: 2008-09-08, 16:33
  3. Problem with HTTP POST and certain IAP
    By nvuorio in forum Symbian Networking & Messaging (Closed)
    Replies: 5
    Last Post: 2008-07-04, 11:12
  4. Problem with HTTP POST
    By thathoo in forum Mobile Java General
    Replies: 2
    Last Post: 2006-12-18, 18:23
  5. Problem Starting the server
    By Nokia_Archived in forum WAP Servers
    Replies: 1
    Last Post: 2002-05-14, 18:03

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×