Thanks Jeffrey Drumm for your reply

We have observed that our Ensemble's version is:

Cache for UNIX (Red Hat Enterprise Linux for x86-64) 2017.2.1 (Build 801_3_18358U) Tue Jul 24 2018 16:36:10 EDT

It does not contain "RegexMatch" function in Ens.Util.FunctionSet

We have tried to develop a rule using Length and Contains functions

We would need to detect the following:

if at least one OBX3.1 is "24642" or at least one OBX3.5 = "24642"

What we have developed does not work, and we do not know why

Could you help us, please?

We have been testing, developing and debugging some hours, and we would really appreciate your time, replies, effort, and examples, please

The rule which does not work is:

Being the code:

<rule name="22 09 21 ADTs Antigenos DragoAE -&gt; DRAGOAP" disabled="true">
<constraint name="source" value="GestionPacientesFromSelenev02"></constraint>
<constraint name="msgClass" value="EnsLib.HL7.Message"></constraint>
<constraint name="docCategory" value="2.5"></constraint>
<when condition="(Document.{MSH:MessageType.TriggerEvent}=&quot;A08&quot;)&amp;&amp;(((Length(HL7.[OBX:3.1])=&quot;5&quot;)&amp;&amp;(HL7.[OBX:3.1] Contains &quot;24642&quot;))||((Length(HL7.[OBX:3.5])=&quot;5&quot;)&amp;&amp;(HL7.[OBX:3.5] Contains &quot;24642&quot;)))&amp;&amp;((Document.{OBX(1):ObservationResultStatus}=&quot;R&quot;)||(Document.{OBX(1):ObservationResultStatus}=&quot;C&quot;))">
<trace value="&quot;Se permiten ADTs con código de Antígenos en OBX3.5 o OBX3.1 y con OBX.11 = &apos;R&apos; Creaciones o &apos;C&apos; Modificaciones&quot;"></trace>
<send transform="" target="EnrutadorTestAntigenos"></send>
<return></return>
</when>
</rule>

Could you help us?

Would you know why it does not detect that the OBX3.1 and OBX3.5 are "24642"?

Thanks for your time

Thanks David Hockenbroch for your help

We have written:

set ..HttpRequest.ContentType="application/octet-stream; name=nombre"
 do ..HttpRequest.SetHeader("name","nombre")

Being the full method as follows:

Method cargarFichero(fichero As %GlobalBinaryStream, ccaaId As EsquemasDatos.HistoriaClinica.tns.CCAAIdType(REQUIRED=1), tipoFichero As EsquemasDatos.HistoriaClinica.tns.TipoFicheroType(REQUIRED=1)) As EsquemasDatos.HistoriaClinica.tns.InfoFicheroType(XMLNAME="responseFichero") [ Final, ProcedureBlock = 1, SoapBindingStyle = document, SoapBodyUse = literal, WebMethod ]
{
  //Header - Addresing
 set addressing = ..crearAddressing()
 
 set addressing.Action = "cargarFichero"
 
 set ..AddressingOut                = addressing
 set ..AddressingOut.mustUnderstand = "1"

 //Firma el XML (mensaje SOAP)
 //do ..crearSignature()
 
 set ..MTOMRequired=1
 
 //24 09 21 para añadir parametro name en cabecera content type
 set ..ContentType="application/octet-stream; name=nombre"
 
 /*
     27 09 21 con el objetivo de poner parametro name en cabecera content type
 */
 set ..HttpRequest.ContentType="application/octet-stream; name=nombre"
 do ..HttpRequest.SetHeader("name","nombre")
 
 Quit ..WebMethod("cargarFichero","CargarFicheroVacuRequest").Invoke($this,"http://ws.regvacuWs.ms.es/FicheroVacu/cargarFichero",.fichero,.ccaaId,.tipoFichero)
}

When we execute it, Ensemble throws an exception in the message viewer:

➡️ ERROR #5001: <INVALID OREF>zcargarFichero+16^WSCLIENTE.HistoriaClinica.FicheroVacuServiceSOAP.1

We think it means that the variable "HttpRequest" is an invalid oref

How could we continue?

What steps would you recommend us to add the parameter "name" inside "Content-Type" header when we send a MTOM attachment using a SOAP request?

Thanks for your time, answers and help 💭

Thanks Sean Connelly for your time and help answering to us

We have written:

Method cargarFichero(fichero As %GlobalBinaryStream, ccaaId As EsquemasDatos.HistoriaClinica.tns.CCAAIdType(REQUIRED=1), tipoFichero As EsquemasDatos.HistoriaClinica.tns.TipoFicheroType(REQUIRED=1)) As EsquemasDatos.HistoriaClinica.tns.InfoFicheroType(XMLNAME="responseFichero") [ Final, ProcedureBlock = 1, SoapBindingStyle = document, SoapBodyUse = literal, WebMethod ]
{
  //Header - Addresing
 set addressing = ..crearAddressing()
 
 set addressing.Action = "cargarFichero"
 
 set ..AddressingOut                = addressing
 set ..AddressingOut.mustUnderstand = "1"

 //Firma el XML (mensaje SOAP)
 //do ..crearSignature()
 
 set ..MTOMRequired=1
 
 //24 09 21 para añadir parametro name en cabecera content type
 set ..ContentType="application/octet-stream; name=nombre"
 
 Quit ..WebMethod("cargarFichero","CargarFicheroVacuRequest").Invoke($this,"http://ws.regvacuWs.ms.es/FicheroVacu/cargarFichero",.fichero,.ccaaId,.tipoFichero)
}

However when we output the LOGSOAP we observe:

Output from Web client with SOAP action =http:// [endpoint]/cargarFichero
----boundary2247.8235294117647062276.235294117647059--
Content-Type: application/xop+xml; type="text/xml"; charset="UTF-8"
Content-Transfer-Encoding: 8bit
Content-Id: <0.E238359C.1D35.11EC.923C.005056B672A4>

    <?xml version="1.0" encoding="UTF-8" ?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:s='http://www.w3.org/2001/XMLSchema' xmlns:wsa='http://www.w3.org/2005/08/addressing'>
        <SOAP-ENV:Header>
            <wsa:Action>cargarFichero</wsa:Action>
            <wsa:MessageID>e236513c1d3511ec923c005056b672a4</wsa:MessageID>
            <wsa:ReplyTo>
                <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
            </wsa:ReplyTo>
            <wsa:To>https://[endpoint]?wsdl</wsa:To>
        </SOAP-ENV:Header>
        <SOAP-ENV:Body>
            <CargarFicheroVacuRequest xmlns="http://[endpoint]">
                <fichero>
                    <xop:Include href="cid:1.E238359C.1D35.11EC.923C.005056B672A4" xmlns:xop="http://www.w3.org/2004/08/xop/include"/>
                </fichero>
                <ccaaId>01</ccaaId>
                <tipoFichero>2</tipoFichero>
            </CargarFicheroVacuRequest>
        </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
----boundary2247.8235294117647062276.235294117647059--
Content-Id: <1.E238359C.1D35.11EC.923C.005056B672A4>
Content-Transfer-Encoding: binary
CONTENT-TYPE: application/octet-stream

;;;47B7F6BF1C6D [... csv file content ...]

As you would observe in the LOGSOAP, the request is sending the headers as: "CONTENT-TYPE: application/octet-stream"

We would need to send:

Content-Type: application/octet-stream; name=1.E238359C.1D35.11EC.923C.005056B672A4

Content-Disposition: attachment; name="1.E238359C.1D35.11EC.923C.005056B672A4"; filename="1.E238359C.1D35.11EC.923C.005056B672A4"

Because it is being expected by the receiver system, to include the parameter "name" inside the header "Content-Type", as is shown in the next image:

How could we achieve this feature?

Would you recommend us some guide or documentation, to read about this topic?

Are there any examples that could help us?

Thanks in advance

Thanks Julius Kavay for your reply

Your contribution has helped us a lot, thanks, sincerely thanks.

Specially we thank you for your explanation it was very helpful!

Thanks

Hello Eduard thanks for your reply

msg is a %GlobalCharacterStream

it is defined before, here is the code:

                            set msg=##class(%GlobalCharacterStream).%New()
                            if ('tSC) || (response.error '= "")||(response.informacion.mensaje '= "") {
                                do msg.Write("<br></br><H1>No existe el informe solicitado</H1>")
                            } else {
                                do ..Adapter.AssignOneSetting("Pdf","1","")
                                Do msg.Write($SYSTEM.Encryption.Base64Decode(response.datos.pdf))
                            }

Hello, thanks for your time reading our questions and doubts,

We have studied how to use the following data types: %Stream.TmpCharacter and %Stream.TmpBinary

We have used both as follows:

              

               set pOutput = ##class(%Stream.TmpBinary).%New()
                //set pOutput = msg
                while(msg.AtEnd=0){
                    do pOutput.Write(msg.Read())
                }
                do msg.Clear()
                Quit $$$OK
 
                do pOutput.Clear()
                $$$LOGWARNING("Despues de borrar en el Servicio: pOutput.Clear()")

However we still observing a .stream being created at: /opt/ensemble/ESBHCDSNS/stream

How could we delete a .stream which represents a pdf being returned from a REST Service to POSTMAN?

Thanks for your help 🙇‍♂️  and time reading our questions and code ⌚️

➡️ We would need some help if you could explain to us how would you recommend to delete a .stream in a REST Service? , please.

We have also read:

https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...

https://docs.intersystems.com/irislatest/csp/documatic/%25CSP.Documatic....

https://docs.intersystems.com/irislatest/csp/documatic/%25CSP.Documatic....

https://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?...

Thanks Eduard Lebedyuk because you gave as a detailed explanation