Clarity PPM

Expand all | Collapse all

Send file form clarity to another system

  • 1.  Send file form clarity to another system

    Posted 05-24-2013 08:41 AM
    Hello,

    In project I have attachment filed. I would like to create process which find the file I attach to the specific project to attachment field and then send it to another system. I have query which find the path to the file. But how can I then send the file? I was thinking to connect to clarity server (SFTP) (using Gel script) find the file using path from query and then send it to another system.
    Is it possible to access SFTP using Gel script? How can I create connection in Gel script and send the file?

    Thank you


  • 2.  RE: Send file form clarity to another system

    Posted 05-24-2013 09:09 AM
    GEL has FTP methods available ; search for "GEL FTP" in the message boards and you should find some information?


  • 3.  RE: Send file form clarity to another system

    Posted 05-27-2013 06:00 AM
    Yes, you cannot directly use SFTP from gelscript, only normal ftp tag is supported; however, if you are using any SFTP client script (WINSCP Script) for sending the file , you can send the file SFTP via Winscp script by calling the script from GelSciript and addtionally you can check if from output xml if the file is sent successfully or not.

    Sample code
    <gel:script 
    xmlns:core="jelly:core"
    xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
    xmlns:x="jelly:org.apache.commons.jelly.tags.xml.XMLTagLibrary"
    xmlns:winscp="http://winscp.net/schema/session/1.0">
    
    
    <core:set value="winscp424 /console /timeout=180 /script=d:\sftp_test_ray.txt /log=d:\test_ray.xml /parameter test_ray.txt" var="myArgsSFTP"/>
    
    <core:invokeStatic className="java.lang.Runtime"
    method="getRuntime" var="javaRuntime"/>
    
    <!--sending the file test_ray.txt using the below code-->
    <core:catch var="c_SFTP">
    <core:invoke method="exec" 
    on="${javaRuntime}" var="execSFTP">
    <core:arg type="java.lang.String" value="${myArgsSFTP}"/>
    </core:invoke>
    </core:catch>
    <gel:out>Batch Output: ${c_SFTP}</gel:out>
    <gel:log>sFTP Messages: ${c_SFTP}</gel:log>
    
    
    <!--Reading output to check if file sent is successful or not-->
    <gel:parse var="xmldoc" file="d:\test_ray.xml" />
    <gel:set var="status" select="$xmldoc/winscp:session/winscp:upload/winscp:result/@success" asString="true" />
    <gel:out>Successful? - ${status}</gel:out>
    
    </gel:script>
    http://winscp.net/eng/docs/scripting#example
    in this link you will find the example of WINSCP Scripting.

    Dipanjan