The latest version of the PHP Toolkit for Netsuite web-services (2010_2 as of this writing) and all previous versions (as far as I know) assume that the $endpoint string and $myDirectory array are declared in global scope.
However, if in your code you load the tool kit inside of a class method or function, or you utilize PHP’s autoload function, it’s quite likely you’ll be seeing a frustrating error like this:
ComplexType reference was not found in directory. ComplexTypeName = Record
Here’s the good news: The solution to this problem is simple. Just declare each variable to be global before the value is set. For example, here’s what the first part of directory_v2010.2.php should look like:
global $endpoint; $endpoint = "2010_2"; global $myDirectory; $myDirectory = array ( ...
I had to add
global $myDirectoryto getNameSpace. However, I still got that exception thrown; because$myDirectoryis NULL when it runs through foreach in that function.Have you had any luck getting pass that?
@Luiz Sorry, we haven’t had that problem and we don’t have
global $myDirectoryin our getNameSpace function. What version of the PHPToolkit are you using?Thanks for posting this! Really saved me some time.