Assuming response1 json ALWAYS contain a single entry, then:

    ; import stream into Dynamic Object
    Set Response1=##class(%DynamicObject).%FromJSON(response1.informesAutorizadosRangoFechas)
    Set Response2=##class(%DynamicObject).%FromJSON(response2.informesAutorizadosRangoFechas)
    Write "Response1 has ",Response1.entry.%Size()," entries",!
    Write "Response2 has ",Response2.entry.%Size()," entries",!

    ; loop all the entries in Response2
    Set EntryIter=Response2.entry.%GetIterator()
    While EntryIter.%GetNext(.EntryKey, .Entry) {
        Write "Response2, entry ",EntryKey+1," has ",Entry.resource.%Size()," resources",!

        ; loop all resources within Entry
        Set ResourceIter=Entry.resource.%GetIterator()
        While ResourceIter.%GetNext(.ResourceKey, .Resource) {

            ; add resource from Result2 in first entry of Result1
            Do Response1.entry.%Get(0).resource.%Push(Resource)  
    Write "Merged Response1 has ",Response1.entry.%Get(0).resource.%Size()," resources",!

Using your samples the output is:

Response1 has 1 entries
Response2 has 7 entries
Response2, entry 1 has 1 resources
Response2, entry 2 has 1 resources
Response2, entry 3 has 1 resources
Response2, entry 4 has 1 resources
Response2, entry 5 has 1 resources
Response2, entry 6 has 1 resources
Response2, entry 7 has 1 resources
Merged Response1 has 8 resources

The resulting json is different than your manual merge.......

In %Stream.* classes setting the Filename property corresponds to calling the LinkToFile() method (see FilenameSet() method).
From LinkToFile() documentation:

The method as its name suggests creates a LINK to an EXISTING file.
Also note that if there is currently some temporary data in the old stream when the LinkToFile is called this temporary data will be removed before the stream is linked to this filename.

I think you have two options:

  1. set Filename BEFORE writing to the stream
  2. when you need to save a stream to a specific file, create a new file stream and use CopyFrom() method to copy existing data

For option 2 here is a sample (using %Stream.TmpBinary for the temporary stream):

set tStream = ##class(%Stream.TmpBinary).%New()
do tStream.Write("whatever stream contains")
set finalStream = ##class(%Stream.FileBinary).%New()
set finalStream.Filename="c:\temp\streamtest.txt"
do finalStream.CopyFrom(tStream)
write finalStream.%Save(),!

I noticed that some of the functions in your system are not IRIS built-in function but, evidently, are custom functions implemented in your system, as documented here.

To search and find the class and code that implement this functions you may search classes that extends the Ens.Rule.FunctionSet class using the class reference in your system/server, not in the documentation website.

I'd implement a custom datatype, something like:

Class Community.dt.IntJSON Extends %Integer

Parameter JSONTYPE = "string";
ClassMethod JSONToLogical(%val As %String) As %Integer [ CodeMode = expression, ServerOnly = 1 ]

ClassMethod LogicalToJSON(%val As %Integer) As %String [ CodeMode = expression, ServerOnly = 1 ]


Then in your class:

Class Community.json.TestDT Extends (%RegisteredObject, %JSON.Adaptor)

Property something As Community.dt.IntJSON(DISPLAYLIST = ",OK,Error,Warning", VALUELIST = ",0,1,2") [ InitialExpression = 0 ];

ClassMethod RunMe()
      set obj = ..%New()
      set obj.something = 2
      do obj.%JSONExportToString(.string)
      write "JSON : " _ string,!

      write "Content  : " _ ..somethingLogicalToDisplay(obj.something),!!

      set obj2=..%New()
      do obj2.%JSONImport(string)
      write "Imported something value: ",obj2.something,!



EPTEST>d ##class(Community.json.TestDT).RunMe()
JSON : {"something":"Warning"}
Content  : Warning
Imported something value: 2

I manage systems that use IIS since more than 15 years and never experienced performance issues.

For a code that takes 15ms having service/call that takes 40ms total round trip to me is way too much (that's 25ms overhead !!).
We have SOAP services that respond in 10ms (local subnet, round trip measured from the caller/client).

I don't recall any special configuration in IIS.

What's the configuration of the Web/CSP Gateway?