Announcement

Collapse
No announcement yet.

sFTP Destination "ReferenceError: "response" is not defined."

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • sFTP Destination "ReferenceError: "response" is not defined."

    I am building an sFTP send function in javascript. I get an error in the Mirth dashboard with the following text:

    "34: // Construct the SftpConnection directly from the Mirth class
    35: var sftpConnection = new Packages.com.mirth.connect.connectors.file.filesys tems.SftpConnection(targetIP,targetPort,sFTPuserna me,sFTPpassword, 10000);
    36:
    LINE NUMBER: 32
    DETAILS: ReferenceError: "response" is not defined.


    Does anyone know the syntax to capture an sFTP connection response into a variable in js? I have searched and searched in this forum and on google.
    Perhaps I ma ot askingthe right question.

    using a Mirth destination with the canned sFTP filewriter functionality works fine so I know the connection is being made.

    thanks
    --Pete

  • #2
    Originally posted by RPHaa View Post
    I am building an sFTP send function in javascript. I get an error in the Mirth dashboard with the following text:

    "34: // Construct the SftpConnection directly from the Mirth class
    35: var sftpConnection = new Packages.com.mirth.connect.connectors.file.filesys tems.SftpConnection(targetIP,targetPort,sFTPuserna me,sFTPpassword, 10000);
    36:
    LINE NUMBER: 32
    DETAILS: ReferenceError: "response" is not defined.


    Does anyone know the syntax to capture an sFTP connection response into a variable in js? I have searched and searched in this forum and on google.
    Perhaps I ma ot askingthe right question.

    using a Mirth destination with the canned sFTP filewriter functionality works fine so I know the connection is being made.

    thanks
    --Pete
    The reason I am writing the sFTP function instead of using the standard Mirth destination config is because I want to create additional logging and error handling. currently with many documents it is not easy to determine which ones were actually sent and which ones are not.

    Comment


    • #3
      basic sFTP commands

      Using the "Packages.com.mirth.connect.connectors.file.filesy stems.SftpConnection"
      I would really like to find a list of the basic commands that can be executed within the connection context. I need to:
      1) CHANGE Directory to my source path folder
      2) LIST the files in the folder
      3) Identify the newest file 9 I am thinking that if I pull the list by filedate DESC then I can select the top file fileList(0) that comes up.
      4) GET the file I have identified in Step 3 and bring it to my local server.

      Standard UNIX commands don't work. JSCH commands do not work either.
      Does anyone know if the actions listed above are possible? if so, where can I find a resource or list of these commands and their syntax?

      I know I am a Noob to Mirth. I have been searching the forum and google for an hour now and cannot find what I am looking for.
      Thanks in advance for your help.

      Comment


      • #4
        sftp channel

        Hi Peter,

        You need to import jcraft package in your source. (importPackage (com.jcraft.jsch)).

        Secondly, establish the session and channel connection with respect to your remote machine. Once this is done you can execute the command.

        Please find the below mentioned link for jcraft and ChannelSftp command -
        http://www.jcraft.com/jsch/
        http://epaul.github.io/jsch-document...annelSftp.html


        Feel free to contact me if you need any further help.

        Thanks,
        Sachin.

        Comment

        Working...
        X