- Salesforce PHP SOAP API - Unable to get custom WebService working
- <pre>
- <?php
- define("SOAP_CLIENT_BASEDIR", "../soapclient");
- $USERNAME = '******@********' ;
- $PASSWORD = '******************************' ;
- require_once (SOAP_CLIENT_BASEDIR.'/SforcePartnerClient.php');
- require_once (SOAP_CLIENT_BASEDIR.'/SforceHeaderOptions.php');
- try {
- $mySforceConnection = new SforcePartnerClient();
- $mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/partner2.wsdl.xml');
- $loginResult = $mySforceConnection->login($USERNAME, $PASSWORD);
- $location = $mySforceConnection->getLocation();
- $session_ID = $mySforceConnection->getSessionId();
- $client = new SoapClient(SOAP_CLIENT_BASEDIR.'/CatalystWebservice.wsdl.xml');
- $sforce_header = new SoapHeader("http://soap.sforce.com/schemas/class/CatalystWebservice", "SessionHeader", array( "sessionId" => $session_ID ) );
- $client->__setSoapHeaders( array( $sforce_header ) );
- $client->makeContact("*****", "*****", "Address1", "Address2", "London", "****", "no-one@****", "0123456789", "07891236456", "New Build Homebuy", "This is my questionnnAnd an other line", "1", "Test");
- } catch (Exception $e) {
- print_r($e);
- }
- ?>
- </pre>
- SoapFault Object
- (
- [message:protected] => UNKNOWN_EXCEPTION: An unexpected error occurred. Please include this ErrorId if you contact support: ***********-*** (***********)
- [string:Exception:private] =>
- [code:protected] => 0
- [file:protected] => /home/******/public_html/********/test/partner.php
- [line:protected] => 23
- [trace:Exception:private] => Array
- (
- [0] => Array
- .....
- $response = $client->makeContact
- (
- array
- (
- "sLastName" => (string) $wpcf7_data->posted_data['last-name'],
- "sFirstName" => (string) $wpcf7_data->posted_data['first-name'],
- "sAddress1" => (string) $wpcf7_data->posted_data['address-one'],
- "sAddress2" => (string) $wpcf7_data->posted_data['address-two'],
- "sCity" => (string) $wpcf7_data->posted_data['town-city'],
- "sPostcode" => (string) $wpcf7_data->posted_data['post-code'],
- "sEmail" => (string) $wpcf7_data->posted_data['email-address'],
- "sPhone" => (string) $wpcf7_data->posted_data['telephone'],
- "sMobile" => (string) "",
- "sEnquiries" => (string) $wpcf7_data->posted_data['enquiry'],
- "sComment" => (string) $wpcf7_data->posted_data['comments'],
- "sPropertyID" => (string) wpcf7_special_mail_tag_for_post_data( "", "_post_id" ),
- "sPropertyName" => (string) wpcf7_special_mail_tag_for_post_data( "", "_post_title" ),
- )
- );