We have tried to solve this issue ourselves as follows:

We have changed the method's output parameter, from an Ens.Response to an %XML.String(MAXLEN=""):

Before:

Method ProcesarPeticion(MSH As hl7.MSH.CONTENT, NTE As hl7.NTE.CONTENT, ORMO01PATIENT As hl7.ORMO01.PATIENT.CONTENT(XMLNAME="ORM_O01.PATIENT"), ORMO01ORDER As hl7.ORMO01.ORDER.CONTENT(XMLNAME="ORM_O01.ORDER"), SFT As hl7.SFT.CONTENT, MSA As hl7.MSA.CONTENT, ERR As hl7.ERR.CONTENT) As Mensajes.Response.Peticiones.Derivaciones.EnvioPeticiones.operacionResponse [ Final, ProcedureBlock = 1, SoapAction = "http://FUERTEVENTURA.Servicios/Asentimientos/ProcesarACK", SoapBindingStyle = document, SoapBodyUse = literal, SoapMessageName = ACK, SoapRequestMessage = ORM_O01, WebMethod ]

After:

Method ProcesarPeticion(MSH As hl7.MSH.CONTENT, NTE As hl7.NTE.CONTENT, ORMO01PATIENT As hl7.ORMO01.PATIENT.CONTENT(XMLNAME="ORM_O01.PATIENT"), ORMO01ORDER As hl7.ORMO01.ORDER.CONTENT(XMLNAME="ORM_O01.ORDER"), SFT As hl7.SFT.CONTENT, MSA As hl7.MSA.CONTENT, ERR As hl7.ERR.CONTENT) As %XML.String(MAXLEN="") [ Final, ProcedureBlock = 1, SoapAction = "http://FUERTEVENTURA.Servicios/Asentimientos/ProcesarACK", SoapBindingStyle = document, SoapBodyUse = literal, SoapMessageName = ACK, SoapRequestMessage = ORM_O01, WebMethod ]

In addition we have converted the Ens.Response Message to XML with the following code:

;30/01/2024 convertir a XML para quitar las etiquetas SOAP sobrantes:
set writer=##class(%XML.Writer).%New()
set status=writer.OutputToString()
If $$$ISERR(status) Do $system.OBJ.DisplayError(status)
set status=writer.RootObject(response)
If $$$ISERR(status) Do $system.OBJ.DisplayError(status) set pResponse = writer.GetXMLString()
$$$LOGALERT("pResponse: "_pResponse) ;set inicioCabeceras = "<?xml version=""1.0"" encoding=""UTF-8""?><ACK xmlns=""urn:hl7-org:v2xml"">"
;$$$LOGINFO("inicioCabeceras: "_inicioCabeceras)
set sinInicio = $PIECE(pResponse,"<operacionResponse>",2)
$$$LOGINFO("sinInicio: "_sinInicio)
set sinInicioFinal = $PIECE(sinInicio,"</operacionResponse>",1)
$$$LOGINFO("sinInicioFinal: "_sinInicioFinal)
set finalCabeceras = "</ACK>"
$$$LOGINFO("finalCabeceras: "_finalCabeceras)
;set mensajeACKcompleto = inicioCabeceras_sinInicioFinal_finalCabeceras
set mensajeACKcompleto = sinInicioFinal
$$$LOGINFO("mensajeACKcompleto: "_mensajeACKcompleto) ;quit response
quit mensajeACKcompleto
 

Being the Service's full code as we show:

Class Servicios.Peticiones.Derivaciones.Gestionv01r00 Extends EnsLib.SOAP.Service [ ClassType = "", Inheritance = right, ProcedureBlock ]
{

Parameter ADAPTER = "EnsLib.SOAP.InboundAdapter";

/// Nombre del WebService.
Parameter SERVICENAME = "Gestion";

/// Namespace SOAP para el Servicio Web
Parameter NAMESPACE = "urn:hl7-org:v2xml";

/// Se utilizarán namespaces de clases referenciadas en WSDL.
Parameter USECLASSNAMESPACES = 1;

Method ProcesarPeticion(MSH As hl7.MSH.CONTENT, NTE As hl7.NTE.CONTENT, ORMO01PATIENT As hl7.ORMO01.PATIENT.CONTENT(XMLNAME="ORM_O01.PATIENT"), ORMO01ORDER As hl7.ORMO01.ORDER.CONTENT(XMLNAME="ORM_O01.ORDER"), SFT As hl7.SFT.CONTENT, MSA As hl7.MSA.CONTENT, ERR As hl7.ERR.CONTENT) As %XML.String(MAXLEN="") [ Final, ProcedureBlock = 1, SoapAction = "http://FUERTEVENTURA.Servicios/Asentimientos/ProcesarACK", SoapBindingStyle = document, SoapBodyUse = literal, SoapMessageName = ACK, SoapRequestMessage = ORM_O01, WebMethod ]
{
	set request = ##class(Mensajes.Request.Peticiones.Derivaciones.EnvioPeticiones.operacionRequest).%New()
	set request.MSH = MSH
	do request.NTE.Insert(NTE)
	set request.ORMO01PATIENT = ORMO01PATIENT
	do request.ORMO01ORDER.Insert(ORMO01ORDER)
	
	set tSC = ..SendRequestSync("EnrutadorGestionDerivaciones",request,.response)
	
	;30/01/2024 convertir a XML para quitar las etiquetas SOAP sobrantes:
	set writer=##class(%XML.Writer).%New()
	set status=writer.OutputToString()
	If $$$ISERR(status)

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

	set pResponse = writer.GetXMLString()
	$$$LOGALERT("pResponse: "_pResponse)
	
	;set inicioCabeceras = "<?xml version=""1.0"" encoding=""UTF-8""?><ACK xmlns=""urn:hl7-org:v2xml"">"
	;$$$LOGINFO("inicioCabeceras: "_inicioCabeceras)
	set sinInicio = $PIECE(pResponse,"<operacionResponse>",2)
	$$$LOGINFO("sinInicio: "_sinInicio)
	set sinInicioFinal = $PIECE(sinInicio,"</operacionResponse>",1)
	$$$LOGINFO("sinInicioFinal: "_sinInicioFinal)
	set finalCabeceras = "</ACK>"
	$$$LOGINFO("finalCabeceras: "_finalCabeceras)
	;set mensajeACKcompleto = inicioCabeceras_sinInicioFinal_finalCabeceras
	set mensajeACKcompleto = sinInicioFinal
	$$$LOGINFO("mensajeACKcompleto: "_mensajeACKcompleto)
	
	;quit response
	quit mensajeACKcompleto
}

Method OnProcessInput(pInput As EnsLib.HL7.Message) As %Status
{
   Quit ..SendRequestAsync("EnrutadorGestionDerivaciones",pInput)
}

}

When we execute it, the $$$LOGINFO("mensajeACKcompleto: "_mensajeACKcompleto) does outputs the desired output:

<MSH xmlns:s01="urn:hl7-org:v2xml">
	<s01:MSH.1>|</s01:MSH.1>
	<s01:MSH.2>
		<![CDATA[^~\&]]>
	</s01:MSH.2>
	<s01:MSH.3>
		<s01:HD.1>sistemaExterno</s01:HD.1>
	</s01:MSH.3>
	<s01:MSH.4>
		<s01:HD.1>scs</s01:HD.1>
		<s01:HD.2>350290</s01:HD.2>
	</s01:MSH.4>
	<s01:MSH.5>
		<s01:HD.1>HGF</s01:HD.1>
	</s01:MSH.5>
	<s01:MSH.6>
		<s01:HD.1>EXTHL7</s01:HD.1>
	</s01:MSH.6>
	<s01:MSH.7>
		<s01:TS.1>20240130110908</s01:TS.1>
	</s01:MSH.7>
	<s01:MSH.9>
		<s01:MSG.1>ACK</s01:MSG.1>
	</s01:MSH.9>
	<s01:MSH.10>70589905</s01:MSH.10>
	<s01:MSH.11>
		<s01:PT.1>P</s01:PT.1>
	</s01:MSH.11>
	<s01:MSH.12>
		<s01:VID.1>2.5</s01:VID.1>
	</s01:MSH.12>
	<s01:MSH.13>1</s01:MSH.13>
	<s01:MSH.15>AL</s01:MSH.15>
	<s01:MSH.16>AL</s01:MSH.16>
	<s01:MSH.18>ASCII</s01:MSH.18>
</MSH>
<MSA xmlns:s01="urn:hl7-org:v2xml">
	<s01:MSA.1>AA</s01:MSA.1>
</MSA>

However, when we see the response being replied by the SOAP Service to the SoapUI it shows the extra XML tag "<ProcesarPeticionResult>":

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://www.w3.org/2001/XMLSchema">
	<SOAP-ENV:Body>
		<ACK xmlns="urn:hl7-org:v2xml">
			<ProcesarPeticionResult>
				<MSH xmlns:s01="urn:hl7-org:v2xml">
					<s01:MSH.1>|</s01:MSH.1>
					<s01:MSH.2>^~\&amp;</s01:MSH.2>
					<s01:MSH.3>
						<s01:HD.1>sistemaExterno</s01:HD.1>
					</s01:MSH.3>
					<s01:MSH.4>
						<s01:HD.1>scs</s01:HD.1>
						<s01:HD.2>350290</s01:HD.2>
					</s01:MSH.4>
					<s01:MSH.5>
						<s01:HD.1>HGF</s01:HD.1>
					</s01:MSH.5>
					<s01:MSH.6>
						<s01:HD.1>EXTHL7</s01:HD.1>
					</s01:MSH.6>
					<s01:MSH.7>
						<s01:TS.1>20240130110908</s01:TS.1>
					</s01:MSH.7>
					<s01:MSH.9>
						<s01:MSG.1>ACK</s01:MSG.1>
					</s01:MSH.9>
					<s01:MSH.10>70589905</s01:MSH.10>
					<s01:MSH.11>
						<s01:PT.1>P</s01:PT.1>
					</s01:MSH.11>
					<s01:MSH.12>
						<s01:VID.1>2.5</s01:VID.1>
					</s01:MSH.12>
					<s01:MSH.13>1</s01:MSH.13>
					<s01:MSH.15>AL</s01:MSH.15>
					<s01:MSH.16>AL</s01:MSH.16>
					<s01:MSH.18>ASCII</s01:MSH.18>
				</MSH>
				<MSA xmlns:s01="urn:hl7-org:v2xml">
					<s01:MSA.1>AA</s01:MSA.1>
				</MSA>
			</ProcesarPeticionResult>
		</ACK>
	</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

How could we achieve to remove the undesired "<ProcesarPeticionResult>" XML tag?

Thanks for your time.

Thanks for your help.

Thanks for your replies.

Could you please, help us? By pointing some documentation or linking to some example to address this need?

Thanks for your answers.

Thanks  @Shanshan Yu it worked as expected.

We have changed both ESBSSCC's and ESBCHUIMI's NAMESPACE to be: http://SIPRESatelites/SIPRESatelites.wsdl

So then ESBSSCC's SOAP Header class is:

Class EsquemasDatos.ProgramasAsistenciales.DragoAE.tns.CredencialesType Extends (%Persistent, %SOAP.Header) [ ProcedureBlock ]
{

Parameter ELEMENTQUALIFIED = 1;

Parameter NAMESPACE = "http://SIPRESatelites/SIPRESatelites.wsdl";

// Parameter NAMESPACE = "http://SCS.Servicios/ProgramasAsistenciales";

Parameter XMLFORMAT = "literal";

Parameter XMLNAME = "Credenciales";

Parameter XMLSEQUENCE = 1;

Property usuario As %String(MAXLEN = "", XMLNAME = "usuario") [ Required ];

Property password As %String(MAXLEN = "", XMLNAME = "password") [ Required ];

And then, ESBCHUIMI's SOAP Header class as the same NAMESPACE:

Class EsquemasDatos.ProgramasAsistenciales.DragoAE.tns.CredencialesType Extends (%Persistent, %SOAP.Header) [ ProcedureBlock ]
{

Parameter ELEMENTQUALIFIED = 1;

Parameter NAMESPACE = "http://SIPRESatelites/SIPRESatelites.wsdl";

// Parameter NAMESPACE = "http://SCS.Servicios/SIPRESatelites";

Parameter XMLNAME = "CredencialesType";

Parameter XMLSEQUENCE = 1;

Property usuario As %String(MAXLEN = "", XMLNAME = "usuario") [ Required ];

Property password As %String(MAXLEN = "", XMLNAME = "password") [ Required ];

To sum up, the solution was to writte the same NAMESPACE at both ESBSSCC's and ESBCHUIMI's SOAP Header classes:

Parameter NAMESPACE = "http://SIPRESatelites/SIPRESatelites.wsdl";

Again, thanks @Shanshan Yu for your help, time, and examples.
 

Thanks @Shanshan Yu  for your help.

Yes it does, the ESBCHUIMI's web service client class has it code to handle the SOAP header as follows:

Method actualizarEstadoSolicitudOrto(idsolicitud As %String(XMLNAME="id_solicitud",REQUIRED=1), codcentroentidad As %String(XMLNAME="cod_centro_entidad",REQUIRED=1), numexpedientetarjeta As %String(XMLNAME="num_expediente_tarjeta",REQUIRED=1), estado As %String(XMLPATTERN="\d{1,100}",REQUIRED=1), observaciones As %String(MAXLEN=4000), Output descripcion As %String(REQUIRED=1), usuario As %String(REQUIRED=1), password As %String(REQUIRED=1)) As %Numeric(XMLNAME="codigo") [ Final, ProcedureBlock = 1, SoapBindingStyle = document, SoapBodyUse = literal, WebMethod ]
{
 //credenciales en el header
   set Credenciales = ##class(EsquemasDatos.ProgramasAsistenciales.DragoAE.tns.CredencialesType).%New()
   set Credenciales.usuario = usuario
   set Credenciales.password = password  

   do ..HeadersOut.SetAt(Credenciales, "Credenciales")
   
 Quit ..WebMethod("actualizarEstadoSolicitudOrto","ActualizarEstadoSolicitudOrtoRequestElement").Invoke($this,"http://SIPRESatelites/SIPRESatelites.wsdl/actualizarEstadoSolicitudOrto",.idsolicitud,.codcentroentidad,.numexpedientetarjeta,.estado,.observaciones,.descripcion)
}

The challenge is that there is an Exception between what ESBSSCC's web service client outputs and what ESBCHUIMI's SERVICE class handles as inputs, because it fails at recognizing SOAP Header's Credenciales, and the execution flow breaks at line 7 at ESBCHUIMI's Service Class code here:

set request.usuario = ..HeadersIn.GetNext().usuario
 

We have also tried to call it as follows and it stills failling:

set request.usuario = ..HeadersIn.GetNext("Credenciales").usuario

Being the Error code as follows:

Id.: 320758306
Tipo: Error
Texto: ERROR #6248: La respuesta de SOAP es un error de SOAP: faultcode=Server
faultstring=Error del servidor de aplicaciones.
faultactor=
detail=
<error xmlns="http://SCS.Servicios/SIPRESatelites">
<text>ERROR #5002: Error de cache: &lt;INVALID OREF&gt;zactualizarEstadoSolicitudOrto+7^Servicios.ProgramasAsistenciales.DragoAE.Ortoprotesis.SIPREtoDragoAEv01r00.1</text>
</error>

Could you help us please?

Thanks for your time.

Thanks for your help.

Thanks for your replies.

Thanks @Eduard Lebedyuk for your reply and example.

We have checked and your example does convert the "<" to "%lt;" .

However when at our integration we have followed your suggestions:

Property PACPROBLEMAS As %String(CONTENT = "ESCAPE", MAXLEN = "", XMLNAME = "PAC_PROBLEMAS");
 

So then the LOG SOAP shows:

[...]<PAC_PROBLEMAS>46807#278.01#OBESIDAD INFANTIL GRAVE     ( Z-SCORE IMC &gt;2,70 )#19/09/2019##N#S</PAC_PROBLEMAS>[...]

However when the Visual Trace shows this content, it spawns a CDATA which we do not understand how to remove:

<s01:PAC_PROBLEMAS><![CDATA[46807#278.01#OBESIDAD INFANTIL GRAVE     ( Z-SCORE IMC >2,70 )#19/09/2019##N#S]]>
</s01:PAC_PROBLEMAS>

Is there any configuration, parameter, property or addon which we could employ inside the Web Service Client, the SOAP Operation, the Ens.Response Message, or the inner Data Structures where we could express that we need to erase <![CDATA[]]>?

How could we achieve this?

Thanks for your time, help and support. We are grateful for your reply.

Thanks @Jeffrey Drumm thank you so much, Jeffrey Drumm, for your prompt and precise solution! Your explanation is thorough and greatly appreciated. Your time, assistance, and support mean a lot. The clarification about using the '*' shorthand and the correction regarding Document.DocTypeName versus Document.Name were particularly helpful. Thanks again for your invaluable contribution!

It worked as expected!
 

Thanks @Ashok Kumar for your support and help.

How do we verify it? How do we get all the values whether the hl7 message is properly imported to the object after executing XMLImportSDAString() for all the properties?

We have written: xml.Read() to see which holds:

ClassMethod HL7ToCustomEnsReq(request As EnsLib.HL7.Message) As Mensajes.Request.Peticiones.Derivaciones.EnvioPeticiones.operacionRequest
{
    #dim xml As %Stream.GlobalCharacter
    
    set tSC = ##class(HS.Gateway.HL7.HL7ToSDA3).GetSDA(request,.xml)
    $$$ThrowOnError(tSC)
    
    $$$LOGALERT("xml.Read(): "_xml.Read())
    do xml.Rewind()
    
    set reqObj = ##class(Mensajes.Request.Peticiones.Derivaciones.EnvioPeticiones.operacionRequest).%New()
    do reqObj.XMLImportSDAString(xml.Read())
    set tSC = reqObj.%Save()
    $$$ThrowOnError(tSC)
    
    $$$LOGINFO("reqObj.MSH.MSH1.content: "_reqObj.MSH.MSH1.content)
    quit reqObj
}

We do observe:

xml.Read():

<?xml version="1.0" encoding="UTF-16"?>
<Container xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:isc="http://extension-functions.intersystems.com">
    <EventDescription>ORM_O01</EventDescription>
    <SendingFacility>12010410</SendingFacility>
    <Patient>
        <PatientNumbers>
            <PatientNumber>
                <Number>ZZZ</Number>
                <NumberType>MRN</NumberType>
                <Organization>
                    <Code>ZZZ</Code>
                </Organization>
            </PatientNumber>
            <PatientNumber>
                <Number>BCE</Number>
                <NumberType>BCE</NumberType>
                <Organization>
                    <Code>MPI</Code>
                </Organization>
                <ISOAssigningAuthority>MPI</ISOAssigningAuthority>
            </PatientNumber>
            <PatientNumber>
                <Number>ECX</Number>
                <NumberType>ECX</NumberType>
                <Organization>
                    <Code>TISR</Code>
                </Organization>
                <ISOAssigningAuthority>TISR</ISOAssigningAuthority>
            </PatientNumber>
            <PatientNumber>
                <Organization>
                    <Code>DNI</Code>
                </Organization>
                <ISOAssigningAuthority>DNI</ISOAssigningAuthority>
            </PatientNumber>
            <PatientNumber>
                <Number>ABC</Number>
                <Organization>
                    <Code>ABC</Code>
                </Organization>
            </PatientNumber>
        </PatientNumbers>
        <Name>
            <GivenName>AAA</GivenName>
            <FamilyName>BBB</FamilyName>
            <MiddleName>CCC</MiddleName>
        </Name>
        <BirthTime>1951-11-07T00:00:00Z</BirthTime>
        <Gender>
            <Code>F</Code>
        </Gender>
        <Addresses>
            <Address>
                <Street>C/; 87</Street>
                <State>
                    <Code>28</Code>
                </State>
                <Zip>
                    <Code>35500</Code>
                </Zip>
            </Address>
        </Addresses>
        <ContactInfo>
            <HomePhoneNumber>624508234</HomePhoneNumber>
        </ContactInfo>
        <IsDead>0</IsDead>
        <EnteredAt>
            <Code>12010410</Code>
        </EnteredAt>
    </Patient>
    <OtherOrders>
        <OtherOrder>
            <FillerId>00000000</FillerId>
            <Priority>
                <Code>1</Code>
            </Priority>
            <EnteredBy>
                <Code>32873705N</Code>
            </EnteredBy>
            <EnteringOrganization>
                <Code>CON</Code>
                <Organization>
                    <Code>12010410</Code>
                </Organization>
            </EnteringOrganization>
            <OrderItem>
                <Code>1</Code>
                <Description>Hemograma</Description>
            </OrderItem>
            <Comments>
                <![CDATA[Datos clínicos de interés%%%]]>
            </Comments>
        </OtherOrder>
    </OtherOrders>
    <Action>AddOrUpdate</Action>
</Container>

How do we convert this SDA to the Ens.Request needed, which holds an structure like this:

Class Mensajes.Request.Peticiones.Derivaciones.EnvioPeticiones.operacionRequest Extends (Ens.Request, HS.SDA3.QuickXML) [ ProcedureBlock ]
{

Parameter RESPONSECLASSNAME = "Mensajes.Response.Peticiones.Derivaciones.EnvioPeticiones.operacionResponse";

Property MSH As hl7.MSH.CONTENT;

Property NTE As list Of hl7.NTE.CONTENT;

Property ORMO01PATIENT As hl7.ORMO01.PATIENT.CONTENT;

Property ORMO01ORDER As list Of hl7.ORMO01.ORDER.CONTENT;

Property SFT As list Of hl7.SFT.CONTENT;

Property MSA As hl7.MSA.CONTENT;

Property ERR As list Of hl7.ERR.CONTENT;

How do we continue?

Thanks for your time, help, support and effort, and patience.