0

我是 Salesforce PhP 工具包的新手,需要帮助解决以下问题

当我尝试从家庭/外部 Internet 连接提交附件(到我在 Salesforce 中的个人文档)时,脚本按预期工作。
但是,当我尝试从 office/F5 网络发布相同的附件文件时,我看到

“致命错误:未捕获的 SoapFault 异常:[HTTP] 无法连接到主机,SforceBaseClient.php 位于第 167 行”。

尝试定义代理设置@ProxySettings.php(我在办公室使用)但没有运气......


在下面的代码片段中使用并尝试发布附件,我看到错误消息为“参数太少”,我在这里遗漏了什么吗?

$mySforceConnection = new SforceEnterpriseClient();
$mySforceConnection->createConnection("soapclient/enterprise.wsdl.xml");
$mySforceConnection->login(SF_USERNAME, SF_PASSWORD.SF_SECURITY_TOKEN);

// Create Document record
$document = new stdclass();
$document->Name = $_FILES['fileToUpload']['name'];
$document->type = 'Attachment';
$document->PARENTID = '5002XXXXXXXXXX';
//$document->FolderId = '012CXXXXXXXX'; // CHANGE THIS TO YOUR FOLDER ID!!!
$document->Description = 'Upload of '.$_FILES['fileToUpload']['name'];
$document->Body = base64_encode(file_get_contents($_FILES['fileToUpload']
['tmp_name']));

//$response = $mySforceConnection->create(array($document), 'Document');
$response = $mySforceConnection->create(array($document));
4

1 回答 1

1

是的,你有:

$mySforceConnection->login(SF_USERNAME, SF_PASSWORD.SF_SECURITY_TOKEN);

但应该是:

$mySforceConnection->login(SF_USERNAME, SF_PASSWORD, SF_SECURITY_TOKEN);

它认为 SF_Password.SF_Security_Token 都是一个,但它是两个独立的东西。这就是它过去对我有用的方式。不过我可能是错的,值得一试。

于 2017-06-19T17:56:47.673 回答