Hello,
I've been trying to get SOAP calls to work in the latest version (community 5.0), and have run into a few difficulties. Most recently I spent several hours tracing my $sugar_config variable through all of the pages that are required from inside the soap.php file to figure out why my SOAP calls kept losing the information on how to login to my remote mySQL database. All of this information is stored in the config.php file as a variable called $sugar_config, and is referenced by a require in the entryPoint.php page.
The first problem I ran into is that the DBManagerFactory.php page, which is required further along in the entryPoint.php page, is calling the following line outside of its class declaration:
global $sugar_config;
This line is fine when calling from inside a function, but since it is outside of a function, it is wiping out the $sugar_config variable that already exists within the same scope. Is there any reason why this line should stay put? I've commented it out and now my variable can keep going until it runs into the following line in the entryPoint.php page:
$db = & DBManager :: getInstance();
This public static call to an uninstantiated class' function was losing the $sugar_config variable as well. I was thinking that I should be able to keep my $sugar_config variable alive through all the require calls that extend from soap.php, but somehow the $sugar_config variable loses scope and the getInstance function can't find it when it tries to pull it in using the global keyword. I was able to work around this problem by registering the $sugar_config variable in the $GLOBALS array. I put the following line of code into entryPoint.php right after the config.php file was required:
$GLOBALS['sugar_config'] = $sugar_config;
This workaround seems to force my $sugar_config array to make itself available to the DBManager class. Can anyone think of any reason why the configuration that comes with SugarCRM isn't working the way it was designed? I thought the SOAP setup should be able to work without too much intervention on my part, but am finding that I need to do a significant amount of debugging. If you've run into these problems as well and point me in the right direction in order to avoid similar pitfalls, I would appreciate it.
Sincerely,
Dan


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks