lib/rforce/binding.rb
# Call a method on the remote server.  Arguments can be
# a hash or (if order is important) an array of alternating
# keys and values.
Call a method on the remote server.  Arguments can be
a hash or (if order is important) an array of alternating
keys and values.
Call a method on the remote server . Arguments can be a hash or ( if order is important ) an array of alternating keys and values .
def call_remote(method, args)
      urn, soap_url = block_given? ? yield : ["urn:partner.soap.sforce.com", @url.path]
      expanded = ''
      @builder = Builder::XmlMarkup.new(:target => expanded)
      expand(@builder, {method => args}, urn)
      extra_headers = ""
      extra_headers << (AssignmentRuleHeaderUsingRuleId % assignment_rule_id) if assignment_rule_id
      extra_headers << AssignmentRuleHeaderUsingDefaultRule if use_default_rule
      extra_headers << MruHeader if update_mru
      extra_headers << (ClientIdHeader % client_id) if client_id
      if trigger_user_email or trigger_other_email or trigger_auto_response_email
        extra_headers << '<partner:EmailHeader soap:mustUnderstand="1">'
        extra_headers << '<partner:triggerUserEmail>true</partner:triggerUserEmail>' if trigger_user_email
        extra_headers << '<partner:triggerOtherEmail>true</partner:triggerOtherEmail>' if trigger_other_email
        extra_headers << '<partner:triggerAutoResponseEmail>true</partner:triggerAutoResponseEmail>' if trigger_auto_response_email
        extra_headers << '</partner:EmailHeader>'
      end
      request = (Envelope % [@session_id, @batch_size, extra_headers, expanded])
      @batch_size = DEFAULT_BATCH_SIZE
      request = encode(request)
      headers = {
        'Connection' => 'Keep-Alive',
        'Content-Type' => 'text/xml',
        'SOAPAction' => '""',
        'User-Agent' => 'activesalesforce rforce/1.0'
      }
      response = @server.post2(soap_url, request.lstrip, headers)
      content = decode(response)
      if method != :login and @session_id and content =~ /sf:INVALID_SESSION_ID/
        login(@user, @password)
        request = (Envelope % [@session_id, @batch_size, extra_headers, expanded])
        request = encode(request)
        response = @server.post2(soap_url, request.lstrip, headers)
        content = decode(response)
      end
      SoapResponse.new(content).parse
    end
def call_remote ( method , args ) urn , soap_url = block_given? ? yield : [ "urn:partner.soap.sforce.com" , @url . path ] expanded = '' @builder = Builder :: XmlMarkup . new ( :target => expanded ) expand ( @builder , { method => args } , urn ) extra_headers = "" extra_headers << ( AssignmentRuleHeaderUsingRuleId % assignment_rule_id ) if assignment_rule_id extra_headers << AssignmentRuleHeaderUsingDefaultRule if use_default_rule extra_headers << MruHeader if update_mru extra_headers << ( ClientIdHeader % client_id ) if client_id if trigger_user_email or trigger_other_email or trigger_auto_response_email extra_headers << '<partner:EmailHeader soap:mustUnderstand="1">' extra_headers << '<partner:triggerUserEmail>true</partner:triggerUserEmail>' if trigger_user_email extra_headers << '<partner:triggerOtherEmail>true</partner:triggerOtherEmail>' if trigger_other_email extra_headers << '<partner:triggerAutoResponseEmail>true</partner:triggerAutoResponseEmail>' if trigger_auto_response_email extra_headers << '</partner:EmailHeader>' end request = ( Envelope % [ @session_id , @batch_size , extra_headers , expanded ] ) @batch_size = DEFAULT_BATCH_SIZE request = encode ( request ) headers = { 'Connection' => 'Keep-Alive' , 'Content-Type' => 'text/xml' , 'SOAPAction' => '""' , 'User-Agent' => 'activesalesforce rforce/1.0' } response = @server . post2 ( soap_url , request . lstrip , headers ) content = decode ( response ) if method != :login and @session_id and content =~ / sf:INVALID_SESSION_ID / login ( @user , @password ) request = ( Envelope % [ @session_id , @batch_size , extra_headers , expanded ] ) request = encode ( request ) response = @server . post2 ( soap_url , request . lstrip , headers ) content = decode ( response ) end SoapResponse . new ( content ) . parse end
Call a method on the remote server.
Call a method on the remote server .
# Create XML text from the arguments. # Fill in the blanks of the SOAP envelope with our # session ID and the expanded XML of our request. # reset the batch size for the next request # gzip request #unless show_debug #  headers['Accept-Encoding'] = 'gzip' #  headers['Content-Encoding'] = 'gzip' #end # Send the request to the server and read the response. # decode if we have encoding # Check to see if INVALID_SESSION_ID was raised and try to relogin in # repackage and rencode request with the new session id # Send the request to the server and read the response.
method
<not_specific>
args
<not_specific>