Announcement Announcement Module
Collapse
No announcement yet.
sftp outbound-channel-adapter for transferring files to mainframe Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • sftp outbound-channel-adapter for transferring files to mainframe

    I couldn't figure it out how to set the lrecl using the sftp:outbound-channel-adapter

    1) A message would need to be transformed to ebcdic format by a transformer.
    2) The file can be transferred to the server, but the record length is 0. It is a long line
    I have added NewLine in the file, but it is still not working. The hex code is 15

    if I send the file by command line, it works fine
    such as
    sftp username@server
    cd //directory/path
    ls /+recfm=FB
    ls /+lrecl=128
    put filename

    the file can be displayed properly on mainframe

    if i use the outbound-channel-adapter, there is no way to set it. If i use outbound-gateway, it does not support put method.

    is it possible to pass in any parameters?


    HTML Code:
      <sftp:outbound-channel-adapter id="outboundMainFrameAdapter"
                                       session-factory="sftpMainFrameClientFactory"
                                       channel="outboundMainFrameChannel"
                                       charset="Cp1047"
                                       remote-filename-generator-expression="${mainframe.sftp.fileName}"
                                       remote-directory="${mainframe.sftp.target-dir}"/>

  • #2
    Interesting - looks like they are abusing the ls command to be interpreted as some session control.

    Even if the gateway supported put, it wouldn't really be satisfactory because, even if you use cached sessions, there is no guarantee that each command would run on the same session. If you don't use cached sessions, each command would run in its own session, which wouldn't work anyway.

    We don't support the kind of user-managed session life cycle that you need for this.

    Probably the easiest way to get around this would be to implement a custom SessionFactory - simply subclass the DefaultSessionFactory, override the getSession() method, call super().getSession(), then issue your two ls commands (call list(path)) before returning the session to the client (the outbound adapter).

    This assumes that the following command line sequence would work...

    sftp username@server
    ls /+recfm=FB
    ls /+lrecl=128
    put //directory/path/filename

    (session doesn't support a cd command).

    You would probably not want to cache-sessions in this case because the next user would inherit these settings.

    Comment


    • #3
      thz for your quick reply

      "cd command" would work when i set this (remote-directory="${mainframe.sftp.target-dir}")
      Therefore, no need to concern the cd command

      I believe override the getSessionMethod that is the only solution

      Comment

      Working...
      X