2011-03-22 60 views
2

在關於使用SOAP連接到糖CRM,對糖6.1社區版的文檔指出:SugarFullTest_Version2.php在哪裏? (糖CRM和SOAP)

「關於使用更多的例子見/examples/SugarFullTest_Version2.php。」

源: http://developers.sugarcrm.com/docs/OS/6.1/-docs-Developer_Guides-Sugar_Developer_Guide_6.1.0-Chapter%202%20Application%20Framework.html#9000244

此文件不是在實施例中的文件夾。它在哪裏?

如果此文件不存在,我可以在哪裏找到使用SOAP連接到Sugar CRM的工作示例?/examples /文件夾中的測試腳本都不起作用。

回答

1

無法找到該文件,因此爲您製作了一個示例(連接到sugarCRM v6 SOAP的PHP腳本)。

<?php 
require_once('include/nusoap/lib/nusoap.php'); 

$myWsdl = 'http://mysite.com/soap.php?wsdl'; 
$myAuth = array(
    'user_name' => 'xxxx', 
    'password' => MD5('xxxx'), 
    'version' => '0.1' 
); 
$soapClient = new nusoap_client($myWsdl,true); 

// Create lead 
// (Can be made without login, i.e. sessionid) 
$leadParams = array('user_name' => 'xxxx', 
    'password' => MD5('xxxx'), 
    'first_name' => 'Test', 
    'last_name' => '2', 
    'email_address' => '[email protected]' 
); 
$leadResult = $soapClient->call('create_lead', $leadParams); 
$leadId = $leadResult; 
print_r($leadResult); 

// Login 
$loginParams = array('user_auth' => $myAuth, 'application_name' => 'WebForm'); 
$loginResult = $soapClient->call('login', $loginParams); 
$sessionId = $loginResult['id']; 

// Modules 
// (Need login, so sessionID is used) 
$modulesResult = $soapClient->call('get_available_modules', array('session' => $sessionId)); 
print_r($modulesResult); 

// Get account list 
$accountParams = array('session' => $sessionId, 
    'module_name' => 'Accounts', 
    'query' => "accounts.name = 'Amarelo'", 
    'order_by' => '', 
    'deleted' => 0 
); 
$accountResult = $soapClient->call('get_entry_list', $accountParams); 
print_r($accountResult); 

// Get entry 
$leadParams = array('session' => $sessionId, 
    'module_name' => 'Leads', 
    'id' => "$leadId" 
); 
$leadResult = $soapClient->call('get_entry', $leadParams); 
print_r($leadResult); 

// Logout 
$logoutResult = $soapClient->call('logout', array('session' => $sessionId)); 
?> 

對於調試和測試SoapUI是非常有幫助的。