IntegrationsIntegrate by Event Socket Consumer

Event Socket Consumer integration extends the functionality of other applications so users can print labels generated with data provided by those applications through a direct socket connection. The connection is one-way and there is no response from Loftware Enterprise SP over the socket — the client connects, sends data, and then closes the connection.

Print Labels Generated by XML (LPS) Data

You can use an Event Socket Consumer integration to accept XML (LPS) data through a socket connection and initiate a print job. To create an Event Socket Consumer integration that accepts XML (LPS) data for job requests, do the following.

  1. In Integrations Integrations, in the ribbon click > Event Socket Consumer to create an Event Socket Consumer integration.
  2. In the Basic Configuration panel, configure the following details.
    1. For Hostname, enter the host name or IP address of the Loftware Application Server. If your instance of Loftware Enterprise SP has multiple network interface cards (NICs), you must specify this field. If left blank, the host name is determined automatically.
    2. For Port, enter the listener port number for the socket. The default port is 2813.
    3. For Run As, select the Loftware Enterprise SP user account under which print requests associated with this integration should be run. This user account must have at least the INTEGRATOR role or equivalent permissions.
    4. For Error Log Level, select the type of message to include in log files.
  3. In the Processors panel, configure the following details to allow Loftware Enterprise SP to process the XML (LPS) data.
    1. Under Available Processors, select Job Request Converter and then click Add Before.
    2. With Job Request Converter selected under Configured Processors, click the Main Script panel. This processor will convert the input to a Job Request.
    3. For Input Type, select the type of input. If you select Not Set, the input must already be a Job Request, or you can enter a script with custom logic to convert your input to a Job Request.
  4. Under Available Processors, select Job Service and then click Add After to allow the integration to initiate print jobs.
  5. Under Available Processors, specify a unique job target folder for the integration.
    1. With Job Service selected under Configured Processors, click the Main Script panel.
    2. Enter the following script:

      getMessageBody().setFolderUrl("/Default/Job_Target_folder");

       

      /* The following must be included to send the job request when using a script. */

      processRequest();

  6. If you want to specify a process for the integration, configure the following additional details for Available Processors.

    Note: This step is optional. If not specified, the integration uses the Generic Document Process.

    1. With Job Service selected under Configured Processors, click the Main Script panel.
    2. Enter the following script before the processRequest(); line.

      var processUrl = "/Default/Process";

      var processes = getMessageBody().getProcesses();

       

      var iter = processes.iterator();

      while (iter.hasNext()) {

      var process = iter.next();

      process.setProcessUrl(processUrl);

      log("\n***process: " + process);

      }

    Example

    The following script specifies a job target folder named MyFolder with the path in Loftware Enterprise SP Loftware Inc/MyFolder, and a process named MyProcess with the path Loftware Inc/MyProcess.

    getMessageBody().setFolderUrl("/Loftware Inc/MyFolder");

     

    var processUrl = "/Loftware Inc/MyProcess";

    var processes = getMessageBody().getProcesses();

     

    var iter = processes.iterator();

    while (iter.hasNext()) {

    var process = iter.next();

    process.setProcessUrl(processUrl);

    log("\n***process: " + process);

    }

     

    processRequest();

  7. In the Properties pane, enter a description of the purpose of the integration.
  8. Click File > Save or click Save Save in the toolbar.
    1. In the Save dialog box, enter a name for the integration.

    2. In the left pane of the Save dialog box, select the folder in which to save the integration. You can click a folder to display subfolders.
    3. Click OK to save the integration. Creation information is displayed in the Properties pane.
  9. In the ribbon, click HomeStart Integration.
  10. To verify that the integration has started, view the Status in the Properties pane.

Important! Whenever you add a new device, data service, integration, or facility, you must ensure that the service is activated on all Loftware Application Servers on which it should be available to run and started on at least one. In an environment with only one Loftware Application Server, these types of services are automatically activated and started when they are created. For more information, see High Availability with Distributed Services.