Oh! forget what I said, I was thinking that you were calling a Business Operation all the time...remove the pOutput from the OnMessage method .

I see what is the problem. Your BP is using the method OnMessage to do the C-FIND operation, but the OnResponse method is not receiving the response.

Remove the pOutput references from your code and try with the following code:

do ..%responseSet(..respuestaConsultaEstudios)
Quit $$$OK

Not sure if that would work.

Did you update the call from EnrutadorConsultarEstudiosVNAv01r00 to ConsultarEstudiosMedianteFind  adding the variable by reference?

For the Quit you have to return the status, is not necessary to return the output variable. You have to update the call to Procesos.DICOM.ConsultarEstudiosMedianteFind adding the output variable as reference.

And the Quit is what is generating the null response. You have to avoid the async call and return the result using an output variable.

I suspect that the problem is that you are sending a SendRequestAsync to  EnrutadorConsultarEstudiosVNAv01r00 that is the business process that called to Procesos.DICOM.ConsultarEstudiosMedianteFind, and after that you are doing the Quit, returning to  EnrutadorConsultarEstudiosVNAv01r00 again.

Try adding a $$$TRACE in this method:

Method OnAssociationReleased(pSourceConfigName As %String, pInput As EnsLib.DICOM.Notify.Released) As %Status
{
    #dim tSC As %Status = $$$OK
        
        #; The association between this process and the operation has been released, so we are now
        #; not connected to the operation
        Set ..CurrentState="OperationNotConnected"
    
    ; Añadimos 11 10 2023
    
    
    Set tSC=..SendRequestAsync("EnrutadorConsultarEstudiosVNAv01r00",..respuestaConsultaEstudios,0)
    
    Quit tSC
}

Maybe you are calling the BP from here with a null response.

You can configure a transform creating a new message and defining another context variable with the same type than the original message as output, then you keep your original message in the request and the transformed message in the new variable.

Here you can see an example:

ClassMethod ImportRawMatches() As %DynamicObject
{
    Try {
        Do ##class(%REST.Impl).%SetContentType("application/json")
        If '##class(%REST.Impl).%CheckAccepts("application/json") Do ##class(%REST.Impl).%ReportRESTError(..#HTTP406NOTACCEPTABLE,$$$ERROR($$$RESTBadAccepts)) Quit
        
        set newRequest = ##class(QUINIELA.Message.OperationRequest).%New()
        set newRequest.Operation = "Import"
        
        set status = ##class(Ens.Director).CreateBusinessService("QUINIELA.BS.FromWSBS", .instance)
       	set response = ##class(QUINIELA.Message.ImportResponse).%New()
        set response.Status = "In Process"
        set response.Operation = "Import"
        set status = instance.SendRequestAsync("QUINIELA.BP.ImportBPL", newRequest, .response)
        
        if $ISOBJECT(response) {	        
            Do ##class(%REST.Impl).%SetStatusCode("200")
            return response.%JSONExport()
		}		
        
    } Catch (ex) {
        Do ##class(%REST.Impl).%SetStatusCode("400")
        return ex.DisplayString()
    }

The key is this row:

return response.%JSONExport()

Hi Yone! Your patientId is a param of the URL, you don't need to include it into the router map, to get the value you only need 

set patid = %request.Get("patientid")

Hi Lorenzo! I'm no sure if this is the reason, but I've defined a proxy for the Angular front-end. You can check proxy.config.json:

{
    "/api/*": {
      "target": "http://iris:52773",
      "secure": false,
      "logLevel": "debug"
    }
  }

All my requests to the server are using localhost:4200 and they are translated into iris:52773 after the request.

Well, in theory if you define the identifier in the request section and define the method as "PUT" the server should create the organization if it doesn't exist or updated if it do.

<?xml version="1.0" encoding="UTF-8"?>
<Bundle xmlns="http://hl7.org/fhir">
    <type value="transaction"> </type>
    <entry>
        <resource>
            <Organization>
                <id value="17C7D86E-664F-4FE2-91D7-AF9A8E47311E"></id>
                <text>
                    <status value="generated"/>
                    <div xmlns="http://www.w3.org/1999/xhtml"> LITTLE CLINIC 2000 PATIENT DRIVE ANN
                        ARBOR MI US - NOI # 888333111 </div>
                </text>
                <identifier>
                    <system value="www.nationalorgidentifier.gov"/>
                    <value value="888333111"/>

                </identifier>
                <name value="LITTLE CLINIC"/>
                <address>
                    <line value="2000 CLINIC DRIVE"/>
                    <city value="ANN ARBOR"/>
                    <state value="MI"/>
                    <country value="US"/>
              </address>
            </Organization>
        </resource>
        <request>
            <method value="PUT"/>
            <url value="Organization?identifier=www.nationalorgidentifier.gov|888333111"/>
        </request>
    </entry>
    <entry>
        <resource>
            <Patient>
                <text>
                    <status value="generated"/>
                    <div xmlns="http://www.w3.org/1999/xhtml"> EVERYWOMAN EVE 2000 PATIENT DRIVE ANN
                        ARBOR MI MPI #12312311 </div>

                </text>
                <identifier>
                    <system value="www.mypatientidentifier.com"/>
                    <value value="12312311"/>
                </identifier>
                <name>
                    <family value="EVERYWOMAN"/>
                    <given value="EVE"/>
                </name>
                <address>
                    <line value="2000 PATIENT DRIVE"/>
                    <city value="ANN ARBOR"/>
                    <state value="MI"/>
                    <country value="US"/>
                </address>
                <managingOrganization>
                    <reference value="Organization/17C7D86E-664F-4FE2-91D7-AF9A8E47311E">
                        
                    </reference>   
                </managingOrganization>
               </Patient>

        </resource>
        <request>
            <method value="PUT"/>
            <url value="Patient?identifier=www.mypatientidentifier.com|12312311"/>
        </request>
    </entry>
</Bundle>

But this is the theory...not sure if it will work for your FHIR server.

Have you tried to split your variable in various variables to avoid the string length limitation?

XData VariableName1 [ MimeType = application/json ] {}

XData VariableName2 [ MimeType = application/json ] {}

...

XData VariableNameN [ MimeType = application/json ] {}
 

What do you think that we have in the kitchenette (cocina) in southern Europe? A machine of sangria? That would be great...

Well, I guess that you just need to call the BO/endpoint form the WHILE loop:

Set tSC = ..SendRequestSync(outbound, pRequest, .pResponse)