Introduction:
In field services, efficient barcode printing is crucial for tracking inventory and facilitating operations. Our recent project enabled Zebra barcode printers to seamlessly integrate with OutSystems while delivering a secure print-anywhere solution for physical printers on sites across Australia.
This task was challenging due to the printers’ reliance on WebSockets for communication and security requirements, as well as the distributed nature of the printers over various networks, spread across the country in multiple sites. To provide a more expansive illustration, imagine print jobs cascading across a vast network, engaging with many printers in parallel.
This article explores how we developed a robust Print Server solution to bridge the gap between OutSystems and Zebra printers, enabling field services printing in a distributed manner.
Use Case:
Our solution targets field service scenarios where barcode printing on Zebra printers is essential, especially in remote locations where accessibility is paramount. The ability to print labels on demand, regardless of location, is vital for efficient inventory management and tracking.
Objective:
The primary objective of our project was to enable Zebra printers to print labels via OutSystems, a task complicated by the printers’ unique communication requirements. By developing a Print Server intermediary layer, we aimed to facilitate seamless communication between OutSystems and Zebra printers, ensuring reliable and efficient printing operations.
Technologies Used:
- OutSystems: for application development and integration
- WebSockets: for establishing and maintaining communication with Zebra printers
- .NET Framework: for building the Print Server application
- Azure WebApp: for hosting the Print Server solution
Challenges to Overcome:
Implementing WebSocket communication in distributed environments, including managing stateful connections and ensuring compatibility with OutSystems’ stateless architecture, is a complex software engineering problem.
Our solution enables OutSystems to communicate with Zebra printers through a middleware layer that can accept and maintain a WebSocket connection from the printer while exposing a RESTful API to be consumed by OutSystems. However, WebSockets’ inherently stateful nature meant that the server process had to remain active for the duration of the connection, which could span weeks or months. This presented compatibility issues with OutSystems’ stateless actions and constraints imposed by the OutSystems Cloud security, which, does not allow for opening the ports required for printers to reach them directly. We developed a solution that allows seamless communication between OutSystems and Zebra printers, enabling efficient printing operations in various field service scenarios using HTTPS and the secure middle layer.
Configuring a printer requires obtaining its local IP address, conveniently displayed on the front screen once online. Subsequently, a command containing the Print Server address and relevant parameters, followed by a restart command, was sent from OutSystems via the Print Server. Upon startup, the printer would attempt to connect to the Print Server, with persistent attempts in case of network connection loss. On the server side, any connected printer would be immediately provided with print jobs while maintaining connections in memory to efficiently relay print job details from the exposed RESTful API.
Additionally, useful tools were provided to the OutSystems Application, facilitating the listing and search of connected printers, their status, and a history of processed print jobs.
Functionality Extension:
Our solution extends OutSystems’ functionality by enabling it to consume WebSocket connections, a capability not natively supported by the platform. Unlike traditional RESTful APIs, WebSockets maintain a stateful connection, requiring a middleware layer to manage communication between OutSystems and Zebra printers. This Print Server solution fills that gap, ensuring seamless integration and efficient printing operations securely and reliably.
Conclusion:
In conclusion, Our Print Server for Zebra barcode printers functionality is a testament to our commitment to overcoming technical hurdles and delivering robust solutions that empower field service organisations to optimise their operations and enhance overall efficiency. With the ability to print labels on demand from any location, businesses can optimise their field services workflows and deliver superior customer experiences.
Author info
Nigel Lamb
Senior OutSystems Developer