Ok this make sense, thank you. This if what I get from the \$CLASSNAME log:

```this: <?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<rootNode>
<nodeOne>
<NodeTwo>
<auxNode>20180920</auxNode>
<helpNode>E</helpNode>
</NodeTwo>
</nodeOne>
</rootNode>```

This, instead, is the java class:

```Class com.santer.siss.mapping.v25.fse.tester.HL7toXML Extends java.lang.Object [ ProcedureBlock ]
{
Parameter IMPORTTIMESTAMP As STRING = "2019-10-17 10:06:14.0";
Method %OnNew(ByRef p0 As %ObjectHandle) As %Status
{
Quit:'\$D(p0) \$\$\$OK
Quit ..%Constructor(p0,"com.santer.siss.mapping.v25.fse.tester.HL7toXML",0)
}
ClassMethod hl7ToRP(ByRef p0 As %ObjectHandle, ByRef p1 As %ObjectHandle) As %ObjectHandle
{
Quit ..%SR(p0,"hl7ToRP","com.santer.siss.mapping.v25.fse.tester.HL7toXML",.p1)
} }```

I have tried to put it into a stream in two ways:

1. set RPStream = ##class(%FileCharacterStream).%New(output)

2. With an XSLT in order to add the SOAP envelope: #dim finalResponse As %FileCharacterStream=##class(%FileCharacterStream).%New()
set sc = ..Transform(output, "xdata://" _ \$classname() _ ":" _ "addSOAP", .finalResponse)

Thanks to trace operation, I was seeing the the tranform was working but I was getting an error before the asysnc request. I'm posing everithig below:

Transform

```XData addSOAP
{
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<xsl:output method="xml" omit-xml-declaration="yes" indent="no"/>
<xsl:template match="/">
<soapenv:Envelope xmlns:soapenv='http://www.w3.org/2003/05/soap-envelope' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:s='http://www.w3.org/2001/XMLSchema' xmlns:wsa='http://www.w3.org/2005/08/addressing'>
<soapenv:Body>
<xsl:copy-of select="*"/>
</soapenv:Body>
</soapenv:Envelope>
</xsl:template>
</xsl:stylesheet>
}```

Trasform Output:

```<?xml version="1.0" ?>

<!-- type: HS.Util.Trace.Request id: 149506 -->

<Request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://www.w3.org/2001/XMLSchema"><HSCoreVersion>

16

</HSCoreVersion><CurrentClass>

lombardia.bus.HL7DCEPreProcess

</CurrentClass><CurrentMethod>

Transform

</CurrentMethod><Comment>

</Comment><Items><Item><ItemName>

tSC

</ItemName><ItemValue>

1

</ItemValue></Item><Item><ItemName>

pOutput

</ItemName><ItemValue>

<![CDATA[<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://www.w3.org/2005/08/addressing">
<soapenv:Body>
<rootNode>
<nodeOne>
<NodeTwo>
<auxNode>20180920</auxNode>
<helpNode>E</helpNode>
</NodeTwo>
</nodeOne>
</rootNode>
</soapenv:Body></soapenv:Envelope>]]>
</ItemValue></Item></Items>
</Request>```

In this case I get this Error:

 `ERRORE #5002: Errore di Caché: %SaveData+29^Ens.MessageHeader.1 ^Ens.MessageHeaderI("MessageBodyId","

but it seems to be truncated.

Thanks a lot for your answer and collaboration