Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 26th, 2012  |  syntax: None  |  size: 2.86 KB  |  hits: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Salesforce PHP SOAP API - Unable to get custom WebService working
  2. <pre>
  3. <?php
  4. define("SOAP_CLIENT_BASEDIR", "../soapclient");
  5. $USERNAME = '******@********' ;
  6. $PASSWORD = '******************************' ;
  7. require_once (SOAP_CLIENT_BASEDIR.'/SforcePartnerClient.php');
  8. require_once (SOAP_CLIENT_BASEDIR.'/SforceHeaderOptions.php');
  9.  
  10. try {
  11.  
  12.     $mySforceConnection = new SforcePartnerClient();
  13.     $mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/partner2.wsdl.xml');
  14.     $loginResult = $mySforceConnection->login($USERNAME, $PASSWORD);
  15.  
  16.     $location = $mySforceConnection->getLocation();
  17.     $session_ID = $mySforceConnection->getSessionId();
  18.  
  19.     $client = new SoapClient(SOAP_CLIENT_BASEDIR.'/CatalystWebservice.wsdl.xml');
  20.     $sforce_header = new SoapHeader("http://soap.sforce.com/schemas/class/CatalystWebservice", "SessionHeader", array( "sessionId" => $session_ID ) );
  21.     $client->__setSoapHeaders( array( $sforce_header ) );
  22.  
  23.     $client->makeContact("*****", "*****", "Address1", "Address2", "London", "****", "no-one@****", "0123456789", "07891236456", "New Build Homebuy", "This is my questionnnAnd an other line", "1", "Test");
  24.  
  25. } catch (Exception $e) {
  26.     print_r($e);
  27. }
  28. ?>
  29. </pre>
  30.        
  31. SoapFault Object
  32. (
  33.     [message:protected] => UNKNOWN_EXCEPTION: An unexpected error occurred. Please include this ErrorId if you contact support: ***********-*** (***********)
  34.     [string:Exception:private] =>
  35.     [code:protected] => 0
  36.     [file:protected] => /home/******/public_html/********/test/partner.php
  37.     [line:protected] => 23
  38.     [trace:Exception:private] => Array
  39.         (
  40.             [0] => Array
  41. .....
  42.        
  43. $response = $client->makeContact
  44.                 (
  45.                     array
  46.                     (
  47.                         "sLastName" => (string) $wpcf7_data->posted_data['last-name'],
  48.                         "sFirstName" => (string) $wpcf7_data->posted_data['first-name'],
  49.                         "sAddress1" => (string) $wpcf7_data->posted_data['address-one'],
  50.                         "sAddress2" => (string) $wpcf7_data->posted_data['address-two'],
  51.                         "sCity" => (string) $wpcf7_data->posted_data['town-city'],
  52.                         "sPostcode" => (string) $wpcf7_data->posted_data['post-code'],
  53.                         "sEmail" => (string) $wpcf7_data->posted_data['email-address'],
  54.                         "sPhone" => (string) $wpcf7_data->posted_data['telephone'],
  55.                         "sMobile" => (string) "",
  56.                         "sEnquiries" => (string) $wpcf7_data->posted_data['enquiry'],
  57.                         "sComment" => (string) $wpcf7_data->posted_data['comments'],
  58.                         "sPropertyID" => (string) wpcf7_special_mail_tag_for_post_data( "", "_post_id" ),
  59.                         "sPropertyName" => (string) wpcf7_special_mail_tag_for_post_data( "", "_post_title" ),
  60.                     )
  61.                 );