SFTP:put errors when contentstream is given as input parameter

Hi,

When trying to use the SFTP:put service in my flow service with following input parameters ,
I am getting an error either access denied or pipe close or directory error .
Step 1: ERRORS
inputs are session key, Content stream (converting the EDI data(String) to stream and passing the value),remote file (remote location folder path)
Step 2: SUCCESS
inputs are session key , local file (writing my EDI data to local temp folder and using that path ),remote file (remote location folder path)

Need some advise what is wrong with step 1 .

Thanks in Advance

Access denied and directory errors seem to be design-time errors, while pipe closed is the runtime one.
Can you post the actual error messages in full, along with their respective stack traces?

KM

Hi @Venkata_Kasi_Viswanath_Mugada1

I am passing java.io.ByteArrayInputStream in content stream along with session key and remote file (/in/EDI998)

ERROR: Error while executing command ‘put’: /in/EDI998: Access is denied

Do you need more details

If this is a remote folder wherein you’re creating a file directly, the error is straightforward to me. Can you check if the remote server/folder requires additional authorization or has streaming restrictions?

Your local put followed by a file transfer to the remote folder works, so the issue seems isolated to the remote location and that’s where I’d investigate.

Having said that, I recommend creating a local file, then transferring that file to the remote location and finally deleting the local copy if the transfer was successful. This helps in handling failure scenarios better in environments that are prone to disruptions, even though the mode parameter provides a resume option.

KM

1 Like

Thank you @Venkata_Kasi_Viswanath_Mugada1 for the quick response.

when using the step 2 it works fine. no issues only when i use the content stream option it throws access denied .
I also check on the permission level for each folder with the EDI partner all good.
yes , I will go with step 2 for now.

Thank you once again

Happy to help!

Option 1 should work, but I haven’t tested it personally - do open a support ticket if you need further assistance. I prefer Option 2 when I design for a problematic environment.

KM

Hi, can you please try sending as bytes and also try with explicit setting active or passive mode too.

HTH,
RMG

When using a stream as input to the service, are you specifying a filename or just the folder path? If just the folder path, that is likely why it is failing. Trying to write the stream to the directory itself, not a file. When you specify a file as input, it will use the name of the file as the name of the remote file. From the docs: “If you specify localFile , then remoteFile and contentStream are optional. In this case, the
remote file will be given the same name as the local file.”

Make sure the remoteFile string specifies a filename, not just the directory name. The “/in/EDI998” string you mention above looks like a dir name, not a complete filename.

1 Like

yes good catch item… please try mentioning the remoteFile name aswell - /in/EDI998/%remotefilename%.edi and test it as Rob suggested! :slight_smile:

Cheers!
RMG

Hi Saranya,

Are you able to fix these issues??

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.