Helo Alexey, Eduard:

There will be dozens of files every day. We also think that we should do it through a linux shell script, which:

1º Detects the files modified (or created) on the last day, in a series of folders (which will be in the same directory)

2º Copy the files to the folder "internal to the server" (we need to copy them and not just move them, because the original file must be recorded because they are owned by a different system)

How would you approach the shell script? We appreciate your time

Hello Eduard Lebedyuk, thanks for your answer.

We have tried to send two async calls, and then use a <sync> to wait for both responses. We thought the BPL execution flow would stop at <sync> until it gets all responses from the async calls. However we observe that both sync calls are sent and then the execution flow continues beyond <sync>.

To give more context, we are calling for specialists appointments, then for primary appointments, after that we have the sync, and finally some transformation and code as follows:

Being the trace, the following, where we see the two asyn call being sent:

However because of the execution flow continues after <sync> without having both responses, we have in our context empty responses, so then the transformation fails:

Besides we do get the responses, however they arrive after they are needed, because of primary appointments return after the Transform attempt was made, and the specialists appointments are retrieved after BPL sends a response to the service (which means we could not use the specialists appointments anymore).

The question is: how could we achieve to wait and stop BPL execution flow, until we do get both async calls' responses?

Hello Tomáš Vaverka,

We have tried the following code:

set httpRequest.ContentType = "application/json"
  set httpRequest.ContentCharset = "UTF-8"
set httpRequest.ContentEncoding = "UTF-8"
set httpRequest.NoDefaultContentCharset = 0

And it does store the notification with the accented letters.

We appreciate that you have spent time and effort helping us in this task, Tomáš Vaverka.

 

Hello,  Tomáš Vaverka,

We have tried to rewind httpRequest.EntityBody

And we see it is being stored in the API with the strange character.

The code is:

while(httpRequest.EntityBody.AtEnd=0){
 set linea = httpRequest.EntityBody.Read()
}

Do httpRequest.EntityBody.Rewind()

Being the complete code:

Method CrearNotificacion(pRequest As Mensajes.Request.NotificacionesPUSH.CrearNotificacion, pResponse As Mensajes.Response.NotificacionesPUSH.CrearNotificacion) As %Library.Status
{
$$$LOGINFO("^data: "_^data) $$$LOGINFO("^idsDispositivos: "_^idsDispositivos) Set body = {
     "app_id"(pRequest.idApp),
     "headings"{"en":(pRequest.notificacion.titulo),"es":(pRequest.notificacion.titulo)},
     "subtitle"{"en":(pRequest.notificacion.subtitulo),"es":(pRequest.notificacion.subtitulo)},
     "contents"{"en":(pRequest.notificacion.mensaje),"es":(pRequest.notificacion.mensaje)},
     "data":(^data),
     "include_player_ids"(^idsDispositivos)
} //"headings": {"en":($ZCONVERT(pRequest.notificacion.titulo,"O","UTF8")),"es":(pRequest.notificacion.titulo)}, set httpRequest = ##class(%Net.HttpRequest).%New()
set tResponse = ##class(%Net.HttpResponse).%New()
set httpRequest.Server = "onesignal.com" set httpRequest.ContentCharset = "UTF-8"
set httpRequest.ContentType = "application/json"
set httpRequest.ContentEncoding = "UTF-8"
set httpRequest.NoDefaultContentCharset = 0
//set httpRequest.ContentType = "application/json;charset=utf-8"
//do httpRequest.SetHeader("Content-Type","application/json; charset=utf-8")
//set httpRequest.ContentCharset = "utf-8"
//do httpRequest.SetHeader("Content-Encoding","gzip") //set httpRequest.Authorization = "Basic "_##class(Util.TablasMaestras).getValorMaestra("NOTIFICACIONESPUSH.PARAMETRIZACIONES","onesignal_apikey")
set httpRequest.Authorization = "Basic "_##class(Util.TablasMaestras).getValorMaestra("NOTIFICACIONESPUSH.PARAMETRIZACIONES","ONESIGNAL_APIKEY_SCS")
$$$LOGINFO("httpRequest.Authorization: "_httpRequest.Authorization)
set httpRequest.Https = 1 set httpRequest.SSLConfiguration = "Certificado_SCS"
$$$LOGINFO("body.data: "_body.data)
set dataObject = ##class(%DynamicObject).%FromJSON(body.data)
$$$LOGINFO("dataObject: "_dataObject)
set body.data = dataObject $$$LOGINFO("body.'include_player_ids': "_body."include_player_ids")
set idsDispositivosObject = ##class(%DynamicObject).%FromJSON(body."include_player_ids")
$$$LOGINFO("idsDispositivosObject "_idsDispositivosObject)
set body."include_player_ids" = idsDispositivosObject //set status = ##class(%ZEN.Auxiliary.jsonProvider).%WriteJSONStreamFromObject(httpRequest.EntityBody, body,,,,"aeloqtuw")
Do httpRequest.EntityBody.Write(body.%ToJSON())
while(httpRequest.EntityBody.AtEnd=0){
set linea = httpRequest.EntityBody.Read()
} Do httpRequest.EntityBody.Rewind() $$$LOGINFO("linea: "_linea) set tSC = httpRequest.Post("https://onesignal.com/api/v1/notifications") set tResponse = httpRequest.HttpResponse
if $$$ISERR(tSC){
$$$ThrowOnError(tSC)
}
if (tResponse.Data.AtEnd = 0) {
//$$$LOGINFO("En AñadirDispositivo, tamaño de tResponse: "_tResponse.Data.Size)
set linea = tResponse.Data.Read()
//$$$LOGINFO("Linea: "_linea)
} set pResponse = ##class(Mensajes.Response.NotificacionesPUSH.CrearNotificacion).%New()
do pResponse.informacion.Write(linea)
while(pResponse.informacion.AtEnd=0){
set informacion = pResponse.informacion.Read()
}
$$$LOGINFO("informacion: "_informacion)
Do pResponse.informacion.Rewind() Quit pResponse
}
 

In addition, we observe that in our Operation the notification is:


{"app_id":"5cf57b56-c3b4-4a0d-8938-4ac4466f93af","headings":{"en":"Cita Atención Primaria","es":"Cita Atención Primaria"},"subtitle":{"en":"C.P. ISORA","es":"C.P. ISORA"},"contents":{"en":"Aqui el contenido del mensaje si aplicase","es":"Aqui el contenido del mensaje si aplicase"},"data":{"centro":"C.P. ISORA","fecha":"yyy/mm/dd","hora":"hh:mm","profesional":"nombre del profesional","nomUsuario":"nombre de usuario","codcita":"idCita","sepuedeborrar":"1"},"include_player_ids":["114a63e3-1da9-40fa-a3ec-e6677466e11a"]}  

And it is being stored with rare characters:


How could we debug this behaviour?
 

We observe:

 
linea: {"app_id":"5cf57b56-c3b4-4a0d-8938-4ac4466f93af","headings":{"en":"Cita Atención Primaria","es":"Cita Atención Primaria"},"subtitle":{"en":"C.P. ISORA","es":"C.P. ISORA"},"contents":{"en":"Aqui el contenido del mensaje si aplicase","es":"Aqui el contenido del mensaje si aplicase"},"data":{"centro":"C.P. ISORA","fecha":"yyy/mm/dd","hora":"hh:mm","profesional":"nombre del profesional","nomUsuario":"nombre de usuario","codcita":"idCita","sepuedeborrar":"1"},"include_player_ids":["114a63e3-1da9-40fa-a3ec-e6677466e11a"]}

 

Being the code:

Method CrearNotificacion(pRequest As Mensajes.Request.NotificacionesPUSH.CrearNotificacion, pResponse As Mensajes.Response.NotificacionesPUSH.CrearNotificacion) As %Library.Status
{
$$$LOGINFO("^data: "_^data) /*
Set body = {
     "app_id": (pRequest.idApp),
     "headings": {"en":(pRequest.notificacion.titulo),"es":(pRequest.notificacion.titulo)},
     "subtitle": {"en":(pRequest.notificacion.subtitulo),"es":(pRequest.notificacion.subtitulo)},
     "contents": {"en":(pRequest.notificacion.mensaje),"es":(pRequest.notificacion.mensaje)},
     "data":(^data),
     "include_player_ids": ["c2917a6f-6ecf-4f45-8b31-9b72538580fd"]
}
*/ $$$LOGINFO("^idsDispositivos: "_^idsDispositivos) Set body = {
     "app_id"(pRequest.idApp),
     "headings"{"en":(pRequest.notificacion.titulo),"es":(pRequest.notificacion.titulo)},
     "subtitle"{"en":(pRequest.notificacion.subtitulo),"es":(pRequest.notificacion.subtitulo)},
     "contents"{"en":(pRequest.notificacion.mensaje),"es":(pRequest.notificacion.mensaje)},
     "data":(^data),
     "include_player_ids"(^idsDispositivos)
} //"headings": {"en":($ZCONVERT(pRequest.notificacion.titulo,"O","UTF8")),"es":(pRequest.notificacion.titulo)}, set httpRequest = ##class(%Net.HttpRequest).%New()
set tResponse = ##class(%Net.HttpResponse).%New()
set httpRequest.Server = "onesignal.com" set httpRequest.ContentCharset = "UTF-8"
set httpRequest.ContentType = "application/json"
set httpRequest.ContentEncoding = "UTF-8"
set httpRequest.NoDefaultContentCharset = 0
//set httpRequest.ContentType = "application/json;charset=utf-8"
//do httpRequest.SetHeader("Content-Type","application/json; charset=utf-8")
//set httpRequest.ContentCharset = "utf-8"
//do httpRequest.SetHeader("Content-Encoding","gzip") //set httpRequest.Authorization = "Basic "_##class(Util.TablasMaestras).getValorMaestra("NOTIFICACIONESPUSH.PARAMETRIZACIONES","onesignal_apikey")
set httpRequest.Authorization = "Basic "_##class(Util.TablasMaestras).getValorMaestra("NOTIFICACIONESPUSH.PARAMETRIZACIONES","ONESIGNAL_APIKEY_SCS")
$$$LOGINFO("httpRequest.Authorization: "_httpRequest.Authorization)
set httpRequest.Https = 1 set httpRequest.SSLConfiguration = "Certificado_SCS"
$$$LOGINFO("body.data: "_body.data)
set dataObject = ##class(%DynamicObject).%FromJSON(body.data)
$$$LOGINFO("dataObject: "_dataObject)
set body.data = dataObject $$$LOGINFO("body.'include_player_ids': "_body."include_player_ids")
set idsDispositivosObject = ##class(%DynamicObject).%FromJSON(body."include_player_ids")
$$$LOGINFO("idsDispositivosObject "_idsDispositivosObject)
set body."include_player_ids" = idsDispositivosObject //set status = ##class(%ZEN.Auxiliary.jsonProvider).%WriteJSONStreamFromObject(httpRequest.EntityBody, body,,,,"aeloqtuw")
Do httpRequest.EntityBody.Write(body.%ToJSON())
while(httpRequest.EntityBody.AtEnd=0){
set linea = httpRequest.EntityBody.Read()
}
$$$LOGINFO("linea: "_linea) set tSC = httpRequest.Post("https://onesignal.com/api/v1/notifications") set tResponse = httpRequest.HttpResponse
if $$$ISERR(tSC){
$$$ThrowOnError(tSC)
}
if (tResponse.Data.AtEnd = 0) {
//$$$LOGINFO("En AñadirDispositivo, tamaño de tResponse: "_tResponse.Data.Size)
set linea = tResponse.Data.Read()
//$$$LOGINFO("Linea: "_linea)
} set pResponse = ##class(Mensajes.Response.NotificacionesPUSH.CrearNotificacion).%New()
do pResponse.informacion.Write(linea) Quit pResponse
}
 

Hello, Rubens Silva. We have tried the settings and the message is being sent, however the accented letters still being replaced by strange characters:

We have tried:

set httpRequest.ContentCharset = "utf-8"
set httpRequest.ContentType = "application/json"
set httpRequest.ContentEncoding = "utf-8"
set httpRequest.NoDefaultContentCharset = 0

Yes Marc, you are right.

We have used the following code in the service:

set writer=##class(%XML.Writer).%New()
set status=writer.OutputToString()
If $$$ISERR(status)

Do $system.OBJ.DisplayError(status)
set status=writer.RootObject(pPesponse)
If $$$ISERR(status) Do $system.OBJ.DisplayError(status)

set response = writer.GetXMLString()

Quit response

Where we create a new empty XML writer, the we request the string, from the object's start, and finally we get it.

Hello Marc, we appreciate your help.

We have modify EsquemasDatos.Gasometros.hl7.RSPK21.QUERYRESPONSE.CONTENT to extend %SerialObject as:

Class EsquemasDatos.Gasometros.hl7.RSPK21.QUERYRESPONSE.CONTENT Extends (%SerialObject, %XML.Adaptor) [ ProcedureBlock ]
{

Parameter ELEMENTQUALIFIED = 0;

Parameter NAMESPACE = "urn:hl7-org:v2xml";

Parameter XMLNAME = "RSP_K21.QUERY_RESPONSE";

Parameter XMLSEQUENCE = 1;

Property PID As EsquemasDatos.GestionPacientes.hl71.PID.CONTENT(REFELEMENTQUALIFIED = 0, REFNAMESPACE = "urn:hl7-org:v2xml", XMLNAME = "PID", XMLREF = 1) [ Required ];

Property PD1 As EsquemasDatos.GestionPacientes.hl71.PD1.CONTENT(REFELEMENTQUALIFIED = 0, REFNAMESPACE = "urn:hl7-org:v2xml", XMLNAME = "PD1", XMLREF = 1);

Property NK1 As list Of EsquemasDatos.GestionPacientes.hl71.NK1.CONTENT(REFELEMENTQUALIFIED = 0, REFNAMESPACE = "urn:hl7-org:v2xml", XMLNAME = "NK1", XMLPROJECTION = "ELEMENT", XMLREF = 1);

Property QRI As EsquemasDatos.GestionPacientes.hl71.QRI.CONTENT(REFELEMENTQUALIFIED = 0, REFNAMESPACE = "urn:hl7-org:v2xml", XMLNAME = "QRI", XMLREF = 1);

And the Message Viewer stills showing an empty list:

How could we pass the Operation's list which is being retrieved from the Web Service Client, to the Process? We ask this because of it is quite curious to see it being replied from the Web Service to the Operation, where we can LOGINFO its propierties, and then, suddenly when we pass it to the Process, it is empty.

 In addition we have tested sending an HL7 message from a test operation to the bussiness service, here is the example messag:

MSH|^~\&|7edit||7edit||20200210093324||QBP^Q21|MSG-20200210-093324-0270|P|2.5
QPD|MessageQueryName
RCP

Then, we see the following trace:


ERROR <Ens>ErrOutConnectionLost: Se ha perdido conexión HL7 Read con  - detectado mediante ERROR #5002: Error de cache: <READ>zReadLine+11^%IO.DeviceStream.1


So it looks like our service refuses to accept input HL7 messages.

In the Production we see it gets stucked:

And our service:

Shows no results:

Besides, we have checked our operation is referencing service's host and port:

 

How could we debug this bussiness service?

Hello Marc, I appreciate your help. Currently we have figured out how to fill the response message. However there is a challenge: the outer systems answers to us with the following structure:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
        <RSP_K21 xmlns="urn:hl7-org:v2xml">
            <MSH>
                <MSH.1>|</MSH.1>
                <MSH.2>^~\&amp;</MSH.2>
                <MSH.3>
                    <HD.1>anonymized</HD.1>
                </MSH.3>
                <MSH.4>
                    <HD.1>anonymized</HD.1>
                    <HD.2>anonymized</HD.2>
                </MSH.4>
                <MSH.5>
                    <HD.1>anonymized</HD.1>
                </MSH.5>
                <MSH.6>
                    <HD.1>anonymized</HD.1>
                </MSH.6>
                <MSH.7>
                    <TS.1>anonymized</TS.1>
                </MSH.7>
                <MSH.9>
                    <MSG.1>RSP</MSG.1>
                    <MSG.2>K22</MSG.2>
                    <MSG.3>RSP_K21</MSG.3>
                </MSH.9>
                <MSH.10>945a44fd-aba2-45fb-9753-d24e38d1fb14</MSH.10>
                <MSH.11>
                    <PT.1>anonymized</PT.1>
                </MSH.11>
                <MSH.12>
                    <VID.1>2.5</VID.1>
                </MSH.12>
                <MSH.13>1</MSH.13>
                <MSH.15>AL</MSH.15>
                <MSH.16>AL</MSH.16>
                <MSH.18>ASCII</MSH.18>
            </MSH>
            <MSA>
                <MSA.1>AA</MSA.1>
                <MSA.3>AA</MSA.3>
            </MSA>
            <QAK>
                <QAK.2>OK</QAK.2>
            </QAK>
            <QPD>
                <QPD.1>
                    <CE.1>Q22</CE.1>
                    <CE.3>Find Candidates</CE.3>
                </QPD.1>
                <QPD.3>
                    <QIP.1>@PID.3.1</QIP.1>
                    <QIP.2>35018</QIP.2>
                </QPD.3>
            </QPD>
            <RSP_K21.QUERY_RESPONSE>
                <PID>
                    <PID.1>1</PID.1>
                    <PID.2>
                        <CX.1>anonymized</CX.1>
                        <CX.2>anonymized</CX.2>
                    </PID.2>
                    <PID.3>
                        <CX.1>anonymized</CX.1>
                        <CX.4>
                            <HD.1>anonymized</HD.1>
                        </CX.4>
                        <CX.5>anonymized</CX.5>
                    </PID.3>
                    <PID.3>
                        <CX.1>anonymized</CX.1>
                        <CX.2>anonymized</CX.2>
                        <CX.4>
                            <HD.1>anonymized</HD.1>
                        </CX.4>
                        <CX.5>anonymized</CX.5>
                    </PID.3>
                    <PID.3>
                        <CX.1>anonymized</CX.1>
                        <CX.2>anonymized</CX.2>
                        <CX.4>
                            <HD.1>anonymized</HD.1>
                        </CX.4>
                        <CX.5>anonymized</CX.5>
                    </PID.3>
                    <PID.3>
                        <CX.1>anonymized</CX.1>
                        <CX.4>
                            <HD.1>anonymized</HD.1>
                        </CX.4>
                        <CX.5>anonymized</CX.5>
                    </PID.3>
                    <PID.3>
                        <CX.1>""</CX.1>
                        <CX.4>
                            <HD.1>anonymized</HD.1>
                        </CX.4>
                        <CX.5>anonymized</CX.5>
                    </PID.3>
                    <PID.3>
                        <CX.1>""</CX.1>
                        <CX.4>
                            <HD.1>anonymized</HD.1>
                        </CX.4>
                        <CX.5>anonymized</CX.5>
                    </PID.3>
                    <PID.4>
                        <CX.1>anonymized</CX.1>
                    </PID.4>
                    <PID.5>
                        <XPN.1>
                            <FN.1>anonymized</FN.1>
                        </XPN.1>
                        <XPN.2>anonymized</XPN.2>
                    </PID.5>
                    <PID.6>
                        <XPN.1>
                            <FN.1>anonymized</FN.1>
                        </XPN.1>
                    </PID.6>
                    <PID.7>
                        <TS.1>anonymized</TS.1>
                    </PID.7>
                    <PID.8>M</PID.8>
                    <PID.11>
                        <XAD.1>
                            <SAD.1>""</SAD.1>
                            <SAD.2>anonymized</SAD.2>
                            <SAD.3>""</SAD.3>
                        </XAD.1>
                        <XAD.2>""</XAD.2>
                        <XAD.3>anonymized</XAD.3>
                        <XAD.4>anonymized</XAD.4>
                        <XAD.5>anonymized</XAD.5>
                        <XAD.6>anonymized</XAD.6>
                        <XAD.9>""_""</XAD.9>
                        <XAD.10>""</XAD.10>
                        <XAD.11>""</XAD.11>
                    </PID.11>
                    <PID.13>
                        <XTN.1>anonymized</XTN.1>
                        <XTN.4>""</XTN.4>
                    </PID.13>
                    <PID.13>
                        <XTN.1>anonymized</XTN.1>
                    </PID.13>
                    <PID.14>
                        <XTN.1>anonymized</XTN.1>
                    </PID.14>
                    <PID.14>
                        <XTN.1>""</XTN.1>
                    </PID.14>
                    <PID.15>
                        <CE.1>""</CE.1>
                    </PID.15>
                    <PID.16>
                        <CE.1>""</CE.1>
                    </PID.16>
                    <PID.17>
                        <CE.1>anonymized</CE.1>
                        <CE.4>anonymized</CE.4>
                    </PID.17>
                    <PID.19>""</PID.19>
                    <PID.22>
                        <CE.1>anonymized</CE.1>
                    </PID.22>
                    <PID.23>anonymized</PID.23>
                    <PID.26>
                        <CE.1>anonymized</CE.1>
                    </PID.26>
                    <PID.27>
                        <CE.1>""</CE.1>
                    </PID.27>
                    <PID.28>
                        <CE.1>anonymized</CE.1>
                        <CE.2>anonymized</CE.2>
                        <CE.4>anonymized</CE.4>
                    </PID.28>
                    <PID.30>anonymized</PID.30>
                    <PID.31>anonymized</PID.31>
                    <PID.35>
                        <CE.1>anonymized</CE.1>
                        <CE.2>anonymized</CE.2>
                    </PID.35>
                    <PID.39>
                        <CWE.1>""</CWE.1>
                        <CWE.2>""</CWE.2>
                        <CWE.3>""</CWE.3>
                        <CWE.4>anonymized</CWE.4>
                        <CWE.5>""</CWE.5>
                    </PID.39>
                </PID>
                <PD1>
                    <PD1.3>
                        <XON.1>anonymized</XON.1>
                        <XON.2>anonymized</XON.2>
                        <XON.7>anonymized</XON.7>
                        <XON.8>
                            <HD.1>anonymized</HD.1>
                        </XON.8>
                        <XON.9>anonymized</XON.9>
                        <XON.10>""</XON.10>
                    </PD1.3>
                    <PD1.3>
                        <XON.9>""</XON.9>
                    </PD1.3>
                    <PD1.5>""</PD1.5>
                    <PD1.7>anonymized</PD1.7>
                    <PD1.8>TSI 002</PD1.8>
                    <PD1.9>anonymized</PD1.9>
                    <PD1.12>anonymized</PD1.12>
                </PD1>
            </RSP_K21.QUERY_RESPONSE>
        </RSP_K21>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The difficulty is that
RSP_K21.QUERY_RESPONSE
 has content inside the Operation:

But when it is passed to the process is empty:

[... rest of message... ]

Message:

Class Mensajes.Response.GestionPacientes.operacionResponse Extends Ens.Response [ ProcedureBlock ]
{

Property MSH As hl7.MSH.CONTENT;

Property SFT As list Of hl7.SFT.CONTENT;

Property MSA As hl7.MSA.CONTENT;

Property ERR As hl7.ERR.CONTENT;

Property QAK As hl7.QAK.CONTENT;

Property QPD As hl7.QPD.CONTENT;

Property RSPK21QUERYRESPONSE As list Of EsquemasDatos.Gasometros.hl7.RSPK21.QUERYRESPONSE.CONTENT(REFELEMENTQUALIFIED = 0, XMLNAME = "RSP_K21.QUERY_RESPONSE", XMLPROJECTION = "ELEMENT", XMLREF = 1);

Property DSC As hl7.DSC.CONTENT;

Data Structure:

Class EsquemasDatos.Gasometros.hl7.RSPK21.QUERYRESPONSE.CONTENT Extends (%RegisteredObject, %XML.Adaptor) [ ProcedureBlock ]
{

Parameter ELEMENTQUALIFIED = 0;

Parameter NAMESPACE = "urn:hl7-org:v2xml";

Parameter XMLNAME = "RSP_K21.QUERY_RESPONSE";

Parameter XMLSEQUENCE = 1;

Property PID As EsquemasDatos.GestionPacientes.hl71.PID.CONTENT(REFELEMENTQUALIFIED = 0, REFNAMESPACE = "urn:hl7-org:v2xml", XMLNAME = "PID", XMLREF = 1) [ Required ];

Property PD1 As EsquemasDatos.GestionPacientes.hl71.PD1.CONTENT(REFELEMENTQUALIFIED = 0, REFNAMESPACE = "urn:hl7-org:v2xml", XMLNAME = "PD1", XMLREF = 1);

Property NK1 As list Of EsquemasDatos.GestionPacientes.hl71.NK1.CONTENT(REFELEMENTQUALIFIED = 0, REFNAMESPACE = "urn:hl7-org:v2xml", XMLNAME = "NK1", XMLPROJECTION = "ELEMENT", XMLREF = 1);

Property QRI As EsquemasDatos.GestionPacientes.hl71.QRI.CONTENT(REFELEMENTQUALIFIED = 0, REFNAMESPACE = "urn:hl7-org:v2xml", XMLNAME = "QRI", XMLREF = 1);

}

Operation:

Class Operaciones.SOAP.Gasometros.GestionPacientes.SeleneHL7Service Extends Ens.BusinessOperation [ ProcedureBlock ]
{ Method operacion(pRequest As Mensajes.Request.GestionPacientes.operacionRequest, Output pResponse As Mensajes.Response.GestionPacientes.operacionResponse) As %Library.Status
{
 Set ..Adapter.WebServiceClientClass = "WSCLIENTE.GestionPacientes.ConsultaCandidatos"
 Set MSH=pRequest.MSH,SFT=pRequest.SFT,QPD=pRequest.QPD,DSC=pRequest.DSC
 Set tSC = ..Adapter.InvokeMethod("operacion",,.MSH,.SFT,.MSA,.ERR,.QAK,.QPD,pRequest.RCP,.RSPK21QUERYRESPONSE,.DSC) Quit:$$$ISERR(tSC) tSC
 set pResponse = ##class(Mensajes.Response.GestionPacientes.operacionResponse).%New()
 Set tSC = pRequest.NewResponse(.pResponse) Quit:$$$ISERR(tSC) tSC
 
 Set pResponse.MSH = $get(MSH)
 Set pResponse.SFT = $get(SFT)
 //do pResponse.SFT.Insert($get(SFT).GetAt(1))  Set pResponse.MSA = $get(MSA)
 Set pResponse.ERR = $get(ERR)
 Set pResponse.QAK = $get(QAK)
 Set pResponse.QPD = $get(QPD)
 Set pResponse.DSC = $get(DSC)
 //do pResponse.RSPK21QUERYRESPONSE.Insert($get(RSPK21QUERYRESPONSE).GetAt(1))
 Set pResponse.RSPK21QUERYRESPONSE = $get(RSPK21QUERYRESPONSE)
 
 
 $$$LOGINFO("RSPK21QUERYRESPONSE: "_RSPK21QUERYRESPONSE)
 $$$LOGINFO("RSPK21QUERYRESPONSE.PID1: "_RSPK21QUERYRESPONSE.GetAt(1))
 $$$LOGINFO("RSPK21QUERYRESPONSE.PID1: "_RSPK21QUERYRESPONSE.GetAt(1).PID.PID1.content)
 $$$LOGINFO("RSPK21QUERYRESPONSE.PID8: "_RSPK21QUERYRESPONSE.GetAt(1).PID.PID8.content)
 
 $$$LOGINFO("pResponse.RSPK21QUERYRESPONSE "_pResponse.RSPK21QUERYRESPONSE)
 $$$LOGINFO("pResponse.RSPK21QUERYRESPONSE.PID1: "_pResponse.RSPK21QUERYRESPONSE.GetAt(1))
 $$$LOGINFO("pResponse.RSPK21QUERYRESPONSE.PID1: "_pResponse.RSPK21QUERYRESPONSE.GetAt(1).PID.PID1.content)
 $$$LOGINFO("pResponse.RSPK21QUERYRESPONSE.PID8: "_pResponse.RSPK21QUERYRESPONSE.GetAt(1).PID.PID8.content)
     
 Quit $$$OK
}

Client:

Class WSCLIENTE.GestionPacientes.ConsultaCandidatos Extends %SOAP.WebClient [ ProcedureBlock ]
{

Method operacion(ByRef MSH As hl7.MSH.CONTENT(REFELEMENTQUALIFIED=0,REFNAMESPACE="urn:hl7-org:v2xml",XMLREF=1,REQUIRED=1), ByRef SFT As %ListOfObjects(ELEMENTTYPE="hl7.SFT.CONTENT",XMLPROJECTION="element",REFELEMENTQUALIFIED=0,REFNAMESPACE="urn:hl7-org:v2xml",XMLNAME="SFT",XMLREF=1), Output MSA As hl7.MSA.CONTENT(REFELEMENTQUALIFIED=0,REFNAMESPACE="urn:hl7-org:v2xml",XMLREF=1,REQUIRED=1), Output ERR As hl7.ERR.CONTENT(REFELEMENTQUALIFIED=0,REFNAMESPACE="urn:hl7-org:v2xml",XMLREF=1), Output QAK As hl7.QAK.CONTENT(REFELEMENTQUALIFIED=0,REFNAMESPACE="urn:hl7-org:v2xml",XMLREF=1,REQUIRED=1), ByRef QPD As hl7.QPD.CONTENT(REFELEMENTQUALIFIED=0,REFNAMESPACE="urn:hl7-org:v2xml",XMLREF=1,REQUIRED=1), RCP As hl7.RCP.CONTENT(REFELEMENTQUALIFIED=0,REFNAMESPACE="urn:hl7-org:v2xml",XMLREF=1,REQUIRED=1), Output RSPK21QUERYRESPONSE As %ListOfObjects(ELEMENTTYPE="EsquemasDatos.Gasometros.hl7.RSPK21.QUERYRESPONSE.CONTENT",XMLPROJECTION="element",REFELEMENTQUALIFIED=0,REFNAMESPACE="urn:hl7-org:v2xml",XMLNAME="RSP_K21.QUERY_RESPONSE",XMLREF=1), ByRef DSC As hl7.DSC.CONTENT(REFELEMENTQUALIFIED=0,REFNAMESPACE="urn:hl7-org:v2xml",XMLREF=1)) [ Final, ProcedureBlock = 1, SoapBindingStyle = document, SoapBodyUse = literal, WebMethod ]
{
 Do (..WebMethod("operacion","QBP_Q21")).Invoke($this,"anonymized",.MSH,.SFT,.MSA,.ERR,.QAK,.QPD,.RCP,.RSPK21QUERYRESPONSE,.DSC)
} }

Could be different our data strcture to the one being responded by the outer system? Why does the RSP_K21.QUERY_RESPONSE
 contents appear inside the Operation and they are not being shown inside the Process?

Hello Marc Mundt, you are right:

I have tried to comment the sentence: "do result.%Display()", so then the code would be:

However $$$LOGINFO("resultado actual: "_result.%CurrentResult) prints an empty result:

And as you said, do result.%Display(), was iterating over the result:


We now have the following code:

set statement=##class(%SQL.Statement).%New()
 
  set status = statement.%PrepareClassQuery("TablasBBDD.NotificacionesPUSH.RelacionAplicacionNotificacion","seleccionarTodo")
 
  set result = statement.%Execute()
  //do result.%Display()
 
  $$$LOGINFO("filas result: "_result.%ROWCOUNT)
 
  $$$LOGINFO("result: "_result)
 
  //$$$LOGINFO("clave: "_result.%Get("clave"))
 
  $$$LOGINFO("resultado actual: "_result.%CurrentResult)
 
  $$$LOGINFO("result number of columns: "_result.%ResultColumnCount)
 
  //$$$LOGINFO("result dumped: "_result.DumpResults())
 
  //$$$LOGINFO("resultado siguiente: "_result.%Next())
 
  set i = 0
  while (result.%Next() '= 0){
   set i=i+1
   $$$LOGINFO("i: "_i)
   $$$LOGINFO("Inside loop, current result: "_result.%CurrentResult)
   set printed = result.%CurrentResult.%Print()
   $$$LOGINFO("current result print: "_printed)
   //$$$LOGINFO("current result getData(0): "_result.%CurrentResult.%GetData(0))
   //$$$LOGINFO("current result column(0): "_result.%CurrentResult.Column(0))
  }

And when we check the trace, we see, there are 4 columns:

And we iterate once, so there is one row:

Being current result a SQL.ClassQueryResultSet:

However, why when we call:

set printed = result.%CurrentResult.%Print()

$$$LOGINFO("current result print: "_printed)

It shows:

How could we get, from result.%CurrentResult which is a %SQL.ClassQueryResultSet, the row's data? I mean, how could we print result's row's data?‽???

 

 

I have read:

- https://cedocs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cl...

Hello Eduard, I have tried your answer, however it outputs:

ESBSSCC>set enMsg = "hello"
 
ESBSSCC>set esMsg = "hola"
 
ESBSSCC>set obj = {"language1":(enMsg),"language2":(esMsg)}
 
ESBSSCC>write obj.%ToJSON()
 
WRITE obj.%ToJSON()
^
<METHOD DOES NOT EXIST> *%ToJSON,%Library.Object
ESBSSCC>w $classname(obj)
%Library.Object

Being the version:

w $zversion
Cache for UNIX (Red Hat Enterprise Linux for x86-64) 2016.1.2 (Build 206U) Mon Jul 25 2016 16:47:58 EDT

And the documentation for the class %Library.Object, shows no method called %ToJSON()

Could you help me please?