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 ( ...