2 Replies Latest reply on Oct 18, 2012 12:11 PM by

    RhoConnect tutorial failing to update Rhostore '301 Moved Permanently'

      HI,

       

      I have installed RhoMobile Suite 2.1.1.7 and RhoConnect 3.3.2 and have been working with the tutorials for get familiarized.

      Following the RhoConnect tutorial,  I have created the StoreManager app and StoreServer and configured the app settings for sync server (server uses the http://rhostore.herokuapp.com/products url) .   

      The query sync works and shows up in the rhomobile app but the creates/deletes from the app fail on my server. I see a "301 Moved Permanently" in the log. 

      What am I doing wrong?

        Here is the error from the server output:

       

      [10:32:52 AM 2012-10-18] Use of the POST /application is deprecated. Use Rhoconnect API v1 instead.

      [10:32:53 AM 2012-10-18] SourceAdapter raised create exception: 301 Moved Permanently

      [10:32:53 AM 2012-10-18] D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/abstract_response.rb:39:in `return!'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/request.rb:230:in `process_result'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/request.rb:178:in `block in transmit'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/1.9.1/net/http.rb:745:in `start'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient.rb:72:in `post'

      D:/RhoWorkspace/storeserver/sources/product.rb:21:in `create'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.3.2/lib/rhoconnect/source_sync.rb:207:in `_process_create'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.3.2/lib/rhoconnect/source_sync.rb:286:in `block (2 levels) in _process_cud'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.3.2/lib/rhoconnect/source_sync.rb:263:in `each'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.3.2/lib/rhoconnect/source_sync.rb:263:in `block in _process_cud'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.3.2/lib/rhoconnect/source_sync.rb:259:in `each'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.3.2/lib/rhoconnect/source_sync.rb:259:in `each_with_index'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.3.2/lib/rhoconnect/source_sync.rb:259:in `_process_cud'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.3.2/lib/rhoconnect/source_sync.rb:243:in `block in _measure_and_process_cud'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.3.2/lib/rhoconnect/stats/record.rb:54:in `update'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.3.2/lib/rhoconnect/source_sync.rb:242:in `_measure_and_process_cud'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.3.2/lib/rhoconnect/source_sync.rb:14:in `create'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.3.2/lib/rhoconnect/source_sync.rb:77:in `do_cud'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.3.2/lib/rhoconnect/source_sync.rb:71:in `process_cud'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.3.2/lib/rhoconnect/client_sync.rb:29:in `receive_cud'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.3.2/lib/rhoconnect/api/app/queue_updates.rb:17:in `block (2 levels) in <top (required)>'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.3.2/lib/rhoconnect/async.rb:41:in `block in catch_all'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.3.2/lib/rhoconnect/async.rb:41:in `catch'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.3.2/lib/rhoconnect/async.rb:41:in `catch_all'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.3.2/lib/rhoconnect/api/app/queue_updates.rb:16:in `block in <top (required)>'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.3.2/lib/rhoconnect/async.rb:55:in `block (2 levels) in execute_api_call'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.3.2/lib/rhoconnect/async.rb:41:in `block in catch_all'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.3.2/lib/rhoconnect/async.rb:41:in `catch'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.3.2/lib/rhoconnect/async.rb:41:in `catch_all'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.3.2/lib/rhoconnect/async.rb:54:in `block in execute_api_call'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0-x86-mingw32/lib/eventmachine.rb:1037:in `call'

      D:/MotorolaRhoMobileSuite2.1.1.7/ruby/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0-x86-mingw32/lib/eventmachine.rb:1037:in `block in spawn_threadpool'

      1. 157.146.228.150 - - [18/Oct/2012 10:32:53] "POST /application HTTP/1.1" 200 - 0.2498

      [10:32:53 AM 2012-10-18] Use of the GET /application is deprecated. Use Rhoconnect API v1 instead.

       

      This is the Create code I'm using from the tutorial:

       

        def initialize(source)

          @base = 'http://rhostore.heroku.com/products'

          super(source)

        end

       

        def create(create_hash)

          result = RestClient.post(@base, :product => create_hash)

       

          # after create we are redirected to the new record.

          # The URL of the new record is given in the location header

          location = "#{result.headers[:location]}.json"

       

          # We need to get the id of that record and return it as part of create

          # so rhoconnect can establish a link from its temporary object on the

          # client to this newly created object on the server

       

          new_record = RestClient.get(location).body

          JSON.parse(new_record)["product"]["id"].to_s

             

        end

       

      Anyone have an idea what is happening here?

      Thanks

      Barry