#Ensemble

23 Followers · 2.4K Posts

InterSystems Ensemble is a complete and easy-to-use integration platform that enables users to connect people, processes, and applications in record

time.

Learn more

Documentation

Question Yone Moreno · Jan 25, 2021

Hello,

We would be grateful if you could help us,

Our aim is to develop a method which retrieves an image stored in an external system, using a REST Operation

To upload the image we have the following code:

/// Operacion para gestionar el Registro imagen identidad digital en Tarjeta Sanitaria
Class Operaciones.REST.miSCS.miSCS Extends EnsLib.REST.Operation
{

Parameter INVOCATION = "Queue";

/// Subir la imagen del usuario
/// La documentación para crear este metodo es:
/// https://docs.intersystems.com/irisforhealthlatest/csp/docbook/Doc.View.cls?KEY=GNET_http#GNET_http_post_multipart
/// https://docs.intersystems.com/irisforhealthlatest/csp/docbook/Doc.View.cls?KEY=GNET_mime
Method SubirImagen(pRequest As Mensajes.Request.miSCS.SubirImagen, pResponse As Mensajes.Response.miSCS.SubirImagen) As %Library.Status
{
$$$LOGINFO("pRequest.imagen: "_pRequest.imagen) //Creamos Request y Response HTTP
Set httpRequest=##class(%Net.HttpRequest).%New()
set tResponse = ##class(%Net.HttpResponse).%New() // Generamos la parte que contiene a las demás partes, la "raiz", RootMIMEPart
    Set RootMIMEPart=##class(%Net.MIMEPart).%New()
    
    //Creamos la primera "subparte" con el expediente
    Set ExpedienteMIMEPart=##class(%Net.MIMEPart).%New()
    Set contentdisp="form-data; name=""expediente"""
    Do ExpedienteMIMEPart.SetHeader("Content-Disposition",contentdisp)
    Set ExpedienteMIMEPart.Body=pRequest.expediente
    //Do ExpedienteMIMEPart.SetHeader("Content-Type","text/plain") ; esto no se envia en POSTMAN
    
    //Asignamos la imagen
    //Esto si funciona (la guarda como jpg y al descargarla se ve)
    Set docStream=##class(%Stream.FileBinary).%New()
   //Set sc=docStream.LinkToFile("C:\InterSystems\avatar prueba.jpg")     // Esto no funciona (guarda el base64 directo, no el binario;
    // es decir, guarda lo mismo que enviamos desde POSTMAN)
    //set docStream = pRequest.imagen
    
    //Si ponemos pRequest.imagen como string, enviamos el base64 por postman y decodificamos aqui a binario si
    //guarda la imagen como jpg
    set binary = $system.Encryption.Base64Decode(pRequest.imagen)
    do docStream.Write(binary)
     
    // Instanciamos la segunda "subparte" con la imagen
    Set ImagenMIMEPart=##class(%Net.MIMEPart).%New()
    // Incluimos la imagen, el docStream, en la subparte MIME
    Do ImagenMIMEPart.BodySet(docStream)
    // Cabeceras
    Set ImagenMIMEPart.ContentType = "image/jpeg"
    Do ImagenMIMEPart.SetHeader("Content-Disposition","form-data; name=""imagen""; filename=""imagen.jpg""")
    
    
    // Insertamos las dos subpartes en la raiz
    Do RootMIMEPart.Parts.Insert(ExpedienteMIMEPart)
    Do RootMIMEPart.Parts.Insert(ImagenMIMEPart) // Creamos el MIME writer
    Set writer=##class(%Net.MIMEWriter).%New()     // Preparamos para enviar el mensaje MIME a la peticion HTTP
    Set httpRequest=##class(%Net.HttpRequest).%New()
    Set status=writer.OutputToStream(httpRequest.EntityBody)
    if $$$ISERR(status) {do $SYSTEM.Status.DisplayError(status) Quit}     // Escribimos el contenido del mensaje MIME en la peticion HTTP
    Set status=writer.WriteMIMEBody(RootMIMEPart)
    if $$$ISERR(status) {do $SYSTEM.Status.DisplayError(status) Quit} // Creamos la URL
set url      = ##class(Util.TablasMaestras).getValorMaestra("MISCS.PARAMETRIZACIONES","url")
set path     = ##class(Util.TablasMaestras).getValorMaestra("MISCS.PARAMETRIZACIONES","path")
set servicio = ##class(Util.TablasMaestras).getValorMaestra("MISCS.PARAMETRIZACIONES","servicio")
set recurso  = ##class(Util.TablasMaestras).getValorMaestra("MISCS.PARAMETRIZACIONES","subirImagen") set URL      = "http://"_url_path_servicio_recurso

$$$LOGINFO("URL: "_URL)
//Escribimos el tipo de contenido que enviamos en la raiz
Set httpRequest.ContentType="multipart/form-data; boundary="_RootMIMEPart.Boundary 
$$$LOGINFO("> httpRequest.ContentType: "_httpRequest.ContentType) //Enviamos al sistema externo
set tSC=httpRequest.Post(URL,0)
$$$LOGINFO("tSC: "_tSC) //Lanzamos excepcion si hubo error
if $$$ISERR(tSC){
$$$ThrowOnError(tSC)
}
//Obtenemos respuesta
set tResponse = httpRequest.HttpResponse //Leemos respuesta
if (tResponse.Data.AtEnd = 0) {
set linea = tResponse.Data.Read()
$$$LOGINFO("Linea: "_linea)
} //Rellenamos response
set pResponse = ##class(Mensajes.Response.miSCS.SubirImagen).%New()
set pResponse.resultado = 1
set pResponse.informacion = linea 
//Traducimos codigo del resultado, a descripcion
//set pResponse.informacion = ##class(Util.TablasMaestras).getValorMaestra("MISCS.CODIGOSTSI",linea) Quit pResponse
}

XData MessageMap
{
<MapItems>
  <MapItem MessageType="Mensajes.Request.miSCS.SubirImagen">
    <Method>SubirImagen</Method>
  </MapItem>
  </MapItems>
}
1
0 521
Question Scott Roth · Feb 4, 2021

We are getting more and more request wondering if we could send/receive data via HTTPS to the outside world from within our Hospital Network. As you can imagine our Ensemble/Cache productions are not exposed to the DMZ or has access outside of the network. We only communicate with external vendors through a VPN, so communicating not using a VPN is rather new to us.

Currently there is a project to get rid of using Proxy, and instead of through a Load Balancer that can use rules to filter out traffic, which adds another layer of complexity.

3
0 372
Article Julian Matthews · Feb 9, 2021 2m read

Hey everyone!

I recently learnt something new while working with WRC on an issue, and I wanted to share with everyone on the off chance it could help someone else.

Scenario:

Files are being inexplicably written to a folder on your server and, due to the number of files in the folder and general system throughput, it is not possible to work through the files to track down the source.

0
0 502
Question Scott Roth · Jan 7, 2021

I need another set of eyes to look at the following. Instead of a Data Lookup table, I wanted to try to lookup a value against a Cache table that I had build. So I thought I could write a function to run a simple SQL query against the Cache Table and return me a %Boolean value back to my routing rule. However today I found that it was not working properly.

Can someone take a look at the following method and verify that I am doing this correct?

4
0 555
Question Martin Browne · Feb 3, 2021

Hi,

I have a PV1 repeating field that can contain multiple or a single value. I'd like to always pull the last value in the field but am not sure how to configure this in my DTL.

The repeating field is in PV1:50().1

Could somebody shed some light on this?

Examples:

|15081942~15081951~15108961~15280550|

|15081947|

|15081939~15081940|

Thanks

5
0 494
Job João Henrique de Sá · Feb 4, 2021

*Analista Ensemble Júnior / Pleno

Próximo Metrô Clínicas

REQUISITOS:
* Conhecimento em barramento e protocolos RESTFull / SOAP 
* Integração com banco de dados Oracle / SQL Server

ATIVIDADES:
* Integração de sistemas hospitalares
* Administração do ambiente Ensemble
* Análise de Dados

Enviar CV com pretensão salarial
.

Contratação CLT ou PJ tempo indeterminado

Empresa ..................: JHealth Informatics
Email ........................: rh@jhealth.com.br

0
0 196
Question Shengzhi Wu · Feb 1, 2021

Hi ! 

There is a BusinessService be called by several callers,but now I get this error below on Event Log page:

<Ens>ErrGeneral: Failed to create document from string:

ERROR #6301: SAX XML Parser Error:processing instruction cannot start with 'xml'
while processing Anonymous Stream at line 1 offset 106

What may be the cause of this error?

How can I locate the parameter that caused this error?

3
0 1593
Question Yone Moreno · Jan 28, 2021

Hello,

We would need some help,

Our aim is to send an image as binary data using a REST Service

Currently we do the following:

1 We get from the external system a binary image in our REST Operation

2 We encode it to Base64

set linea=""
    while (tResponse.Data.AtEnd = 0) {
        set linea = linea_$system.Encryption.Base64Encode(tResponse.Data.Read(57))
    }

3 We send it to the Process in a Response Message:

Class Mensajes.Response.miSCS.ConsultarImagen Extends Ens.Response
{

Property resultado As %Boolean;

Property informacion As %String(MAXLEN = "");

Property binario As %Stream.GlobalBinary;

// Property binario As %Stream.FileBinary;

// Property binario As %GlobalCharacterStream;

// Property binario As %Stream.TmpCharacter;

Property error As EsquemasDatos.Seguridad.Error;
4
0 1186
Question fajie xie · Jan 27, 2021

许可证检测中,当前许可证使用达到100%,我们应该如何迅速处理解决它?并且不影响生产环境。
In license detection, the current license usage reaches 100%. How can we deal with it quickly? And does not affect the production environment.

5
0 477
Question Dean Russell · Jul 11, 2018

Hi,

We are having an issue with the class %Net.SSH.Session - it accepts a username, publicKeyFile, privateKeyFile and passPhrase.

This is our example code:

            set ssh = ##class(%Net.SSH.Session).%New()

            set tSC = ssh.Connect("172.10.10.1", 22)

            $$$ThrowOnError(tSC)

            set Username = "a"

            set passphrase = "123"

            set pub = "C:\FTPServer\pubkey\publicKey.pub"           

            set priv = "C:\FTPServer\private.key"

            set tSC = ssh.

6
2 19543
Question xing chen · Jan 27, 2021

When the started service component cannot be shut down correctly in the foreground, can you terminate the service by ending the task manager process? Will it affect the correct operation of the system

3
0 2292
Question Yone Moreno · Jan 27, 2021

Hello,

We would need some help, please;

We would like to handle when we have a date with hours:

20201204090000

And when we have it without the hours part, as follows:

20201204

For the first case we used:

##class(Ens.Util.Time).ConvertDateTime(source.{ORCgrp(1).RXA:DateTimeStartofAdministratio},"%Y%m%d%H%M%S","%d/%m/%Y",,.tSC)

For the second one we wrote:

##class(Ens.Util.Time).ConvertDateTime(source.{ORCgrp(1).RXA:DateTimeStartofAdministratio},"%Y%m%d","%d/%m/%Y",,.tSC)

However each way only works for one case

How could we handle both cases with just a line of code?

We have read:

https://docs.

1
0 479
Question shan wei · Jan 26, 2021

编码中,zn “命名空间”这样跨命名空间使用操作会导致队列中具有很多 _sync:进程号,不知道这种情况是切换命名空间操作的问题还是使用的问题?对于这种跨命名空间有没有更好的应用方式?
In coding, the operation of Zn "namespace" across the namespace will lead to a lot of errors in the queue_ Sync: process number. I don't know if this is a problem of switching the namespace operation or using it? Is there a better way to apply this kind of cross namespace?

2
0 259
Question Anthony Breen · Jan 26, 2021

Hi,

I need to create a Business Service that connects too and processes emails via IMAP.

Has anyone done a similar task and if so, can they provide advice?

There is inbuilt support for POP3 (POP3 adapter) but not for IMAP.

Thanks.

Anthony Breen

2
0 408
Question ED Coder · Jan 22, 2021

I am able to display my query result in the table pane, but I want to update it based on user click but it doesnt work. Can this be done? Below is what I am doing but it doesnt change my value on clicking. Would appreciate some guidance on this

I have ondblclick = zenPage.SelectItem

ClientMethod selectItem(id, time) [ Language = javascript ]
{

    table this.getComponentById('tablename');
    var data table.selectedIndex;
    var rowval table.getRowData(data);
    var valuep new zenProxy();
           valuep.TXTFLAG rowval["TEXT"];
    zenPage.ToggleTextFlag(pP);

    var table this

2
0 427
Question Larry Pinsky · Jan 20, 2021

I have a BPL that calls a business service (actually does lots of other things unrelated to my question).  We receive an acknowledgement back containing data that is processed in the BPL and sent to the source system. The process of sending to our downstream system "A" and receiving the response takes about 20 seconds per transaction (very slow on system A's side).  Due to this slowness, we end up with a backlog close to 1000 messages by the end of the workday.

Is there a way to make this multi-threaded so we can send many messages to system A?

4
0 707
Question Ahmad Bukhtiar · Jan 19, 2021

We have msgs coming like below where line ending with \n then it throw error in router production but if msgs come with \r\n then router dont throw error.

any help?

EMR sending following msg.

MSH|^~&|APP|EMR|HIE|HIE|201301011226||ADT^A01|MSG00001|P|2.5|\n
EVN|A01|201301011223||\ne

Business Service read it like this as on line, and error msg shows in trace.

MSH|^~&|APP|EMR|HIE|HIE|201301011226||ADT^A01|MSG00001|P|2.

2
0 1116
Question Scott Roth · Jan 14, 2021

In the Inbound SQL Adapter settings, is it possible to specify more than 1 field as the Key Field Name? 

Because of the way the Query is being index in Ensemble by the Key Field Name, sometimes transactions get missed and I would like to see if we can add an additional key to the mix to ensure all the transactions are picked up. In this case the InterfaceTrigger is an ID that is auto generated by the table, and I would like to use that as well to ensure we don't miss transactions, and it does not throw any warning messages when it executes the Delete Query.

Thanks

Scott

1
0 400
Question Scott Roth · Jan 13, 2021

I have a case where our EMR is sending data, but not all the values needed for the Ancillary are valued properly and causes that message to error/halt processing on the Ancillary system, not ideal but its what they do. I would expect them to still process the message except that 1 field, but they don't.

I want to add validation to make sure certain fields are valued correctly for the Vendor. 

So I add some statements to take those items that don't pass this validation out to a batch file with headers.

But I want to email out that batch file.

9
0 1186
Question Joe Schra · Jan 18, 2021

Hello!

I have created a record map that I am going to use to parse a flat file coming into Ensemble. From there I am trying to send the parsed out data as emails to patients. I am getting this error when the Service tries to locate the file and send it through...it finds the file (as it states in the error message). So why does it say it does not exist?

15:16:09.420 ERROR #5012: File '/ens/mgr/interfacefiles/test/test22forOPBHSHAWD.txt' does not exist

Thanks for your insight!

2
0 529
Question Lewis Greitzer · Jul 9, 2018

I would like to examine the contents of my OBX-5 field and not route the message if it contains alphabetic characters. I've tried various combinations of the Match and Contains functions, with no luck. Should I be using the COS ? operator or plaini regular expressions?

e.g.

OBX-5 Contains "\D"

OBX-5 Contains "?.A"

OBX-5 Contains "[A-Z]"

17
0 1771