9 Replies Latest reply on Oct 10, 2013 10:44 AM by David Miller

    AsyncHttp HttpAddRequestHeaders Code 6

    David Miller

      My AsyncHttp call on the device (MC55A0) is still blocking the UI.  i.e. it is performing a synchronous call rather than an asynchronous call.  I assume because of the following error:


      Net| Method: GET;Url: /app/AppData/import_csv_files

      Net| Call HttpAddRequestHeaders failed. Url:/app/AppData/import_csv_files. With code : 6

      AsyncHttp| Callback:/app/AppData/upload_completeResult body: rho_callback=1&status=error&error_code=1&headers[User-Agent]=Mozilla-5.0%20%28WINDOWS%3b%20MC55A0%3b%205.2.23121%29&__rho_object[body]=0


      App Code:


        # executed from the menu for now - to test it

        def kick_off_import_csv_files

          Rho::AsyncHttp.get( :url => url_for(:action => import_csv_files), :callback => (url_for :action => :upload_complete))

          render :action => :import_product_data_page       



        def import_csv_files

           dataImportStatusText = "Data Importing.  Please wait..."    


           ...creates lots of objects in the db using transactions and updates the import_product_data_page using...



        def upload_complete

          dataImportStatusText = "Data Import Done"




      Does anyone know what 'code: 6' is?

        • Re: AsyncHttp HttpAddRequestHeaders Code 6
          Pietro Francesco Maggi

          Hi David,

          at the end your RhoElements app is still a native app. Error Code 6 is "Invalid Handle" in Windows World:


          6 (0x6)

          The handle is invalid.


          This is coming from the rhodes framework: platform/wm/rhodes/rho/net/NetRequestImpl.cpp


          After What and Where we need to talk about Why :-)


          I think that the main problem in your call is that you want to call a local action with the idea to have it returning asynchronously. I don't think that this can work. Rhodes is not intended to be multithreaded and your code will end up freezing all other activities (and I really think that the Async API is intended to be used to call remote server).


          What you can try to do is to split the job of your csv import function in smaller chunk (250 records at once), calling this function on a timer till everything is read.



          1 of 1 people found this helpful