【问题标题】:Getting error during Salesforce integration in PHP在 PHP 中的 Salesforce 集成期间出现错误
【发布时间】:2014-03-18 04:23:40
【问题描述】:

我在 PHP 中调用 Salesforce Web 服务时收到此错误 " Ooop! Error: Element {}item invalid at this location "

以下是我的方法:

require_once('salesforceAPI/soapclient/SforceEnterpriseClient.php');
require_once('salesforceAPI/soapclient/SforceHeaderOptions.php');

$sfdc = new SforceEnterpriseClient();
$SoapClient = $sfdc->createConnection('enterprise.wsdl.xml');

$loginResult = false;

$loginResult = $sfdc->login(USER, PASSWORD . SECURITY_KEY);

$parsedURL = parse_url($sfdc->getLocation());
define("_SFDC_SERVER_", substr($parsedURL['host'], 0, strpos($parsedURL['host'], '.')));
define("_WS_NAME_", 'salesforceAPI/Ctest');
define("_WS_WSDL_", _WS_NAME_ . '.xml');
define("_WS_ENDPOINT_", 'https://' . _SFDC_SERVER_ . '.salesforce.com/services/wsdl/class/' . _WS_NAME_);
define("_WS_NAMESPACE_", 'http://soap.sforce.com/schemas/class/' . _WS_NAME_);

$client = new SoapClient(_WS_WSDL_);
$sforce_header = new SoapHeader(_WS_NAMESPACE_, "SessionHeader", array("sessionId" => $sfdc->getSessionId()));
$client->__setSoapHeaders(array($sforce_header));

$method = $client->__getFunctions();

$wsParams = array('accName' => 'dasarathi');

$client->cInsert($wsParams);

我不知道解决办法。

【问题讨论】:

    标签: php salesforce apex-code


    【解决方案1】:

    这是一个文件路径问题。以下为整改:

    define("_WS_NAME_", 'salesforceAPI/Ctest');
    
    // there is no such path http://soap.sforce.com/schemas/class/slesforceAPI/Ctest
    define("_WS_NAMESPACE_", 'http://soap.sforce.com/schemas/class/' . _WS_NAME_); 
    

    我刚刚重新声明了 WS_NAME 常量:

    define("_WS_NAME_", 'Ctest');
    

    【讨论】:

      猜你喜欢
      • 2013-06-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-08
      • 1970-01-01
      • 2014-11-06
      相关资源
      最近更新 更多