Invoking EnsLib.FTP.OutboundAdpter from Object Script
I have a case where I am creating a PDF file from an Encoded String, and I need to transfer this file over to another server. I was wondering since this is PDF file if I could just invoke the FTP.OutboundAdapter within my Object script that is creating the PDF from the encoded string. Is this possible? Does anyone have an examples of using EnsLib.FTP.OutboundAdpater within their Object Script?
Thanks
Scott Roth
Integration - Interfaces
The Ohio State University Wexner Medical Center
If you have Ensemble production defined you can call BS or BO from Cache ObjectScript using testing service.
Or you can just use %Net.FtpSession object to store stream on a remote server.
I took your suggestion about using %Net.FtpSession to transfer the file back and forth between the two boxes, however I am running into an issue trying to ftp.Store the file. Can I have a second pair of eyes take a look at this to see what I am doing wrong?
{
set ftp=##class(%Net.FtpSession).%New()
if 'ftp.Connect("xxxxx","xxxxx","xxxxxx") $$$LOGINFO("Unable to connect to inteng11") quit
set Oref = ##class(%FileBinaryStream).%New()
set Oref.Filename = FileName
Do base64.Rewind()
While 'base64.AtEnd {
set ln = base64.ReadLine()
set lnDecoded = $system.Encryption.Base64Decode(ln)
do Oref.Write(lnDecoded)
}
if 'ftp.SetDirectory("/home/egate/Scott") $$$LOGINFO("Unable to change directory") quit
If 'ftp.Store(Oref,stream) $$$LOGINFO("Unable to write file") quit
if 'ftp.Logout() $$$LOGINFO("Failed to logout") quit
}
Thanks
I'd start without base64 decode just to check how ftp works.
I think this would be enough to work (1st argument in Store is a full filename and second is a stream you want to put there):
I was able to figure out what exactly I was doing wrong. Thanks. One last question is it possible to call Ensemble-->Configuration-->Credenitals, into Cache Object Script?
To get user/pass? Sure: