search cancel

FTP Assertion and Policy how to expose message variable and results of the FTP.


Article ID: 221213


Updated On:


CA API Gateway


When using the ftp assertion as documented I dont see the expected results. Like a file list (MLSD) only returns an Successfully transferred "/" 
How do I see / utilize the output of my FTP Assertion back from the FTP server? So that I can modify the message or use the results?


Release : 10.0

Component :


The problem here is using the return template response as documented, it overrides the FTP stream. 

* * * Template response,
# curl --insecure https://localhost:8443/ftptest3


Successfully transferred "/" 


* * * No Return Template Response, 

# curl --insecure https://localhost:8443/ftptest3 
type=file;modify=20210513222741;size=0; myfile 
type=dir;modify=20210730144329; ssgautotest

After removing the return template response you can review the ouput of the assertion
by referencing, these Variables from Message Layer Context variables to store them from binary to variables.

${<target>.parts.X.body}  - Returns the content of the Xth MIME part of the message, if it is accessible as text.
${<target>.parts.1}  - Returns the content of the main/root MIME part of the message, if it is accessible as binary data
${<target>.parts.1.size} -  Returns the size of the main/root MIME part in bytes.


I checked the ${response.buffer.status} which confirmed these are being buffered by the GW

And thus can be utilized in the policy to write/wrap additional logic around your results.