Question
Anthem
US
Last activity: 15 Feb 2018 12:41 EST
Can we have the REST web services or any Pega features can trigger Windows SCP command to send a product jar from Windows to Linux.
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
US
Pega 7.1.9 and later ship with native one-way SFTP support. As you planned to use SCP, your Linux machine's SSH service probably already supports SFTP, which is an extension to SSH, just like SCP.
SFTP achieves the same goal as SCP - transferring file data over a secure channel.
The SFTP call would be made using the "Connect-FTP" method in an Activity, which you could run as part of a REST Service call or any other procedure in your Pega application.
If you're not ready to upgrade, we do provide a guide for attempting to build your own SFTP solution in Pega (https://docs-previous.pega.com/configuring-custom-sftp-and-ftps-implementations-pega-applications) but this is much more difficult than using the out-of-the-box feature in later versions of Pega 7.
Anthem
US
Hi HOULJ,
Thank you for your response.We have started implementing custom FTP Secure (FTPS) steps in the article provided above.
The java code mentioned doesnt say anything about the destination path into which the file should be copied.Please help.
Pegasystems Inc.
US
The method cd() under ChannelSftp should help.
https://epaul.github.io/jsch-documentation/javadoc/index.html?com/jcraft/jsch/ChannelSftp.html
public void cd(String path) throws SftpException
Anthem
US
HI Team,
Thank you for the recommendations.
We could find connect-FTP method @ PEGA 718.It does mean we could avoid using the java code and importing the commons apache jar file ?
In addition,we are facing the following FTP server error (Service reply :SSH-2.0-OpenSSH_6.7 ).PFA for the screenshots.
Anthem
US
Hi Team,
Could you please provide an update.
Regards,
Pradeep Pydi.
Pegasystems Inc.
US
Please review my first response to your post.
SFTP is an officially supported protocol for Connect-FTP in Pega 7.1.9 and later. Pega 7.1.8 only supports the non-compatible "FTP" and "FTPS" protocols. If you would like the out-of-the-box SFTP support, you should upgrade to the newest Pega release.
The response you are getting is expected. The server is saying "I am an SSH server" when you are trying to open a connection to it. SFTP is an extension to SSH.
Anthem
US
Hi Team,
While trying to save an Activity with a java step (Custom SFTP implementation),the below mentioned compilation error has been observed.
Test compilation failed: ----------
1. ERROR in \Rule_Obj_Activity_Rule_Obj_Activity_Devops_SFTP_Action_20180214T212531_769_GMT.java (at line 157)
String localFile = tools.getParamValue("D:\PEGA_TEMP\DEVOPS\PegaRULES_Extract_Marker.txt");
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ )
----------
1 problem (1 error)
Compile failed.
jsch-0.1.54 version downloaded from SourceForge has been installed in our lib path : D:\Apache\Tomcat\7.0.57\lib and the compiler/defaultPaths has been added followed by a restart.
Please find the attachment for additional details regarding the java code and the activity.
Pegasystems Inc.
US
How about,
String localFile = tools.getParamValue("D:\\PEGA_TEMP\\DEVOPS\\PegaRULES_Extract_Marker.txt");
-
Dylan Martis
Pegasystems Inc.
US
Could you explain what you're attempting to do with this line:
String localFile = tools.getParamValue("D:\PEGA_TEMP\DEVOPS\PegaRULES_Extract_Marker.txt");
I do not understand why you would do tools.getParamValue here. That gets a value off of the current Parameter Page, using some key that is already on the Map.
If you just want to set the path, use forward slashes ('/') or escape your backslashes ("\\").
String localFile = "D:/Temp/MyFile.txt"
OR
String localFile = "D:\\Temp\\MyFile.txt"
Update: after reviewing your document I see that you have used "getParamValue" when defining every String variable. This is incorrect, and you will get null/empty values for every one of those Strings.
Anthem
US
I have tried your recommendation. Please find below for the error messages.
Test compilation failed: ----------
1. ERROR in \Rule_Obj_Activity_Rule_Obj_Activity_Devops_SFTP_Action_20180214T212531_769_GMT.java (at line 188)
* try {inputStream = new java.io.FileInputStream(fileF);
^
Syntax error on token "*", delete this token
----------
2. ERROR in \Rule_Obj_Activity_Rule_Obj_Activity_Devops_SFTP_Action_20180214T212531_769_GMT.java (at line 191)
{oLog.error(exp.toString());}*
^
Syntax error on token "*", delete this token
----------
2 problems (2 errors)
Compile failed.
Pegasystems Inc.
US
I reviewed your doc file with the code in it.
There are multiple errors including these erroneous '*' characters.
The first step is to remove those. You may stop getting compilation errors after that.
Anthem
US
Followed up your recommendations,but still facing the following error "com.jcraft cannot be resolved to a type".
Please find the attachment for the latest java code along with the error messages.
Pegasystems Inc.
US
That error usually means you did not properly import the JSCH library into your application server.
Anthem
US
I have placed the jsch-0.1.54.jar (downloaded from sourceforge) in to the lib path (D:\Apache\Tomcat\7.0.57\lib) of our tomcat server followed by a restart.In addition, I have added a DSS compiler/defaultPaths as well.
Not sure what else to be taken care to import the above mentioned library properly.
Pegasystems Inc.
US
Try importing the jar into the database instead.
Anthem
US
sure.Could you please provide some specifications about the database server path into which the library should be imported.
Pegasystems Inc.
US
Simply use Designer Studio -> Application -> Distribution -> Import from within designer studio.