Image transfer via fileset-FTP

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Image transfer via fileset-FTP

  • Creator
    Topic
  • #51681
    Jared Parish
    Participant

      Hello All,

      - Jared Parish

    Viewing 7 reply threads
    • Author
      Replies
      • #71257
        Jim Kosloskey
        Participant

          Jared,

          Have you tried your output file with a style of Single?

          email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

        • #71258
          Jared Parish
          Participant

            Actually, originally it was set to “single”.  Then when testing, I changed both source and destination thread to eof.  So far, I can’t tell there is any difference.

            Thanks,

            - Jared Parish

          • #71259
            Robert Milfajt
            Participant

              If you are using FTP, try bin instead of ASCII transfer protocol.  Not sure how to set this up in Cloverleaf.  A quick check to see if this is the problem is to look at the file size on Cloverleaf (number of bytes) and compare it to the file size on the destination.  If they are not the same, this maybe your problem.

              Hope this helps,

              Robert Milfajt
              Northwestern Medicine
              Chicago, IL

            • #71260
              Scott Folley
              Participant

                If you are doing a raw route and “transferring” between two like systems (which it appears that you are since I don’t see any outbound protocol information) then ASCII vs BINARY is basically a moot point because the difference is whether line termination in an ASCII transfer is done or not.  Since two like systems handle line termination the same way both methods will produce the same output.  However, if you are transferring between a linux/unix system and a Windows system then the method becomes very important.

                Any binary file (image, pdf, etc…) would need to be done using the image/binary method.  But it looks like you are doing that, so what is the real problem that you are seeing?

              • #71261
                Jared Parish
                Participant

                  The issues is the images become corrupt when they are FTP’d to the receiving system.  In the source thread I have a TCL upoc that writes to the server (for archiving purposes).  At this point, I can open the images and they look fine. Once they are FTP’d to the destination they will not open.  

                  Does anyone else use the engine in this manner?

                  My suggestion to the customer was that the engine really wasn’t designed to be a file transfer service and to find a better suited solutions.

                  Thank you for all the replies.

                  - Jared Parish

                • #71262
                  Robert Milfajt
                  Participant

                    I hate to beat a dead horse, but how do you do this FTP process, i.e., Korn shell, TCL script, etc.?

                    Robert Milfajt
                    Northwestern Medicine
                    Chicago, IL

                  • #71263
                    James Cobane
                    Participant

                      The one thing I always do before configuring an FTP thread in the engine is to test the ftp from the command line first.  This way I can verify the user login, directory, read/write privileges, etc. are working as expected before I try it via the engine.  This way I know everything is in place before I configure Cloverleaf.

                      My $.02 worth

                      Jim Cobane

                      Henry Ford Health

                    • #71264
                      Scott Folley
                      Participant

                        We transfer PDFs and JPG images using TCLcurl in the engine.  This works quite well.

                        While the engine was not designed to move images through it, it is quite capable of doing that.  If the data is raw routed then there should be no issue with sending it via binary ftp.  One thing that may be a problem is if you are sending it and it is being picked up before the FTP is complete.  If that is the case, or a possibility, then you need to send it using a temporary file name and rename it when it gets there.  The other option is to use TCLcurl on the data which will give you more control over the FTP.

                        Here is the code that we use to send images via TCLcurl.  It is designed to pick up the file and send it out using a filename that rides along with the message, but that is just because this is what our needs were, it could also take the data in a message and send it.

                        You can see that we set up the information that TCLcurl needs as arguments to the proc.  If you decide to use this method and you want to act on the message content (assuming it is an image) you would need to first open up a file, use fconfigure on that file to ensure that it was written back out properly, and then use that as what we have as “binname” here.

                        Code:


                        ######################################################################
                        # Name:         ftpBINfileVPN
                        # Purpose:      
                        # UPoC type:    tps
                        # Args:         tps keyedlist containing the following keys:
                        #               MODE    run mode (”start”, “run” or “time”)
                        #               MSGID   message handle
                        #               ARGS    user-supplied arguments:
                        #                      
                        #
                        # Returns: tps disposition list:
                        #          
                        #

                        proc ftpBINfileVPN { args } {

                           package require TclCurl

                           keylget args MODE mode                      ;# Fetch mode

                           set dispList {}                             ;# Nothing to return

                           switch -exact — $mode {
                               start {
                                   # Perform special init functions
                                   # N.B.: there may or may not be a MSGID key in args
                               }

                               run {
                                   # ‘run’ mode always has a MSGID; fetch and process it
                                   keylget args MSGID mh
                                   keylget args ARGS.URL url
                                   keylget args ARGS.USERPASSWORD userpassword

                                   set userdata [ msgmetaget $mh USERDATA ]
                                   keylget userdata BINNAME binname
                                   keylget userdata FTPOBDIR ftpobdir

                                   if { [ catch { keylget userdata SENDPDF } ] } {
                                       set sendpdf 1
                                   } else {
                                       keylget userdata SENDPDF sendpdf
                                   }
                                   if { !$sendpdf } {
                                       return “{CONTINUE $mh}”
                                   }

                                   if { [ info exists ftpobdir ] } {
                                       set url “$url/../$ftpobdir”
                                   }
                                   set binname [ file tail $binname ]
                                   set ext [ string trimleft [ file extension $binname ] “.” ]
                                   set lookupExt [ string tolower $ext ]
                                   set directory [tbllookup -side input DataFileLocation.tbl $lookupExt]
                                   set ch [ curl::init ]
                                   $ch configure -verbose 1
                                   $ch configure -upload 1
                                   $ch configure -userpwd $userpassword
                                   set outfile $binname
                                   set filename $directory$binname
                                   puts “ftp://$url/$outfile”
                                   $ch configure -url ftp://$url/$outfile
                                   $ch configure -infile $filename
                                   set retryLimit 3
                                   set retry 0
                                   while { $retry < $retryLimit } {
                                       incr retry
                                       if { [ catch { $ch perform } status ] } {
                                           echo "ftp error:$status"
                                           if { $retry == 3 } {
                                               return "{ERROR $mh}"
                                           }
                                       } else {
                                           break
                                       }
                                   }
                                   $ch cleanup
                                   lappend dispList "CONTINUE $mh"
                               }

                               time {
                                   # Timer-based processing
                                   # N.B.: there may or may not be a MSGID key in args
                               }

                               shutdown {
                                   # Doing some clean-up work
                               }
                           }

                           return $dispList
                        }

                        Hope that helps.

                    Viewing 7 reply threads
                    • The forum ‘Cloverleaf’ is closed to new topics and replies.