You can see in the code my extended %CSP.Rest class:

Class QUINIELA.WS.Service Extends %CSP.REST
{

Parameter HandleCorsRequest = 0;

Parameter CHARSET = "utf-8";

XData UrlMap [ XMLNamespace = "https://www.intersystems.com/urlmap" ]
{
<Routes>
	<Route Url="/getPrediction" Method="GET" Call="GetPrediction" />
    <Route Url="/import" Method="GET" Call="ImportRawMatches" />
    <Route Url="/getStatus/:operation" Method="GET" Call="GetStatus" />
    <Route Url="/prepare" Method="GET" Call="PrepareData" />
    <Route Url="/train" Method="GET" Call="TrainData" />
    <Route Url="/getReferees" Method="GET" Call="GetReferees" />
    <Route Url="/getTeams" Method="GET" Call="GetTeams" />
	<Route Url="/saveMatch" Method="POST" Call="SaveMatch" />
    <Route Url="/deleteMatch/:matchId" Method="DELETE" Call="DeleteMatch" />
    <Route Url="/saveResult" Method="POST" Call="SaveResult" />
    <Route Url="/getMatches/:division" Method="GET" Call="GetMatches" />
</Routes>
}

ClassMethod OnHandleCorsRequest(url As %String) As %Status
{
	set url = %request.GetCgiEnv("HTTP_REFERER")
    set origin = $p(url,"/",1,3) // origin = "http(s)://origin.com:port"

    // here you can check specific origins
    // otherway, it will allow all origins (useful while developing only)

	do %response.SetHeader("Access-Control-Allow-Credentials","true")
	do %response.SetHeader("Access-Control-Allow-Methods","GET,POST,PUT,DELETE,OPTIONS")
	do %response.SetHeader("Access-Control-Allow-Origin",origin)
	do %response.SetHeader("Access-Control-Allow-Headers","Access-Control-Allow-Origin, Origin, X-Requested-With, Content-Type, Accept, Authorization, Cache-Control")
	quit $$$OK
}

I've no idea about how IRIS FHIR Server works with the profiling but according to FHIR documentation...Did you define in the meta element the profile property for the Patient resource? In theory you have to include that info to apply the profiling for the resource.

You can find here the description of profile property in FHIR documentation

It should be something like this:

<meta>
    <profile value= "http://localhost:52773/fhirr4/StructureDefinition"></profile>
</meta>

If you are getting:

callresponse.%ClassName(): Ack

And your code is:

if (callresponse.%ClassName() = "consultarEstudiosDatosPacienteVNAResponse"){
	set callresponse = ..respuestaConsultaEstudios
	Quit $$$OK
}

It will never send back respuestaConsultaStudios because the previous condition, try assigning respuestaConsultaEstudios to callresponse without it.

Maybe you can do a workaround for this problem creating a new Business Process to send respuestaConsultaEstudios and manage it from there, ignoring from EnrutadorConsultarEstudiosVNAv01r00 the null response that you receive from ConsultarEstudiosMedianteFind

Another option could be define OnResponse method on ConsultarEstudiosMedianteFind and define the response properly.
 

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.

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.