Accessing Web Services Using PHP



How do I access SCORM Engine web services using PHP? 


As with many issues in software development, there's more than one way to do it. We've found that one of the easiest ways (in fact, the only way we've ever done it) is to use the freely available NuSOAP SOAP toolkit for PHP. 

In most cases, it should be enough to download NuSOAP and put it somewhere in your PHP include path and then include it (e.g., include_once('nusoap.php')).

Once you've done that, you'll need to set up a SOAP client instance using the SCORM Engine WSDL. Doing this will look something like this:

$wsdl = 'http://mycompany.tld/ScormEngineInterface/services/ScormEngineManagerService?wsdl
$client = new nusoap_client($wsdl, true);


That example is using the Java interface to our web services. For more information on our web services interfaces (including .NET), see Option 2 in "The various ways of importing content".

Now you're ready to create a proxy class, which allows you to directly call methods from WSDL:

$proxy = $client->getProxy();


Finally, you can capture the result of your SOAP call. In the following example, we'll use one of our SOAP methods for importing a course:

$result = $proxy->ImportCourseFromFileSystemWithPackageId(
		'filePathToManifest' => 'http://localhost:8888/scorm/golf/imsmanifest.xml',
		'webPathToCourse' => 'http://localhost:8888/scorm/golf/',
		'updateBy' => 'tfo',
		'serializedExternalPackageId' => 'CourseId|123',
		'serializedExternalConfig' => 'ClientId|client1'


Note that you can't just treat ImportCourseFromFileSystemWIthPackageId as a function that just takes five arguments. E.g., this won't work:

$result = $proxy->ImportCourseFromFileSystemWIthPackageId(


In this example, a successful SOAP request will return a result containing the following fields:

  • description
  • formatted parser warnings
  • manifest file path
  • message: communications from SCORM Engine
  • parser warnings
  • serialized external package ID
  • title
  • was successful (a boolean indicating whether or not the import succeeded) 

If the request fails and you need more information, you can get an error message if available by calling $proxy->getError() and access debugging output by examining $proxy->debug_str.

Further Reading

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request
Powered by Zendesk