Like Charles O'Brien, we are trying to use the sforce WSDL with ruby on rails.
The sforce WSDL, sforce API documentation, and developer accounts may be obtained at http://www.sforce.com/resources/ .
I am using the attached wsdl with the following script.
require 'soap/wsdlDriver'
WSDL_URL = "enterprise.wsdl"
soap = SOAP::WSDLDriverFactory.new(WSDL_URL).create_rpc_driver
#soap.wiredump_dev = STDERR
userpw = { :username => "mylogin@sforce", :password => "mypassword" }
login_response = soap.login( userpw ).result
puts <<EOF
---
Session ID: #{login_response.sessionId}
Server URL: #{login_response.serverUrl}
---
EOF
soap.endpoint_url=(login_response.serverUrl)
# Now need to set the session ID in the soap header -- how?!!
# The following fails
nogo = soap.describeGlobal(login_response.sessionId)
The script produces the following output:
rex-walters-powerbook-g4-12:~/work/sforce rw$ ruby testsforce.rb
warning: peer certificate won't be verified in this SSL session.
---
Session ID: SGSSAAFAb_Vuupu...zi4=
Server URL: https://na1-api.salesforce.com/services/Soap/c/6.0
---
warning: peer certificate won't be verified in this SSL session.
#<SOAP::Mapping::Object:0x2de560>: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader (SOAP::FaultError)
The sforce documentation says that after logging in, you must change both the endpoint url (presumably for load balancing) and the sessionId in the SOAP header. I don't know how to do the latter. Neither do I know how to quiet the warning about the SSL certificate.
Any help will be greatly appreciated! It would be a tremendous win to start using rails with the sforce API.