Hello,
We would like to get the XML which is being given by the requested system, directly to our Service output.
We have tried to just output directly the Message Response as follows:
Method findCandidatesXML(mensEntrada As %XML.GlobalCharacterStream(CONTENT="MIXED")) As Mensajes.Response.GestionPacientes.operacionResponse(XMLNAME="mensSalida") [ Final, ProcedureBlock = 1, SoapAction = "http://SCS.Servicios/GestionPacientes/findCandidatesXML", SoapBindingStyle = document, SoapBodyUse = literal, WebMethod ]
{
set ^tipoMensaje="XML"
$$$LOGINFO("El mensaje es de tipo: "_^tipoMensaje)
#dim tSC as %Status
if ('..IsServiceEnabled()){
set tSC = $SYSTEM.Status.Error(60333,"Web Service Not Enabled")
if $$$ISERR(tSC) do ..ReturnMethodStatusFault(tSC)
}
//----
set p = ##class(%GlobalCharacterStream).%New()
while (mensEntrada.AtEnd=0){
//do p.Write(mensEntrada.Read())
do p.Write($zcvt(mensEntrada.Read(),"O","UTF8"))
}
$$$LOGINFO("El mensaje en XML: "_p.Read())
do p.Rewind()
set msgER7 = ##class(EnsLib.HL7.Message).%New()
set msgER7 = ##class(ITB.HL7.Util.Convert).XMLToER7(p,.tSC,"2.5")
$$$LOGINFO(tSC)
//Establece DocType
if (msgER7.GetValueAt("1:9.3") '= "") {
do msgER7.DocTypeSet("2.5"_":"_msgER7.GetValueAt("1:9.3"))
} else {
set tipo = msgER7.GetValueAt("1:9.1")
set evento = msgER7.GetValueAt("1:9.2")
do msgER7.DocTypeSet("2.5"_":"_tipo_"_"_evento)
}
set pPesponse = ##Class(Mensajes.Response.GestionPacientes.operacionResponse).%New()
//proceso el mensaje
set tSC = ..SendRequestSync("EnrutadorConsultaPaciente",msgER7, .pPesponse)
//set tSC = ..SendRequestAsync("EnrutadorConsultaPaciente",p, .pPesponse)
if $$$ISERR(tSC){ $$$TRACE("Error en la llamada al destino"_$system.Status.GetErrorText(tSC))}
Quit pPesponse
}