Debugging ScriptX.Services

Thoughts on debugging ScriptX.Services

If only code were perfect, each written line worked exactly as required and the whole worked too. These are thoughts on where to look to resolve problems, not necessarily on how to look.

Of course, the problem may reside in the ScriptX.Services implementation. We fix all reported problems as soon as is practical and all licensees are entitled to full support via email.

If you are having problems, contact us and our development team will respond.

Own code

All APIs return errors with an appropriate HTTP error (typically 500) and a text description in the response.

Using the browser developer tools and network monitoring will show the response from the server, this should give a good clue on the problem.

Note that all calls to ScriptX.Services for Cloud and for Windows PC must include a valid license identity in the authentication header of the http request. For ScriptX.Services On Premise the header is not required and any value given will be ignored as in this case it is the services installation itself that is licensed.

Using the Client libraries

The  ScriptX.Services Client Library provides a set of singleton instances to work with the ScriptX.Services API. The hierarchy implements useful behaviour to interact with the API at increasing levels of abstraction from the API.

The goal of the library is to bring an emulation of MeadCo's ScriptX.Add-on to working with MeadCo ScriptX.Services and this emulation is included in the library.

However, higher levels of the library can be used as convenience wrappers and functions to your own code.

Using ScriptX.Add on emulation

We strongly recommended that when using ScriptX.Addon emulation the  MeadCoScriptXJS Library is also used as this provides a number of useful features for obscuring the inevitable differences there are between the implementations of ScriptX.Add-on and ScriptX.Services. The emulation of the .Addon API with ScriptX.Services is excellent, but not perfect.

  1. Check the developer console

    Many development issues are logged to the developer console rather than reported as errors to the user.

    If “nothing appears to happen” check the developer console for messages, warnings and errors.

  2. Enable verbose logging

    By default the library does not log informational messages to the console. These can be enabled by including the following code after referencing the library:

    <script src="//"></script>
    <script type="text/javascript">
        // If ScriptX.Services client libraries have been loaded enable 
        // some more verbose logging to developer console (f12) for debugging purposes
    	if (typeof MeadCo === "object") {
    		MeadCo.logEnabled = true;
  3. Use latest versions

    Check that the latest versions of all components are being used - ScriptX.Services and any javascript libraries being used.

  4. Order of scripts is important

    If you are creating your own minimised package or are referencing each file individually, please note that the order of files is critical:

    <script src="meadco-core.js"></script>
    <script src="meadco-scriptxprint.js"></script>
    <script src="meadco-scriptxprinthtml.js"></script>
    <script src="meadco-scriptxprintpdf.js"></script>
    <script src="meadco-scriptxfactory.js"></script>
    <script src="meadco-scriptxprintlicensing.js"></script>
    <script src="meadco-secmgr.js"></script>

    Bad ordering of files or failure to include a required file will result in errors such as:

    "MeadCo.ScriptX.Print.PDF is not available to ScriptX.Services factory emulation."

  5. Verify license deployment details

    Double check the correct license GUID is being used. When using ScriptX.Services for Windows PC also verify that the path to the license file is either “warehouse” or the fullly qualified path to the license file.

    When coding a page for use by both ScriptX.Addon and ScriptX.Services ensure that both reference the correct license.

    Review License deployment.

  6. Verify use of libraries
    • A library should only be referenced once, for example:

      <script src="//"></script>
    • Do not include minimized and unminimized versions of files.

    • Do not include multiple packages, for example do not include meadco-scriptxservices.min.js and meadco-scriptxservicesprint.min.js

  7. Use network logging

    The libraries can eat/translate errors in a way that obscures the underlying problem.

    Using the browser developer tools and network monitoring will show the response from the server, this should give a good clue on the problem.

    If you find such a problem, contact us and our development team will look into improving behaviour.

  8. Review bare bones exemplar code

    Bare bones example 1 illustrates many common advanced features working with both ScriptX.Addon and ScriptX.Services for Windows PC from exactly the same script code.

    Bare bones example 2 illustrates printing with both ScriptX.Addon and ScriptX.Services for Windows PC from exactly the same script code but without the use of  MeadCoScriptXJS Library .