Question Michael Davidovich · Apr 23, 2025

I think I found my solution but I'm trying to understand better why it works. Forgive me as my descriptions here may be scattered but I'm trying to piece the puzzle together.

Scenario: I've found there are times when I make a request using a %Net.HttpRequest object and as I'm debugging and stepping through via the debugger in VSCode, if I try to access an object in the 'variables' menu, sometimes when I click that little expand button it will just spin and never load what's in the object to the viewer.

0
1 127
Question Michael Davidovich · Apr 17, 2025

I have see this discussed on the community but I'm not quite finding an answer. 

I have a method that is called in the OnPreHttp() method of a CSP page. That method returns a dynamic object and a set a new variable to the %ToJSON method of the object so I can use it in my JavaScript code later to init a table of data (using the #(variable)# syntax). This creates a MAXSTRING error. So I changed it to return a %Stream.TmpCharacter. But if I call Read($$$MaxStringLenght) I only get part of the data.

8
0 325
Question Michael Davidovich · Apr 10, 2025

Hello,

Our software commonly returns a full result set to the client and we use the DataTables plugin to display table data.  This has worked well, but at datasets grow larger, we are trying to move some of these requests server-side so the server handles the bulk of the work rather than the client.  This has had me scratching my head in so many ways.  

I'm hoping I can get a mix of general best practice advice but also maybe some IRIS specific ideas.

Some background

- I would admit our tables aren't best optimized for SQL in the sense that we don't utilize parent-child relationship in tables

6
0 224
Question Michael Davidovich · Dec 11, 2024

I have a primary dispatch class that implements %CSP.REST.AccessCheck() for some high level access checks before the route table forwards the request to the implementation classes which also implement %CSP.REST.AccessCheck() for some lower level access checks.  The idea is that we know where we are in the implementation class and what the user is trying to do, so it makes more sense to check some lower level items there rather than trying to parse out the request at the dispatch class.

The problem is the second, implementation level access check is not happening.

5
0 147
Question Michael Davidovich · Apr 24, 2024

Hello, I'm curious to see how other people deal with this: we have a text file that was created on someone's Windows machine and it was copied and pasted into a text file on someone's Mac machine.  After some examination we realized that the line feeds were originally CRLF (for Windows) and when copied and pasted they were changed to LF (Mac).  The diff program we used didn't pick up on this and the program we wrote to read the file was getting each line of the CRLF file and treating the whole file as one line for the LF file. 

I was able to use the text editor to change the LF file back to

2
0 335
Question Michael Davidovich · Mar 21, 2024

Hello,

I have my server setup a resource server.  When a user calls our API they submit a bearer token as authorization and in our dispatch class AccessCheck() we validate the JWT using ##class(%SYS.OAuth2.Validation).ValidateJWT()

If I include a scope to check in that method I get the error Scope check may only be done on requesting client and I'm not sure what this means. The method works without include the scope and will let me know if I have an unsigned token or an expired token.  

I noticed that the implementation of the method calls Set

5
0 387
Question Michael Davidovich · Sep 20, 2023

When making a synchronous request to a custom business process and there's an error and  0 is returned, it seems that the response is not sent back to the custom business service.  Rather, a Ens.MessageHeader with IsError=1 is returned without a message body (which would normally be the response object).

I tried using ##class(Ens.MessageHeader).%OpenId($$$JobCurrentHeaderId).IsError to check the error status but I keep getting the node that $$$JobCurrentHeaderId compiles to is undefined. There's clearly a Ens.MessageHeader object being sent back to the process, but I can't access it.

2
0 279
Question Michael Davidovich · Aug 21, 2023

A bit of an old school CSP question.  <csp:search> is a really nice, quick way to make easy lookups for CSP pages, especially for back office stuff that doesn't need to look pretty for the modern web app user.

At any rate, I'm here at the moment:

<csp:search SHOWSQL=1 NAME="OrgSearch" SELECT="OrganizationName Organization Name,Abbreviation,Software->Abbreviation Software" WHERE="OrganizationName Organization Name,Abbreviation,Software->Abbreviation Software" STARTVALUES=",,Software" PREDICATES="%startswith,%startswith,%startswith" CLASSNAME="AppLibrary.Organization" OPTIONS="popup"

3
0 235
Question Michael Davidovich · Aug 11, 2023

I have tried many methods from super classes of %CSP.REST but I can't find a method I can override that will run after the %response object is created so I can set a header that is common to each implementation method.  It's one line of code in each method to set the header but it would like to make it super easy, simple and just have a method that runs on, before, after the implementation method to set this common header (we want to return the API version in each responses HTTP headers.

Any ideas?

2
0 283
Question Michael Davidovich · Jul 18, 2023

I am hoping someone can let me know if I've gone down a dark path or not:

  • I'm using the record mapper to create a business service that waits for a .txt file and sets pipe delimited data to the mapper's record class
  • That record (essentially the raw data) is sent to a business process 
    • OnRequest() is implemented where it opens or creates an instance of the target object and validates and transforms and sets the data to the target object as needed; the response is that target object.
    • OnResponse() is implement as a shell and simply returns $$$OK
  • The goal is simply to update or create
3
0 523
Question Michael Davidovich · Jun 2, 2023

This is a bit of an IRIS question but also and OAuth 2.0 questions:

I am using %OAuth2.JWT.JWTToObject() to "validate" a JWT.  My questions:

- While I am checking claims with the returned body, does the return status of the method "count" as a validation step? In other words, if I weren't checking claims and $$$OK was returned from that method call (passing in the token and public keys), I could feel confident that this token came from the expected auth server?

- Does the method or can it validate the token expiration or is that something I need to manually validate; token expiration seems

4
0 396
Question Michael Davidovich · Apr 21, 2023

I have seen this post and appreciate that discussion: API RESTful Version | InterSystems Developer Community | Business Service

However our org requirement is for a caller to provide the API version in the HTTP request header.  I am finding the cleanest way to route to the correct class using the header version.  My classes are setup as

API.Service.v1

API.Service.v2

Of course only v1 exists now but when v2 goes live on future day, API.Service.v2 will extend API.Service.v1 so we only have to override the method that changes or add a new method if needed.  

I thought I might be able to modify

2
0 364
Question Michael Davidovich · Mar 30, 2023

I am trying to write a message to a Kafta cluster programmatically (i.e. not in Ensemble or using a Production) using %External.Messaging.  I am consistently getting a 'topic not found error' even though I have created the topic on the cluster.  I dug into the client I created an when accessing the property KaftaClient.jclient.gateway I get the following output:

<THROW>%DispatchGetProperty+25^%Net.Remote.Object.1 *%Net.Remote.Exception <GATEWAY> com.intersystems.gateway.GatewayException com.intersystems.gateway.JavaGateway.dynamicExecuteGet(JavaGateway.java:3761) Field not found:

4
0 558
Question Michael Davidovich · Feb 28, 2023

Any ideas on why my %session.Data array would be wiped out after setting %response.Redirect in OnPreHTTP()?

Context: trying to implement a SSO patter for authorization code flow. I mention this because it's all I can really pinpoint as to what's changing. Typically a user logs in by providing their username/password and we validate in our database and set the %session.Data property with the user info.

8
0 1681
Question Michael Davidovich · Jan 31, 2023

When manually coding REST services and using GET /api/mgmnt/v1/:namespace/spec/:application/ to return an OpenAPI spec, how do you specify supported properties (OpenAPI Properties in Use | Creating REST Services | InterSystems IRIS Data Platform 2021.1) like responses, definitions, and information in paths like summary and description?

GET /api/mgmnt/v1/:namespace/spec/:application/ | Creating REST Services | InterSystems IRIS Data Platform 2022.2

Using a very basic manual REST service that returns a JSON string I get a pretty basic spec that is not really helpful when it comes to documentation.

7
1 401
Question Michael Davidovich · Nov 15, 2022

I am sending an HL7 message from a BPL transform operation to a business operation that uses EnsLib.HL7.Operation.FileOperation.  

The context is that our application queues up outbound data that the business service polls every minute. The objects in the queue are sent to the business process to transform and then to the operation to send outbound. My goal is to have the business operation inform the business process (by a response) that the message was sent and what the message identifier is.

3
0 404
Question Michael Davidovich · Nov 14, 2022
  • I have created a business service that uses an adaptor that I wrote by extending Ens.InboundAdapter (i.e. the ADAPTOR parameter is set to my custom adaptor  ).  
  • The OnTask() method of my adaptor polls our IRIS database to determine which records are ready to be sent out of our system to an external target system.
  • If the record is ready the OnTask() method creates an instance of the Business Service and then calls the OnProcess() method sending in the record as the input.
  • The Business Service is also a custom design that simple calls the business process using an async request. 

Original

2
0 522
Question Michael Davidovich · Oct 31, 2022

Sessions and specifically %session are paramount to our application to login users to the application (the Web Gateway user logs into the server and then users login to the application).  

When using /api/mgmnt/v2 to implement a spec first approach to REST API development, I am unclear how I can utilize sessions (i.e.%session) to work with our existing model (and I'm sure there are indeed better ways to do this, but we are just baby stepping right now).Much of the documentation say to make sure UseSession=1 in the dispatch class is set, which I've accomplished.

11
0 559
Question Michael Davidovich · Aug 26, 2022

Hello,

I'm using CircleCI to spin up the image `store/intersystems/irishealth-community:2021.2.0.649.0`.

When building the application we are getting messages that say:

ERROR #5373: Class 'EnsLib.HL7.Message', used by 'Package.Class', does not exist
Skip class Package.Class

Other missing classes seem to include, but not limited to:

Ens.BusinessProcessBPL
Ens.BusinessService
EnsLib.RecordMap.ComplexChild
EnsLib.EDI.XML.Document
Ens.Request

Binding to a port and looking the management portal, it seems we have the namespace HSLIB and some classes:

As far as we understand, these classes should be available

19
0 554
Question Michael Davidovich · Aug 16, 2022

Have a Zen report with a huge query that we are trying to break down and be more efficient.  

Looks like Zen only wants to take a result set class as the data (or XML, but writing to a file to generate these reports is probably even more overhead).

Is there a way I can move through a result set object, delete rows I don't want based on some objectscript commands and the pass that to the report?

Or can I pass a dynamic object?

Thanks.

3
0 350
Question Michael Davidovich · Aug 12, 2022

Does anyone have experience with CircleCI or really any automation tool using %UnitTest?

I have built my app and ran my unit test in a Docker container automated by CircleCI.  However, after many of the tests failed I see:

How do you halt out of the IRIS session and return an exit code to the shell?

I have a script in my repo that I pass into IRIS after CircleCI does the code checkout

iris session IRIS < inFile

Am I trying to approach this the wrong way? Should I be writing test output to a file or something?

8
0 571
Question Michael Davidovich · Jul 29, 2022

What are other's thoughts, opinions and experiences going from CSP to RESTful services, specifically when it comes to reusing code in CSP files?

One could define a method in CSP as follows:

<script language="cache" method="SubmitSomethingAwesome" arguments="aswesomeId:%Numeric"> 

And it's generated in csp.mycsppage.cls ascsp.mycsppage.SubmitSomethingAwesome(awesomeId as %Numeric).

Have people had success defining there rest call by calling the generated CSP classmethod?

Things that work well I've found:

- Procedure block is off so you can easily pass the symbol table around from the REST

3
0 538
Question Michael Davidovich · Jul 27, 2022

After some trials, I am comfortably on my way developing spec first REST APIs using /api/mgmt/, OpenAPI 2.0, testing with Postman.

My question is related to scaling up.

Assume these things:

- Our software is CSP web app and it's web application is '/csp/application'

- I created a new REST enabled web app called '/csp/application/v1' and for my first API I created a spec that defines an endpoint /getTeapots so the endpoint is localhost/csp/application/v1/getTeapots

- Using the /api/mgmt/ endpoint, I loaded the spec into API.TeapotLibrary

- The dispatch class in '/csp/application/v1' thus is

6
0 562
Question Michael Davidovich · Jul 26, 2022

I have successfully created REST service classes on my local IRIS server following this book: Using the /api/mgmnt/ Service | Creating REST Services | InterSystems IRIS Data Platform 2021.2

I am now 1) trying to edit impl.cls in VS Code and 2) export it to my local repo so I can push to the remote repo.

When I click on my project in VS Code and 'Add to project' and choose the new package, spec.cls and impl.cls, I get the following error:

ERROR #5540: SQLCODE: -114 Message: Unable to acquire lock for INSERT of child row for parent table '%Studio.Project' with parent id = 'Default_project'

Has

12
0 447
Question Michael Davidovich · Jun 6, 2022

Hi there,

I'm passing a JSON object to the server as such:

{"key":"value","key":"value","key":"value"}

From the client:

- Build object

object=JSON.stringify(object)

-pass to server side method as %String

On the server:

s object={}.FromJSON(object)

Instead of getting something like

object=<OBJECT REFERENCE>[2@%Library.DynamicObject]

I get

object="991@%Library.DynamicObject"

I can't access that object using %Get as if says invalid OREF.

I've set the object passed a string to a global and debugged a bit on command line and was successfully able to convert to a dynamic object and use the %Get method to get the

5
0 489
Question Michael Davidovich · May 18, 2022

Continuing on the journey of implementing %UnitTest, @Timothy Leavitt's Test Coverage package, and automated testing with Jenkins.

My question today: why do we utilize a unit test root directory?  

I've been defining packages and classes to write unit tests as I've been developing and I run the tests on the command line or using a routine file that is setup as a debug target which has been working great.  I use DebugRunTestCase() to do this (so the classes aren't deleted).  

As I am playing with automating this on Jenkins, I'm not understanding exactly why we just don't keep and run them on the

4
1 608
Question Michael Davidovich · May 13, 2022

We are experience this with our own web app and even the demo/template here: intersystems-community/iris-fullstack-template: This template shows you how to build, test and deploy a simple full-stack application using InterSystems IRIS REST API (github.com)

When changes are made to CSS or HTML files, we can see the changes are saved to file in the Docker container by visiting the command line.  However, after refreshing, clearing cache, etc. the changes don't appear on the web application in the browser.  Viewing the source css in the browser, we see it's the old file.  

Had a minor success

7
0 323
Question Michael Davidovich · Apr 22, 2022

I am referencing the documentation here: https://docs.intersystems.com/ens201815/csp/docbook/DocBook.UI.Page.cls…

I have embedded html within a <script language="cache" runat="server"> block.  Within that I'm defining and using a macro, but it doesn't display at all. Something like:

<script language="cache" runat="server"> 
s stringData=obj.data 
#Define displayString stringData 
&html< 
<p>$$$displayString</p> 
> 
</script>

If I 'w $$$displayString' outside of the embedded html, the string is written to the page as expected so I know the Macro is being

2
0 359
Question Michael Davidovich · Apr 5, 2022

The documentation suggests this method for calling server side methods via SUBMIT: https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KE…

Following that, the form I'm submitting needs to validate the dates entered (the startDate isn't past the endDate).  

Trying to keep everything in the .CSP file, I add a tag:

<script language="Cache" method="Validate" arguments="startDate:%Date,endDate:%Date">

I'm able to validate the dates here, but not matter what I do (quit, return false, redirect) the code that runs on the SUBMIT goes:

<script language="Cache

8
0 399