wrong number of arguments (1 for 0)
I am trying to do something like below
opportunity = [
:type, 'Account',
:name, 'Fakey McFakerson',
]
p binding.create(:sObject=> opportunity)
but it is giving me wrong number of arguments (1 for 0) for create method. Even same is case with search
here is my authentication code:
oauth = {
:consumer_key => '....',
:consumer_secret => '....',
:access_token => access_token.token,
:access_secret => access_token.secret,
:login_url => 'https://login.salesforce.com/services/OAuth/u/20.0'
}
binding = RForce::Binding.new 'https://www.salesforce.com/services/Soap/u/20.0', nil, oauth
binding.login_with_oauth
Hi.
I'm sorry, I can't replicate this error here:
opportunity = [
:type, 'Account',
:name, 'Totally ForRealz',
]
p binding.create(:sObject=> opportunity)
# >>> {:createResponse=>{:result=>{:id=>"0014000000dSEqMAAW", :success=>"true"}}}
Can you try passing all four tokens in the oauth hash as string literals, with consumer_key and consumer_secret pasted directly from Setup >> App Setup >> Develop >> Remote Access in Salesforce, and with access_token and access_secret pasted directly from the verification result?
If that still fails, can you paste the exception backtrace into a comment here with three backticks (`) before and after (so Github will format it as code)?
Also, does the error only happen with oauth, or does it persist if you replace oauth login with username + password + secret login?
I tried login with username, password + token. Now I get same error at login() method itself. Below is full trace of app.
builder (3.0.0) lib/builder/xmlbase.rb:135:in to_xs'
builder (3.0.0) lib/builder/xmlbase.rb:135:in _escape' builder (3.0.0) lib/builder/xmlbase.rb:140:in _escape_quote'
builder (3.0.0) lib/builder/xmlmarkup.rb:320:in _attr_value' builder (3.0.0) lib/builder/xmlmarkup.rb:311:in _insert_attributes'
builder (3.0.0) lib/builder/xmlmarkup.rb:310:in each' builder (3.0.0) lib/builder/xmlmarkup.rb:310:in _insert_attributes'
builder (3.0.0) lib/builder/xmlmarkup.rb:293:in _start_tag' builder (3.0.0) lib/builder/xmlbase.rb:60:in method_missing'
builder (3.0.0) lib/builder/xmlbase.rb:34:in tag!' rforce (0.8.1) lib/rforce.rb:80:in expand'
rforce (0.8.1) lib/rforce.rb:60:in each' rforce (0.8.1) lib/rforce.rb:60:in expand'
rforce (0.8.1) lib/rforce/binding.rb:159:in call_remote' rforce (0.8.1) lib/rforce/binding.rb:108:in connect'
rforce (0.8.1) lib/rforce/binding.rb:114:in login' app/controllers/sfdc_controller.rb:130:in oauth_connect'
actionpack (3.1.1) lib/action_controller/metal/implicit_render.rb:4:in send_action' actionpack (3.1.1) lib/action_controller/metal/implicit_render.rb:4:in send_action'
actionpack (3.1.1) lib/abstract_controller/base.rb:167:in process_action' actionpack (3.1.1) lib/action_controller/metal/rendering.rb:10:in process_action'
actionpack (3.1.1) lib/abstract_controller/callbacks.rb:18:in process_action' activesupport (3.1.1) lib/active_support/callbacks.rb:416:in _run__1621701694__process_action__84790990__callbacks'
activesupport (3.1.1) lib/active_support/callbacks.rb:386:in send' activesupport (3.1.1) lib/active_support/callbacks.rb:386:in _run_process_action_callbacks'
activesupport (3.1.1) lib/active_support/callbacks.rb:81:in send' activesupport (3.1.1) lib/active_support/callbacks.rb:81:in run_callbacks'
actionpack (3.1.1) lib/abstract_controller/callbacks.rb:17:in process_action' actionpack (3.1.1) lib/action_controller/metal/rescue.rb:17:in process_action'
actionpack (3.1.1) lib/action_controller/metal/instrumentation.rb:30:in process_action' activesupport (3.1.1) lib/active_support/notifications.rb:53:in instrument'
activesupport (3.1.1) lib/active_support/notifications/instrumenter.rb:21:in instrument' activesupport (3.1.1) lib/active_support/notifications.rb:53:in instrument'
actionpack (3.1.1) lib/action_controller/metal/instrumentation.rb:29:in process_action' actionpack (3.1.1) lib/action_controller/metal/params_wrapper.rb:201:in process_action'
activerecord (3.1.1) lib/active_record/railties/controller_runtime.rb:18:in process_action' actionpack (3.1.1) lib/abstract_controller/base.rb:121:in process'
actionpack (3.1.1) lib/abstract_controller/rendering.rb:45:in process' actionpack (3.1.1) lib/action_controller/metal.rb:193:in dispatch'
actionpack (3.1.1) lib/action_controller/metal/rack_delegation.rb:14:in dispatch' actionpack (3.1.1) lib/action_controller/metal.rb:236:in action'
actionpack (3.1.1) lib/action_dispatch/routing/route_set.rb:65:in call' actionpack (3.1.1) lib/action_dispatch/routing/route_set.rb:65:in dispatch'
actionpack (3.1.1) lib/action_dispatch/routing/route_set.rb:29:in call' rack-mount (0.8.3) lib/rack/mount/route_set.rb:152:in call'
rack-mount (0.8.3) lib/rack/mount/code_generation.rb:96:in recognize' rack-mount (0.8.3) lib/rack/mount/code_generation.rb:75:in optimized_each'
rack-mount (0.8.3) lib/rack/mount/code_generation.rb:95:in recognize' rack-mount (0.8.3) lib/rack/mount/route_set.rb:141:in call'
actionpack (3.1.1) lib/action_dispatch/routing/route_set.rb:532:in call' sass (3.1.12) lib/sass/./sass/plugin/rack.rb:54:in call'
warden (1.1.0) lib/warden/manager.rb:35:in call' warden (1.1.0) lib/warden/manager.rb:34:in catch'
warden (1.1.0) lib/warden/manager.rb:34:in call' actionpack (3.1.1) lib/action_dispatch/middleware/best_standards_support.rb:17:in call'
rack (1.3.6) lib/rack/etag.rb:23:in call' rack (1.3.6) lib/rack/conditionalget.rb:25:in call'
actionpack (3.1.1) lib/action_dispatch/middleware/head.rb:14:in call' actionpack (3.1.1) lib/action_dispatch/middleware/params_parser.rb:21:in call'
actionpack (3.1.1) lib/action_dispatch/middleware/flash.rb:243:in call' rack (1.3.6) lib/rack/session/abstract/id.rb:195:in context'
rack (1.3.6) lib/rack/session/abstract/id.rb:190:in call' actionpack (3.1.1) lib/action_dispatch/middleware/cookies.rb:331:in call'
activerecord (3.1.1) lib/active_record/query_cache.rb:62:in call' activerecord (3.1.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:477:in call'
actionpack (3.1.1) lib/action_dispatch/middleware/callbacks.rb:29:in call' activesupport (3.1.1) lib/active_support/callbacks.rb:392:in _run_call_callbacks'
activesupport (3.1.1) lib/active_support/callbacks.rb:81:in send' activesupport (3.1.1) lib/active_support/callbacks.rb:81:in run_callbacks'
actionpack (3.1.1) lib/action_dispatch/middleware/callbacks.rb:28:in call' actionpack (3.1.1) lib/action_dispatch/middleware/reloader.rb:68:in call'
rack (1.3.6) lib/rack/sendfile.rb:101:in call' actionpack (3.1.1) lib/action_dispatch/middleware/remote_ip.rb:48:in call'
actionpack (3.1.1) lib/action_dispatch/middleware/show_exceptions.rb:47:in call' railties (3.1.1) lib/rails/rack/logger.rb:13:in call'
rack (1.3.6) lib/rack/methodoverride.rb:24:in call' rack (1.3.6) lib/rack/runtime.rb:17:in call'
activesupport (3.1.1) lib/active_support/cache/strategy/local_cache.rb:72:in call' rack (1.3.6) lib/rack/lock.rb:15:in call'
actionpack (3.1.1) lib/action_dispatch/middleware/static.rb:53:in call' railties (3.1.1) lib/rails/engine.rb:456:in call'
railties (3.1.1) lib/rails/rack/content_length.rb:16:in call' railties (3.1.1) lib/rails/rack/log_tailer.rb:14:in call'
rack (1.3.6) lib/rack/handler/webrick.rb:59:in service' /Users/bhushan/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/httpserver.rb:104:in service'
/Users/bhushan/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/httpserver.rb:65:in run' /Users/bhushan/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:173:in start_thread'
/Users/bhushan/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:162:in start' /Users/bhushan/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:162:in start_thread'
/Users/bhushan/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:95:in start' /Users/bhushan/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:92:in each'
/Users/bhushan/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:92:in start' /Users/bhushan/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:23:in start'
/Users/bhushan/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/webrick/server.rb:82:in start' rack (1.3.6) lib/rack/handler/webrick.rb:13:in run'
rack (1.3.6) lib/rack/server.rb:265:in start' railties (3.1.1) lib/rails/commands/server.rb:70:in start'
railties (3.1.1) lib/rails/commands.rb:54
railties (3.1.1) lib/rails/commands.rb:49:in tap' railties (3.1.1) lib/rails/commands.rb:49 script/rails:6:in require'
script/rails:6`
and the binding object look like
#<RForce::Binding:0x12b573b00 @session_id=nil, @batch_size=2000, @proxy=nil, @server=#<Net::HTTP www.salesforce.com:443 open=false>, @oauth=nil, @url=#<URI::HTTPS:0x12b573830 URL:https://www.salesforce.com/services/Soap/u/20.0>>
Does the issue only happen in the context of a Rails app, or does it persist if you paste the RForce login code into a standalone program and run that?
Also, what's the output when you put p method; p args as the first line inside the call_remote() method in rforce/lib/rforce/binding.rb (with any passwords or tokens replaced with ...)?