Question
· Feb 11, 2020

Response is filled in the Bussiness Operation but it is empty inside Process

Hello,

 

We would like some help:

We have found that in the following code:

 

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 tSC = pRequest.NewResponse(.pResponse)  Quit:$$$ISERR(tSC) tSC
 
 Set pResponse.MSH = $get(MSH),pResponse.SFT = $get(SFT),pResponse.MSA = $get(MSA),pResponse.ERR = $get(ERR),pResponse.QAK = $get(QAK),pResponse.QPD = $get(QPD),pResponse.DSC = $get(DSC)
 do pResponse.RSPK21QUERYRESPONSE.Insert($get(RSPK21QUERYRESPONSE).GetAt(1))
 
 $$$LOGINFO("pResponse: "_pResponse)
 $$$LOGINFO("pResponse.MSH.MSH1.content: "_pResponse.MSH.MSH1.content)
 
 
 
 Quit $$$OK
}

Parameter ADAPTER = "EnsLib.SOAP.OutboundAdapter";

XData MessageMap
{
<MapItems>
    <MapItem MessageType="Mensajes.Request.GestionPacientes.operacionRequest">
        <Method>operacion</Method>
    </MapItem>
</MapItems>
}

}

 

 

We observe pResponse has contents, due to the $$$LOGINFO("pResponse.MSH.MSH1.content: "_pResponse.MSH.MSH1.content) shows:

 

However we watch a curious and unexpected behaviour: the response in the visual trace is empty:

 

So then, inside the process, this:  $$$LOGINFO("response.MSH.MSH1.content: "_response.MSH.MSH1.content) ; prints:

 

In addition we observe that the reference being printed in the operation is different than the one printed in the process.

Operation's referece:

 

Process' reference:

 

We have read:

 

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

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

Discussion (6)2
Log in or sign up to continue

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, 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.

"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."

This is happening because when you receive it from the web service it is only stored in memory. In order to send it from the operation back to the business process it needs to be persisted in the database. This should be handled automatically by the parent (response) class if the child class is a %SerialObject -- it will automatically serialize the child object and store it under the parent's global.

We can demonstrate this with these two classes:

Class Demo.Obj.ParentClass Extends Ens.Response
{

Property parentProp1 As %String;

Property childList As list Of Demo.Obj.ChildClass;

ClassMethod populate()
{
    s parent=##class(Demo.Obj.ParentClass).%New()
    s parent.parentProp1=$ZDT($h)
    f i=1:1:10 {
        s child=##class(Demo.Obj.ChildClass).%New()
        s child.prop1="child.prop1."_i
        s child.prop2="child.prop2."_i
        zw child
        w "    ",parent.childList.Insert(child),!
    }
    w parent.%Save(), ":", parent.%Id(),!
}
}
Class Demo.Obj.ChildClass Extends (%SerialObject, %XML.Adaptor)
{

Property prop1 As %String;

Property prop2 As %String;
}

It's not clear to me why this isn't working in your example -- possible the storage definition needs to be reset since you changed it from %RegisteredObject to %SerialObject.

https://docs.intersystems.com/irislatest/csp/docbook/Doc.View.cls?KEY=GO...