In this article I'll cover testing and debugging Caché web applications (mainly REST) with external tools. Second part covers Caché tools.
You wrote server-side code and want to test it from a client or already have a web application and it doesn't work. Here comes debugging. In this article I'll go from the easiest to use tools (browser) to the most comprehensive (packet analyzer), but first let's talk a little about most common errors and how they can be resolved.
Messages.log file contains lots of useful information about IRIS. Sometimes the file gets big, and it is not easy to get to the data I am interested to review. It would be nice to jump to a specific date and time we suspect a problem may have started.
I enjoy the challenge of being in a contest. Currently I participate in InterSystems IRIS with REST API Programming Contest. My idea for this contest was to create an app to help me keep track of tasks for my Status Reports. I started with the template provided by Evgeny Shvarov. I created a persistent class for Tasks and a REST Dispatch class. I defined my URL map and I even figured out how to test my REST app using Postman.
One useful feature of our REST framework is the ability for a dispatch class to identify request prefixes and forward them to another dispatch class. This approach of modularizing your URL map will improve code readability, enable you to easily maintain separate versions of an interface, and provide a means to protect API calls that only certain users will be allowed to access.
In the WRC, we frequently see customers contact us because their Web Gateway is unable to serve web pages. This article will explain a frequent reason why these errors can occur, and explain some tools which can be used to debug the problem. This explanation is focused on the Web Gateway serving InterSystems IRIS instances, but the same explanation should apply to the CSP Gateway serving Caché instances as well.
A key part of Application Performance Management (APM) is recording the activity and performance of user activity. For many web applications the closest you can get to this is to record the CSP pages or CSP based services being dispatched.
IRIS Interoperability Productions formerly known as Ensemble are fun to work with. Yes, I really think my work is fun. I have seen File Passthrough Services and File Passthrough Operations come in handy. At one point we placed test messages in files, then we utilized a File Passthrough Service with Inbound File Adapter to send the contents of the file as a Stream to a File Passthrough Operation with Outbound TCP Adapter.
If you are developing applications that use CSP or Zen, or potentially any of the other InterSystems web-related stuff that's built on top of CSP, then it's important to know how to keep one particular secret.
A central part of the CSP security architecture is a server-side session key. "Server-side" because its value should never be revealed to the client that is issuing the web requests. If it is revealed, a malicious client might be able to use it to bypass your security and make your server do things you don't want it to.
You can hide the source by exporting/importing only the *.obj that is generated after compiling the source program.
The command execution example specifies EX1Sample.obj and EX2Sample.obj, which are generated by compiling EX1Sample.mac and EX2Sample.mac, as export targets and exports them to the second argument file.
After moving to another namespace, I am using the exported XML file to perform the import.
We finished our last lesson with our Widgets Direct page receiving a Welcome message as a property of a JSON object, which was unpacked and displayed on the page. However, we are on Lesson 3, and we still haven't had any talk of displaying widgets yet.
ZPM is a great tool. You can compose a large WebApplication following the existing examples. But differently, to Classes, Routines, Macros, or Globals I found no direct way to deploy a few additional CSP pages directly into an existing Namespace without touching the existing content.
A side issue was to find a solution that is independent of WIN or Linux directories.
A few weeks ago I posted an announcement about a JavaScript-based interface for our mg_web WebServer interfacing addon module. mg_web isn't just restricted to use by JavaScript developers though. Many readers will be ObjectScript developers who are more used to using CSP as their web gateway. Some may even have much older legacy WebLink-based applications (and be wondering how to support them given that IRIS does not support WebLink).
At the end of our last lesson, we ended with our page displaying a nice (but garish) Angular Material Toolbar, and our Widget data displaying in a list of Material cards. Our page feels a bit static, and we already know that the large number of Widgets that we will be dealing with will not be especially usable on a static list. What can we do to help?
I just want to share with you the knowledge aka experience which could save you a few hours someday.
If you are building REST API with IRIS which contains more than 1 level of "/", e.g. '/patients/all' don't forget to add parameter 'recurse=1' into your deployment script in %Installer, otherwise all the second and higher entries won't work. And all the entries of level=1 will work.
/patients
- will work, but
/patients/all
- won't.
Here is an example of CSPApplicatoin section which fix the issue and which you may want to use in your %Installer class:
In this article, I will introduce my application iris-HL7v2Gen .
IRIS-HL7v2Gen is a CSP application that facilitates the dynamic generation of HL7 test messages. This process is essential for testing, debugging, and integrating healthcare data systems. The application allows users to generate a wide variety of HL7 message types, validate their structure against HL7 specifications, explore the message hierarchy, and transmit messages over TCP/IP to production systems. These features are particularly useful in settings where compliance with HL7 standards is mandatory for interoperability between different healthcare organizations or systems.
Application Features
Dynamic HL7 Message Generation: Instantly create HL7 messages for a range of message types, facilitating comprehensive testing.
Message Structure Exploration: Visualize the structure of generated messages based on HL7 specifications.
Value Set Visualization View predefined sets of allowable coded values for specific fields.
Message Validation: Validate messages against HL7 standards to ensure compliance.
TCP/IP Communication: Easily transmit messages to production using TCP/IP settings.
Broad Message Type Support: Supports 184 different HL7 message types, ensuring versatility for various healthcare integration needs.
ClassMethod: Generate a Test Message by Invoking a Class Method
Version Support: Currently Supports HL7 Version 2.5
Parallel query hinting boosts certain query performances on multi-processor systems via parallel processing. The SQL optimizer determines when this is beneficial. On single-processor systems, this hint has no effect.
Parallel processing can be managed by:
Setting the auto parallel option system-wide.
Using the %PARALLEL keyword in the FROM clause of specific queries.
I am configuring IIS to work with the CSP Gateway but I'm running into this error:
"The Module DLL 'C:\Inetpub\CSPGateway\CSPms.dll' could not be loaded due to a configuration problem. The current configuration only supports loading images built for a x86 processor architecture."
The Caché / Ensemble standard distribution contains in namespace SAMPLES a nice example of a CSP page consuming WebService as a Client. I have modified it not only to display the replies but to feed them back into a Global. I used the classic Hyperevent to achieve this. The replies end up as a log in global^WSREPLY. When there is no input anymore the page closes and goes away.
There are 2 versions with visible and hidden display during operation. dc.WSCSP.reverseVerbose.cls and dc.WSCSP.reverseHidden.cls
In the WRC, we often see customers who have encountered a problem viewing their SOAP Catalog pages in a browser. This article will explain why the error is being encountered, as well as suggest a fix. This explanation is focused on the symptoms seen in InterSystems IRIS, but similar behavior can be seen in more recent versions of Caché.
You can set individual error pages for the following Web Gateway error messages/system responses:
server error
server busy
server unavailable
server timeout
connection closed
Settings are made on the Web Gateway Management screen ([Management Portal] > [System Administration] > [Configuration] > [Web Gateway Management] > [Configuration] > [Default Parameters]).
In the Error Page section of the Default Parameters menu, set the filename of the html page to display or the URL to redirect to when an error occurs.