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.

Tips
  1. Enable logging

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

    <script src="//cdn.jsdelivr.net/npm/scriptxprint-html@1/dist/meadco-scriptxservices.min.js"></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;
    	}
    </script>
    
  2. Use latest versions

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

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

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

      <script src="//cdn.jsdelivr.net/npm/scriptxprint-html@1/dist/meadco-scriptxservices.min.js"></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

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

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