7 Replies Latest reply on Jun 12, 2013 9:02 AM by DecisionPoint Keith Gable

    BB device could not connect thru wifi to webservice

    Mark Nongkhlaw

      I'm using Asynchttp to connect to a JSON webservice to retrieve data.

       

      However, my BB 8520 device cannot connect to it thru wifi.

       

      On perusing the log, there's a line :

       

      NetworkAccess|Connector.open exception; javax.microedition.io.ConnectionNotFoundException: Protocol not found: net.rim.device.cldc.io."http.Protocol

       

      AsyncHttp|command failed:1url:"my URL":java.io.IOException:No network coverage

       

      The device browser can browse the websites. However, trying to browse to my webservice URL, it popups a message saying the item you selected cannot be displayed. Do you wish to save the item? On choosing No, another popup says Unsupported media type:application/json

       

      So the question is whether the app can parse the JSON at all, even if the wifi connection problem is resolved?

       

       

      I know this should've been posted in BB Forums, but I thought someone here would also be able to offer some suggestions.

        • Re: BB device could not connect thru wifi to webservice
          Kutir Mobility

          Can you post a code snippet to show how you are fetching the JSON, a sample response from the server and some more lines of the log?

           

          Thanks

          Javier

          Kutir Mobility

            • Re: BB device could not connect thru wifi to webservice
              Mark Nongkhlaw

              Sure, this is my code snippet :

               

              def seedState

                  Rho::AsyncHttp.get(:url => Rho::RhoConfig.myURL + "getAllStates",

                   :headers => {"Content-Type" => "application/json"},

                  :callback => (url_for :action => :getState_callback))

                  

                  #render :action => :waiting

                  WebView.navigate ( url_for :action => :waiting )

                end

               

                def waiting

                end

               

                def getState_callback

                  if @params['status'] != 'ok'

                      @@error_params = @params

                      WebView.navigate ( url_for :action => :show_error )       

                  else

               

                    @states = @params["body"]

                    @states.each do |state|

                        to_save = {"state_code" => state['state_code'],

                                   "state" => state['state']

                                   }

                 

                        exists = State.find(:first, :conditions => {'state_code' => to_save['state_code'] })

                        if exists.nil?

                           exists = State.create(to_save)

                        else

                          exists.update_attributes(to_save)

                          exists.save

                        end

                    end    

                      WebView.navigate ( url_for :action => :show_result )

                  end   

                end

               

                def show_result

                  render :action => :seedstate_success, :back => '/app'

                end

               

                def cancel_httpcall

                  Rho::AsyncHttp.cancel( url_for( :action => :getState_callback) )

               

               

                  @@get_result  = 'Request was cancelled.'

                  #render :action => :http_cancel, :back => '/app'

                end

               

               

                def show_error

                  render :action => :error, :back => '/app'

                end

               

                def get_error

                  @@error_params

                end

               

                def get_res

                  @@get_result   

                end

               

               

              The server couldn't be reached. So of course, no server response.

               

              Here's the full Rholog.txt :

               

              E 04/27/2013 16:21:40:201 4e78a000   NetworkAccess| Connector.open exception;javax.microedition.io.ConnectionNotFoundException:

               

               

              Protocol not found: net.rim.device.cldc.io."http.Protocol

              E 04/27/2013 16:21:40:285 4e78a000       AsyncHttp| command failed: 1url:

               

               

              "http://myURL/"getAllStates;javax.microedition.io.ConnectionNotFoundException: Protocol not found: net.rim.device.cldc.io."http.Protocol

              E

               

               

              05/01/2013 12:15:41:955 48d32000         RhoFile| isFileExist

               

               

              failed:file:///SDCard/Rho/OASIS_MOBILE/apps/rhoconfig.txt.changes;j2me.io.FileNotFoundException: File

               

               

              'file:///SDCard/Rho/OASIS_MOBILE/apps/rhoconfig.txt.changes' not exists

              E 05/01/2013 12:16:03:867 164f2000       AsyncHttp| command failed:

               

               

              1url: "http://myURL/"getAllStates;java.io.IOException: No network coverage.

              E 05/01/2013 12:16:13:144 164f2000       AsyncHttp| command failed:

               

               

              1url: "http://myURL/"getAllStates;java.io.IOException: No network coverage.

              E 05/01/2013 12:23:46:966 4cc14000         RhoFile| isFileExist

               

               

              failed:file:///SDCard/Rho/OASIS_MOBILE/apps/rhoconfig.txt.changes;j2me.io.FileNotFoundException: File

               

               

              'file:///SDCard/Rho/OASIS_MOBILE/apps/rhoconfig.txt.changes' not exists

              E 05/01/2013 12:24:09:280 4dbea000       AsyncHttp| command failed:

               

               

              1url: "http://myURL/"getAllStates;java.io.IOException: No network coverage.

              E 05/01/2013 18:37:22:824 47f8a000         RhoFile| isFileExist

               

               

              failed:file:///SDCard/Rho/OASIS_MOBILE/apps/rhoconfig.txt.changes;j2me.io.FileNotFoundException: File

               

               

              'file:///SDCard/Rho/OASIS_MOBILE/apps/rhoconfig.txt.changes' not exists

              E 05/01/2013 18:37:52:971 686d4000   NetworkAccess|

               

               

              Connector.open exception;javax.microedition.io.ConnectionNotFoundException: Protocol not found: net.rim.device.cldc.io."http.Protocol

              E

               

               

              05/01/2013 18:37:52:993 686d4000       AsyncHttp| command failed: 1url:

               

               

              "http://myURL/"getAllStates;javax.microedition.io.ConnectionNotFoundException: Protocol not found: net.rim.device.cldc.io."http.Protocol

              E

               

               

              05/01/2013 19:04:22:226 2809e000         RhoFile| isFileExist

               

               

              failed:file:///SDCard/Rho/OASIS_MOBILE/apps/rhoconfig.txt.changes;j2me.io.FileNotFoundException: File

               

               

              'file:///SDCard/Rho/OASIS_MOBILE/apps/rhoconfig.txt.changes' not exists

               

               

              Note :

               

              myURL actually is a placeholder to my actual webservice URL