Socket Write Service (V5.2.3 or later)

The Socket Write service send Sterling B2B Integrator data to a remote TCP server and to respond to a request from a remote TCP client.

The following table provides an overview of the Socket Write service:

System name Socket Write Service
Graphical Process Modeler (GPM) categories All Services
Description This service writes data by using a TCP socket.
Business usage A business user uses this service to send Sterling B2B Integrator data to a remote TCP server and also to respond to a request from a remote TCP client.
Usage example A remote TCP client connects to the Sterling B2B Integrator Socket server and transfers a fixed number of bytes. The Sterling B2B Integrator Socket server reads the data, processes the data, and then responds back with the processed data by using the Sterling B2B Integrator Socket Write service.
Preconfigured? No
Requires third-party files? No
Platform availability All supported Sterling B2B Integrator platforms.
Related services Related services:
  • Socket Read service
  • Socket Write service
  • Socket Close service
  • Socket Client adapter
  • Socket Server adapter
Application requirements A TCP server at the external trading partner's location is required. Information about this TCP server must be configured in the Socket Connect service or in a TCP client that connects to the Sterling B2B Integrator Socket Server adapter running a business process using this service.
Initiates business processes? No
Invocation This service is invoked from a business process.
Business process context considerations A business process using the Socket Write service should not be configured to automatically resume. The Socket Write service requires an established session which will not exist if the business process is set to automatically resume.
Returned status values Returned status values:
  • 0 - Success
  • 1 - Error
Restrictions None
Persistence level System Default
Testing considerations None

Implementing the Socket Write Service

To implement the Socket Write service, complete the following tasks:
  1. Configure the Socket Write service. For information, see Configuring the Socket Write Service below.
  2. Use the Socket Write service in a business process.

Configuring the Socket Write Service

To edit the configuration of the predefined Socket Write service, you must specify field settings in the user interface service configuration:

Field Description
Name Name for the service in Sterling B2B Integrator. Required.
Description Description of the service. Required.
Select a Group Selection or creation of the group for this service. Optional.

Output from Service to Business Process

The following table contains the Graphical Process Modeler (GPM) parameters passed from the Socket Write service to the business process:

Parameter Description
SocketWrite/Code Response code indicating if the write was competed successfully. Required.
SocketWrite/BytesWritten Indicates the number of bytes written over the socket. Required.

Output from Business Process to Service

The following table contains the Graphical Process Modeler (GPM) parameters passed from the business process to the Socket Write service:

Parameter Description
NodeToRead Name of the node under process data from where the data is read and written across the socket. Optional.
DocumentId Document identifier of the document whose data is written over the socket. If the DataNode or DocumentId is not specified, the data from the primary document is written over the socket. Optional.
ResponseTimeout Maximum number of seconds it can take for the trading partner system to respond before the service terminates. The number of seconds cannot be less than 30. Optional.
SessionToken Specifies the identifier of the session established between a Socket Client adapter and a TCP server or between a Socket Server adapter and a TCP client. Required.
Encoding Format used to encode all outgoing and incoming data. Encoding will not be used if it is not specified. Optional.
DelayWaitingOnIO Specifies the number of seconds to wait for the data transfer to complete before going into WAITING_ON_IO state. If -1 is specified, the service operates in blocking mode and the service waits until the data transfer has completed. Optional.

Business Process Example

Note: If the Socket Write service is used as part of a Socket Server adapter business process, then the Socket Connect service is not needed before using the Socket Write service.

The following example business process illustrates using the Socket Write service:

This process writes data from the process data node to the socket.

<process name="SocketExample">
  <sequence>

[[Insert Socket Connect service here for Socket Client adapter]]
 
       <assign name="Assign" to="testNode">This data is used for testing</assign>
    <operation name="SocketWriteServiceType">
      <participant name="SocketWriteService"/>
      <output message="SocketWriteServiceTypeInputMessage">
        <assign to="SessionToken" from="/ProcessData/SocketConnectServiceResults/
                    SessionToken/text()"></assign>
        <assign to="." from="*"></assign>
        <assign to="NodeToRead" from="/ProcessData/testNode/text()"></assign>
      </output>
      <input message="inmsg">
        <assign to="." from="*"></assign>
      </input>
    </operation>
[[Insert Socket Close Service here]]
</process>  

This process writes data from the document with the specified DocumentId to the socket.

<process name="SocketExample">
  <sequence>

[[Insert Socket Connect service here for Socket Client adapter]]
 
    <operation name="SocketWriteServiceType">
      <participant name="SocketWriteService"/>
      <output message="SocketWriteServiceTypeInputMessage">
        <assign to="." from="*"></assign>
        <assign to="DocumentId" from="blrgislin10:node1:132393c76af:1483 "></assign>
      </output>
      <input message="inmsg">
        <assign to="." from="*"></assign>
      </input>
    </operation>
[[Insert Socket Close Service here]]
</process>