Hello,
First of all thanks for your time reading this question, and thank you for your help.
🎯 We would need to create an Ensemble HealthShare Operation to read files from a FTP / SFTP server.
We have coded:
Class Operaciones.FTP.ConsultaPDFv01r001 Extends Ens.BusinessOperation [ ProcedureBlock ]
{
Parameter ADAPTER = "EnsLib.FTP.InboundAdapter"
Method ConsultarDocumentoPDF(pRequest As Mensajes.Request.ConsultaPDFRequestv01r00, Output pResponse As Mensajes.Response.RecuperarDocumentoPDFv01r00) As %Library.Status
{
set ftp = ##class(%Net.FtpSession).%New()
set isConnected = ftp.Connect(..Adapter.FTPServer, ..Adapter.Credentials.Username, ..Adapter.Credentials.Password, ..Adapter.FTPPort) {
$$$LOGINFO($System.Status.GetErrorText(isConnected))
$$$LOGINFO(isConnected)
if isConnected {
$$$LOGINFO("HOLA")
do ftp.SetDirectory(..Adapter.FilePath)
set stream=##class(%GlobalCharacterStream).%New()
if 'ftp.Retrieve(pRequest.nombreDocumento, .stream) { $$$LOGERROR("Error al recuperar el documento") }
else{
$$$LOGINFO(stream.Read())
}
}
Quit $$$OK
}
XData MessageMap
{
<MapItems>
<MapItem MessageType="Mensajes.Request.ConsultaPDFRequestv01r00">
<Method>ConsultarDocumentoPDF</Method>
</MapItem>
</MapItems>
}
}
When we try this operation from the Web Portal, we always get the following result:
First loginfo outputs: "ERROR #00: (sin descripción de error) [no error description]"
Second loginfo shows: 0
.png)
.png)
We have verified that the IP and Port of the server are correct, but we do not understand why it does not connect.
We know that the code does not enter inside the if which checks if it isConnected
set isConnected = ftp.Connect(..Adapter.FTPServer, ..Adapter.Credentials.Username, ..Adapter.Credentials.Password, ..Adapter.FTPPort) {
if isConnected {
How could we get what exact error is happening?
🔎 We have also read:
https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...
https://docs.intersystems.com/irislatest/csp/documatic/%25CSP.Documatic....
https://community.intersystems.com/post/how-does-enslibftp-use-netftpses...
https://community.intersystems.com/post/ftp-file-download-all-files-no-f...
https://community.intersystems.com/post/using-and-debugging-netsshsessio...
https://community.intersystems.com/post/how-download-files-ftp-server-lo...
https://community.intersystems.com/post/how-uploaddownload-image-files-f...
https://community.intersystems.com/post/how-get-files-ftp-server
https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...
https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...
https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...
https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...
https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...
🎯 How would you accomplish this task, to be able to read a file from a FTP / SFTP server in HealthShare 2020?
Thanks for your time, and thank your for your replies.
🐱💻🐱💻🐱💻