0

I'm using Salesforce Suite module.

My initial investigation says that the connection is encrypted via HTTPS.

Is there any easy way of debugging what is exactly sent to Salesforce?

I ended up by tracing the code via XDebug, but it's useless on environment which doesn't have it.

The module uses SalesforceSoapClient.

0

If you're using Ubercart / Salesforce Integration, you can use the following patch:

Drupal 6

--- a/uc_salesforce/uc_sf_order/uc_sf_order.module
+++ b/uc_salesforce/uc_sf_order/uc_sf_order.module
@@ -635,6 +635,7 @@ function uc_sf_order_export($order, $name, $sfid = NULL, $manual = FALSE) {
     // Export the object to Salesforce.
     try {
       $response = $sf->client->create(array($object), $map->salesforce);
+      drupal_alter('uc_sf_order', $response, $sf);
     }
     catch (Exception $e) {
       drupal_set_message(t('Error exporting order to Salesforce.'), 'error');
@@ -681,6 +682,7 @@ function uc_sf_order_export($order, $name, $sfid = NULL, $manual = FALSE) {
         }
         try {
           $product_responses = $sf->client->create($product_objects, $uc_order_products_fieldmap->salesforce);
+          drupal_alter('uc_sf_order', $product_responses, $sf);
         }
         catch (Exception $e) {
           sf_dpm($e->faultstring, 'Ubercart order line item exception');
@@ -718,6 +720,7 @@ function uc_sf_order_export($order, $name, $sfid = NULL, $manual = FALSE) {
       else {
         $user_object_export = salesforce_api_fieldmap_export_create($user_map_id, $account);
         $user_response = $sf->client->create(array($user_object_export), $user_map->salesforce);
+        drupal_alter('uc_sf_order', $user_response, $sf);
         $account_sfid = $user_response->id;
       }
     }

and then you can define the following function:

<?php
/**
 * Define debug constant
 * To activate, run: drush -y vset foo_debug 1
 */
define('FOO_DEBUG', variable_get('foo_debug', FALSE));

/**
 * Implements hook_TYPE_alter().
 */
function foo_uc_sf_order_alter($response, $sf) {
  $xml_request = $sf->client->getLastRequest();
  $xml_response = $sf->client->getLastResponse();
  FOO_DEBUG ? watchdog('foo', "UC Salesforce XML request/response:\n<br>Request:\n@req\n<br>Response:\n@res", array('@req' => $xml_request, '@res' => $xml_response), WATCHDOG_NOTICE) : NULL;
} 
?>

To activate debug messages, run the following drush command:

drush -y vset foo_debug 1

And run watchdog messages in foreground before your test:

drush watchdog-show --tail --full

Read more:

Add hook_alter for catching and debugging the requests and responses.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.