You were on the right track with %WriteJSONFromObject(), but you'll want to use %WriteJSONStreamFromObject() instead. I don't see what purpose the Body property in your request class serves. You can just create a stream object variable instead.

set myTempStream=##class(%Stream.GlobalCharacter).%New()
set tSC=##class("%ZEN.Auxiliary.altJSONProvider").%WriteJSONStreamFromObject(.myTempStream, pRequest)
if $$$ISERR(tSC) {
    quit tSC
}

...then later:

Set tSC=..Adapter.PostURL(tURL,.tHttpResponse, , myTempStream)

A reference to the business process (our message router) that the DTL is being run from is stored in %Ensemble.("%Process") and you can use that to do a SendRequestSync.

Be sure to add lots of error handling. DTLs throwing strange errors can be a pain to troubleshoot.

    if '$D(%Ensemble("%Process")) {
        write "This doesn't work in DTL test mode",!
        quit $$$OK
    } else {
        #dim bp as Ens.BusinessProcess

        set req = ##class(Ens.Request).%New()

        set bp=%Ensemble("%Process")
        set tSC=bp.SendRequestSync("My.Operation",req,.resp)
        
        if $$$ISERR(tSC) {
            // Oops... error!
        }
        
        quit tSC
    }

Hi Yone,

I see two possible problems:

It seems like "Do ImagenMIMEPart.Body.Write(linea)" should be inside the while loop. No? In this case after the final read() linea may be empty and that is what is set as the content of the mime part.

While 'stream.AtEnd {
          Set linea=stream.Read()
      }
      $$$LOGINFO("linea: "_linea)
      //Escribir la imagen en el mensaje MIME
     Do ImagenMIMEPart.Body.Write(linea)

And here you are using a character stream to read the jpeg, but jpeg is a binary format. You'll want to use %Stream.FileBinary instead.

Set stream=##class(%Stream.FileCharacter).%New()
      Set sc=stream.LinkToFile("C:\Users\ext-ymorjim\Pictures\miSCS.jpg")

%K(-5) wouldn't take care of DST automatically. $ZDATETIMEH(myUTCTime, -3) will convert a $HOROLOG format (actually $ZTIMESTAMP format) value of UTC time into a $HOROLOG value in local time. So you can first use ConvertDateTime with %q(4) to convert to $ZTIMESTAMP format, then use $ZDATETIMEH with -3 to convert to local time, then use ConvertDateTime (or $ZDATETIME) to convert the $HOROLOG format back into a formatted date/time string.

https://docs.intersystems.com/healthconnectlatest/csp/docbook/Doc.View.c...

https://docs.intersystems.com/healthconnectlatest/csp/docbook/Doc.View.c...

Yes, this can be done through configuration and is a standard feature of the HL7 HTTP business operation (EnsLib.HL7.Operation.HTTPOperation).

Details on settings for the HTTP operation. Look in particular at SSLConfiguration:
https://docs.intersystems.com/healthconnectlatest/csp/docbook/Doc.View.c...

Details on creating an SSL/TLS config (with or without cert) to be used by the operation:
https://docs.intersystems.com/healthconnectlatest/csp/docbook/DocBook.UI...
 

Hi Adam,

I'm not familiar with XLT, so I don't have any examples of converting XLT to DTL.

Here's some more information on executing XSLT transformations from a BPL:
https://docs.intersystems.com/healthconnectlatest/csp/docbook/DocBook.UI...

Or you can execute an XSLT transformation directly from COS:
https://docs.intersystems.com/healthconnectlatest/csp/docbook/Doc.View.c...