2011-08-01 74 views
1

我在嘗試使用下面的代碼來測試SugarCRM的SOAP連接:SugarCRM的SOAP測試呼叫失敗

<? 
define('sugarEntry', TRUE); 
require_once('include/nusoap/nusoap.php'); 
$sugarclient = new nusoapclient('http://www.mycrmurl.com/soap.php?wsdl',true); 


echo $sugarclient->call('test', 'test string'); 
?> 

不幸的是,測試呼叫返回NULL。有關如何開始排除故障的想法?

回答

4

我不熟悉SugarCRM SOAP方法test,所以除非它是您自己定製的方法,否則我會嘗試一些簡單的有效調用。 (用Sugar CE 6.2測試)。

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

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

$loginParams = array('user_auth' => $myAuth, 'application_name' => 'MyApp'); 
$loginResult = $soapClient->call('login', $loginParams); 
$sessionId = $loginResult['id']; 
echo $sessionId; 
?> 

如果以上仍然給您的問題,請嘗試以下操作:

  • 查找在Web服務器日誌(是呼叫打通)
  • 啓用SugarCRM的記錄和級別設置爲調試
  • 啓用PHP錯誤輸出或將PHP日誌錯誤記錄到日誌文件中
  • 使用例如了SoapUI測試SOAP調用
  • 有關更詳盡的SOAP例如見question 5396302
  • 檢查SugarCRM SOAP documentation
1

這樣做:

$result = $sugarclient->call('test', 'test string'); 
echo print_r ($result); 

它將打印陣列的結果,如果你只是想看到錯誤的描述是這樣的:

$result = $sugarclient->call('test', 'test string'); 
echo $result['error']['description']; 

結果是一個多維數組。