-->

SugarCRM SOAP test call fails

2019-08-04 05:46发布

问题:

I am attempting to test a SugarCRM Soap connection using the following code:

<?
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');
?>

Unfortunately, the test call returns NULL. Thoughts on how to begin troubleshooting?

回答1:

I'm not familiar with a SugarCRM SOAP method called test, so unless it's a custom method you made yourself, I'd try with some simple valid calls. (Tested with 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;
?>

If the above still gives you problems, try the following:

  • Look in the web server log (Is the call getting through)
  • Enable the SugarCRM logging and set the level to debug
  • Either enable PHP error output or make PHP log errors to a log file
  • Use e.g. SoapUI to test SOAP call
  • See question 5396302 for a more thorough SOAP example
  • Check the SugarCRM SOAP documentation


回答2:

Do this:

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

It will print the array result, if you just want to see the error description do this:

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

The result is a multidimensional array.



标签: soap sugarcrm