How do I access the SCORM Engine import web services via HTTP requests?
We provide both Java and .NET versions of import web services, either of which can be accessed via HTTP requests. All you really need to do is know the location of your WSDL and then issue a GET or POST to the function you want to call. Here is a simple example of how to call ImportCourseFromFileSystemWithPackageId using a HTTP POST in ASP.NET:
<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>.NET Import Web Services Test</title> </head> <body> <form action="http://mycompany.tld/ScormEngine/ScormEngineInterface/ImportService.asmx/ImportCourseFromFileSystemWithPackageId" method="post"> <input name="filePathtoManifest" value="http://mycompany.tld/path/to/course/imsmanifest.xml" /> <input name="webPathtoCourse" value="http://mycompany.tld/path/to/course/" /> <input name="updateBy" value="tfo" /> <input name="serializedExternalPackageId" value="CourseId|123" /> <input type="hidden" name="serializedExternalConfig" /> <input type="submit" value="Enter" /> </form> </body> </html>
All we had to do was set up a form with inputs named to correspond to the signature of the web service. In this case, you'd need to know the path (web or file) to your manifest and to the root of the course directory (web path). In this example, I'm using the SCORM Engine Vanilla integration (an example integration we deliver with SCORM Engine) as the basis, so our serialized external package ID is CourseId, and I know we've got a CourseId of 123. The Vanilla integration doesn't have an external configuration, so I can just create a hidden, null form input, but I do need to include the input to avoid an exception.
A successful request in this case will yield an XML response. If the import is successful, the XML will clearly show that in the Message element. You'll see something like this:
<?xml version="1.0" encoding="utf-8" ?> <ImportResult xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.rusticisoftware.com/ScormContentPlayer/CentralInterface"> <ManifestFilePath>http://localhost/ScormEngine/ScormEngineInterface/golf</ManifestFilePath> <Title>Golf Explained - CP Single SCO - NEW VERSION</Title> <WasSuccessful>true</WasSuccessful> <SerializedExternalPackageId>CourseId|123!VersionId|3</SerializedExternalPackageId> <Message>Import Successful</Message> </ImportResult>
This is a result of a successful import of one of our SCORM sample courses.
Via HTTP, most invalid inputs will generate an exception from SCORM Engine and not deliver an XML response, so it's important to validate the response somehow.
We could just as easily modify the web form above to have used GET instead of POST. Either way, against IIS, you'd need to modify your web.config to include the following because IIS disables POST and GET requests for web services by default:
<system.web> <webServices> <protocols> <add name="HttpPost"/> <!-- or <add name="HttpGet"/> as necessary --> </protocols> </webServices> </system.web>
You can learn more about the various ways to import content here.