SFTP Client PUT Service

The SFTP Client PUT service places a document or documents in a specified directory on the trading partner's SFTP server.

The following table provides an overview of the SFTP Client PUT service:

System name SFTP Client PUT Service
Graphical Process Modeler (GPM) category All Services, B2B Protocols > SFTP Client
Description Used to place a document or documents in a specified directory on the trading partner's SFTP server.
Business usage Use this service to transfer a document or documents from Sterling B2B Integrator to a trading partner when the SFTP protocol is required as the transport mechanism.
Usage example A business process is executed that translates a document or documents to send to a trading partner. After the translation, Sterling B2B Integrator uses the SFTP Client PUT service, working through the SFTP Client adapter, to place the document or documents in a specified directory on the trading partner system.
Preconfigured? Yes. To implement, use the preconfigured service in a business process.
Requires third-party files? No
Platform availability All Sterling B2B Integrator supported platforms
Related services The following services are related. Configured in a business process, they initiate the SFTP Client adapter to perform their operations:
  • SFTP Client Begin Session service
  • SFTP Client CD service
  • SFTP Client DELETE service
  • SFTP Client End Session service
  • SFTP Client GET service
  • SFTP Client LIST service
  • SFTP Client MOVE service
  • SFTP Client PUT service
  • SFTP Client PWD service
The SFTP Client PUT service must be placed between an SFTP Begin Session service and an SFTP End Session service. It may be used to put a document that is returned from an SFTP Client GET service.
Application requirements An SFTP Server at the external trading partner location
Initiates business processes? No
Invocation This service is invoked from a business process.
Business process context considerations None
Returned status values 0 – Success, 1 – Error
Restrictions None
Persistence level System default
Testing considerations To test this service, run the SFTPClientDemoAllServices business process and verify that it completes successfully. For more information about the SFTPClientDemoAllServices business process, see the SFTP Client adapter documentation. For debugging information, go to Operations > System > Logs > SFTP Client Adapter and Services

Input from Business Process to Service

The following table contains the parameters passed from the business process to the SFTP Client PUT service:

Field Description
DocumentId

Document ID to PUT to the remote server. A single DocumentId can appear directly in the message to the service or any number of DocumentIds can appear under the DocumentList element. Optional.

Note: The SFTP Client PUT service will use DocumentList if a list is provided. If no list is specified in DocumentList, the service will use DocumentId. The service will not use both DocumentList and DocumentId. If no values are specified for either DocumentList or DocumentId, the service will PUT the primary document to the remote server.
RemoteFileName Name of the file used to place the document on the remote trading partner server. If not specified, the name of the document will be used. Optional.
ResponseTimeout Maximum number of seconds it can take for the trading partner system to respond before the session times out and terminates. If a number less than 30 is specified, 30 seconds will be used. Optional. Default is the ResponseTimeout value specified in the SFTP Client Begin Session service.
SessionToken Returned SessionToken from the Begin Session service. Required.
Primary Document File transferred as a result of the PUT service.
DocumentList

List of documents to PUT to the remote server. Each item must be a DocumentId. A list could look like the following example:

<DocumentList> 
  <DocumentId>12345</DocumentId>
  <DocumentId>67890</DocumentId>
</DocumentList>
UseDocBodyName

Specifies whether to use document body name as the remote file name. This parameter is only use in MPUT operation. Optional.

Valid values are:
  • Yes – Use document body name
  • No – (Default) Use document name

Output from Service to Business Process

The following table contains the parameters passed from the SFTP Client PUT service to the business process:

Parameter Description
ServerResponse The SFTP server response, which may include a reply code and any text associated with the reply code. Valid values are:
  • 0 - OK
  • 2 - No Such File
  • 3 - Permission Denied
  • 4 - General Failure
  • 5 - Bad Message
  • 6 - No Connection
  • 7 - Connection Lost
  • 8 - Operation Unsupported

Business Process Example

The following business process excerpt uses the SFTP Client Adapter to send the primary document from Sterling B2B Integrator to the remote SFTP server using the SFTP Client PUT service:

[[Insert Begin Session]]
 
    <operation name="SFTP PUT SERVICE">
    <participant name="SFTPClientPut"/>
      <output message="PutRequest">
       <assign to="SessionToken"
         from="/ProcessData/SftpBeginSessionServiceResults/SessionToken/text()">
       </assign>
       <assign to="RemoteFileName">FilenameToPut</assign>
       <assign to="." From="PrimaryDocument"></assign>
     </output>
      <input message="inmsg">
       <assign to="SftpPutServiceResults" from="*"></assign>
     </input>
    </operation>
[[Insert End Session]]

The following business process excerpt uses the SFTP Client Adapter to send a document received from a GET from Sterling B2B Integrator to the remote SFTP server:

[[Insert Begin Session]]
   <operation name="Get">
      <participant name="SFTPClientGet"/>
      <output message="GetRequest">
       <assign to="SessionToken" 
             from="/ProcessData/SftpBeginSessionResults/SessionToken/text()">
       </assign>
       <assign to="RemoteFileName"&gt;FilenameToGet&lt/assign>
     </output>
      <input message="GetResults">
       <assign to="GetResults" from="DocumentId"/>
     </input>
  </operation> 
    <operation name="Put">
      <participant name="SFTPClientPut"/>
     <output message="PutRequest">
       <assign to="SessionToken" 
             from="/ProcessData/SftpBeginSessionResults/SessionToken/text()">
       </assign>
       <assign to="." From="/ProcessData/GetResults/DocumentId"/>
    <input message="SFtpPutResults">
       <assign to="PutResults" from="*"></assign>
    </input>
    </operation>
[[Insert End Session]]

The following business process uses the SFTP Client adapter to send all documents received from a GET operation from Sterling B2B Integrator to the remote SFTP server:

[[Insert Begin Session]]
<operation name="Get">
<participant name="SFTPClientGet"/>
<output message="GetRequest">
<assign to="SessionToken"
from="/ProcessData/SftpBeginSessionResults/SessionToken/text()">
</assign>
<assign to="RemoteFilePattern">*.*</assign>
</output>
<input message="GetResults">
<assign to="GetResults" from="DocumentList"/>
</input>
</operation>
<operation name="Put">
<participant name="SFTPClientPut"/>
<output message="PutRequest">
<assign to="SessionToken"
from="/ProcessData/SftpBeginSessionResults/SessionToken/text()">
</assign>
<assign to="." From="/ProcessData/GetResults/DocumentList"/>
<input message="SFtpPutResults">
<assign to="PutResults" from="*"></assign>
</input>
</operation>
[[Insert End Session]]

Correlations and Document Tracking

The following table details the correlations available from the SFTP Client PUT service for document tracking:

Key Values
ACTION Get, Put
Direction Inbound, Outbound
Protocol SFTP
RemoteHostAddress remoteAddress
RemoteHostName remoteHost
Username username
RemoteFile filename