Minor note, you don't need this line, remove it (it may be causing your error):

set sc = ##class(%ZEN.Auxiliary.jsonProvider).%ObjectToJSON(Object)

"Corrupt body: json: cannot unmarshal number into Go struct field CheckContractRequest.iin of type string". 

Where you get this error? This looks like an error you get from the server you send your request to.

Can you get output from

Set sc = httpRequest.Post("", 1) 

Set sc = httpRequest.Post("", 2)

And post it here.

I believe it's enough to have [Final] keyword set in deployed mode to give a developer a hint that this class should not be extended.

Well, it's mainly for developers who can't take a hint.

If you want to enforce this behaviour, I would add a check into each method as a first line , something like

if $this.%ClassName(1)'="My.Class" quit $$$ERROR(50000,"don't extend this class")

Good idea.

You can also try to add a method-generator, I believe when you have a deployed class with method generator it will not be able to compile a subclass without method generator's source (though I'm not sure).

At first it didn't work - method generator by default works while deployed. Then I added a class check to generator.  Compilation was now failing, but other methods were actually compiled so I was able to call them. Finally I worked out this solution:

Class Package.Final [ Final ]
{

ClassMethod ANoExtend() [ CodeMode = objectgenerator, Final, ForceGenerate, Private ]
{
    quit:%class.Name="Package.Final" $$$OK
    quit $$$ERROR($$$GeneralError, "No extending")
}

ClassMethod ProtectedMethod() As %Status [ Private, ForceGenerate, GenerateAfter = ANoExtend ]
{
        // code
    quit $$$OK
}
}

This way each protected method should be recompiled but only after method-generator which always fails in subclasses. This way no code gets generated.

Username would be _Ensemble because Ensemble switches users.

Tried OnInit, available context is not enough there:

Method OnInit() As %Status
{
    break
}

And here's the break:

break
 ^
<BREAK>zOnInit+1^Demo.Workflow.WFMetric.1
ENSDEMO 7e1>zw
 
%Ensemble("ArchiveFlags")=""
%Ensemble("ArchiveFlags","Demo.Workflow.WFMetric")=""
%Ensemble("ArchiveFlags","Demo.Workflow.WFMetric","iCfg")=0
%Ensemble("Config","%ModIndexFlag")=1
%Ensemble("ConfigName")="Demo.Workflow.WFMetric"
%Ensemble("Debug","TraceCat","My Terminal Output")=0
%Ensemble("Debug","TraceCat","My Terminal Output","user")=1
%Ensemble("Debug","TraceCat","user")=1
%Ensemble("DoTrace")=2
%Ensemble("JobKey")=10548
%Ensemble("LogSystemTrace")=0
<Private variables>

Thought about $zparent but it didn't help too:

ENSDEMO 7e1>w $system.Process.UserName($zparent)
CSP Gateway

If you're sure that your id bigger ids are generated later, you can only get the first id from index and after that iterate the data global directly:

set FromDateH = (+$h-1)
set id = ^TestI("StartDateIDX",FromDateH,id)
for {
    set id=$order(^TestD(id),1,dat)
    quit:id=""
    //dat=$lb("a","b","c","d","e")
}

Also you can use three-argument form of $order to iterate and get data in one command.

Finally, consider checking work-heavy system with %SYS.MONLBL to verify what lines consume more  time.

There are many ways to launch InterSystems IRIS.

If you want to launch it on AWS you can do it one of the following ways.

  1. Provision a EC2 instance with SUSE/RHEL/Ubuntu AMI and install InterSystems IRIS on Linux. Here's the guide. Quickstart.
  2. Provision a EC2 instance with SUSE/RHEL/Ubuntu AMI, install Docker and run InterSystems IRIS  in a container. Documentation. First Look.
  3. Use InterSystems Cloud Manager to provision AMI and run InterSystems IRIS. Documentation. First Look.

What to choose?

  • If you need to run a lot of or a variable number of servers choose 3.
  • If you're unfamiliar with Docker choose 1.
  • If you're familiar with Docker (or want to become familiar with it) choose 2.

It would be easier to start and finish the transaction in one method (or rather one request to a BO).

Why not send the request to BO containing a list of UPDATES to perform and BO would automatically wrap them in a transaction, returning either a success or error and the position of failed UPDATE statement? Even better send list of some struct and construct statements in BO.

While workarounds are possible (1 Job for BO + indefinite timeout + FIFO on caller part) it would probably be a bad idea.

You can call code from %Installer via Invoke tag (more on that).

To change journaling programmatically execute:

/// Change database journaling state.
/// dbDir - database Directory (can be passed relative to the current working dir)
/// journal - 1 or 0. 1 enables journaling, 0 disables it.
/// zw ##class(util.Test).JournalDB("USER", 1)
ClassMethod JournalDB(dbDir As %String, journal As %Boolean = {$$$YES}) As %Status
{
    quit:((journal<0) || (journal>3)) $$$ERROR($$$GeneralError, "Invalid journal value. 0 or 2 for No, 1 or 3 for Yes")
    set:journal=$$$YES journal=3
    set:journal=$$$NO journal=2

    new $namespace
    set $namespace = "%SYS"
    set db=##Class(SYS.Database).%OpenId(dbDir)
    set db.GlobalJournalState = journal
    quit db.%Save()
}

That said, any particular reason you want unjournaled databases?

Do you catch exceptions?

If not try this:

Try {
 Kill %objlasterror
 Set conn = ##class(%Net.Remote.Gateway).%New()  // No error here
 Set tSC = conn.%Connect("127.0.0.1", "55000", "NETTEST") // No error here
 Write:$$$ISERR(tSC) $System.Status.GetErrorText(tSC),!
 ZWrite %objlasterror 
 Set api = ##class(writetofile.WriteFile).%New(conn) //Here comes the error
 ZWrite %objlasterror 
 Set strFile = "d:\temp\example.txt"
 Set strInput = "Hello world"
 Set ret = api.FilePut(strFile,strInput)
 Set tSC = conn.%Disconnect()
 Write:$$$ISERR(tSC) $System.Status.GetErrorText(tSC)
} Catch ex {
 ZWrite %objlasterror
 Do ex.Log()
 Write ex.DisplayString(),!
}

%objlasterror  can contain more error information. Also check application error log.

Are you on 32 or 64 bits? Check Cache with:

Write $system.Version.Is64Bits()

.Net library should be compiled with the same architecture.