B2B Integration

 View Only
Expand all | Collapse all

Expected Document Not Found in SFTP client put service

  • 1.  Expected Document Not Found in SFTP client put service

    Posted Thu September 21, 2023 08:54 AM

    Dear Team,

    Greetings of the day. 

    We are trying to send files from SFG to remote SFTP server using SFTP client put service. We have created SFTP client adapter, SSH remote profile and developed a business process. Whenever we are trying to execute the business process we are facing the error "Expected Document Not Found". 
    Here the SFTP put service BP can you please suggest the solution for the issue.

    <operation name="SFTP PUT SERVICE">
                <participant name="SFTPClientPut"/>
                <output message="PutRequest">
                    <assign to="SessionToken" from="SessionToken/text()"/>
                    <assign to="RemoteFileName">test</assign>
                    <assign to="." from="/opt/files/test.txt"></assign>
                </output>
                <input message="inmsg">
                    <assign to="SftpPutServiceResults" from="*"></assign>
                </input>
            </operation>

    Basically we are trying to upload files from our server where we have installed SFG/B2Bi. Here /opt/files/test.txt  test is the file need to send to the remote SFTP server from SFG side. Kindly suggest an resolution for the above issue as per our requirement.

    Regards

    Laxman



    ------------------------------
    Laxman Porandla
    ------------------------------


  • 2.  RE: Expected Document Not Found in SFTP client put service

    Posted Fri September 22, 2023 06:49 AM

    Hi Laxman,

    Your assign to="." isn't right. The SFTP Client Put looks for, in order of preference, a DocumentList parameter, a DocumentId parameter, or if neither of those are present the PrimaryDocument. The error you're seeing is that presumably there is no PrimaryDocument for it to PUT.

    You need to get the file you're sending into B2Bi and so into your BP so that it can be sent. If it's on filesystem then you'll need to for example use the FileSystemAdapter to first read the file from the filesystem. Typically with SFG the file will be in a mailbox so the document id can be obtained from the message details, or in a custom delivery process the file will already be in PrimaryDocument when the delivery BP gets invoked in FileGatewaySendMessage.

    An SFG flow might be to have a filesystem adapter that watches a folder and for each new file found bootstraps a BP to load the file into a mailbox associated with an SFG producer partner. You then have a routing channel associated with the mailbox that routes the file to the consumer partner which is configured via a custom delivery protocol to use your SFTP PUT BP to send the file to them.

    Best regards,

    Richard.



    ------------------------------
    RICHARD CROSS
    ------------------------------