IMD SolutionComputing LibraryShop main store

Explainer

Why an edge gateway needs an HTTP endpoint to write a database

Edge computing and IIoT Published 6 min read

Short answer

An edge gateway has no SQL client, so it cannot write to a database directly. Front the database with an HTTPS endpoint and have the gateway script POST a batch of tag values at most once per second; the endpoint script performs the write. On one documented platform that means 200 values per call, delivered in seconds instead of hourly.

On this page
  1. Why the gateway cannot talk to the database directly
  2. The three pieces of the HTTP endpoint pattern
  3. What sets the update rate
  4. Example: 200 tags pushed every second versus hourly extraction
  5. What the server-side script owns
  6. The decision for each case
  7. Questions asked

An edge gateway cannot push data to a database by itself: its scripting runtime has no SQL client, so no gateway script can open a connection and run an INSERT. The fix is architectural, not a setting. Put a small web service — an HTTPS endpoint — in front of the database, and have the gateway script collect its tag values in one batch and send them as an HTTPS POST. The endpoint, not the gateway, performs the write. On the eWON platform, whose limits are documented and quoted below, that means a per-call batch of 200 tag values at a cadence capped at one call per second — which turns an hourly mailbox export into near-real-time delivery. This article explains why the pattern exists, what sets its rate, and where the decision lands for each case.

Why the gateway cannot talk to the database directly #

Gateway runtimes are built for collection and transport, not for database sessions. A BASIC-style scripting engine or a sandboxed Java environment on an embedded OS has no ODBC manager and no vendor SQL driver; the socket functions you get are generic HTTP(S) client calls. On eWON, the vendor confirmed that direct SQL execution is not supported, including from its Java environment, so this is a platform limit rather than a gap in one firmware release.

What the runtime does give you is exactly the toolset the endpoint pattern needs: functions to read tags, to build a payload, and to issue an HTTPS request. The database protocol lives one hop away, on a machine that has a real database client.

The three pieces of the HTTP endpoint pattern #

The data path separates acquisition, transport and storage:

Gateway tags
  |  one tag-export read of all live values
  v
Gateway script  -- HTTPS POST -->  Web endpoint (PHP or similar)
                                      |  native database operation
                                      v
                                   Database
  1. Collection. Read all the tag values in one export call instead of one call per tag. On eWON the tag-export expression EBD $dtIV$ftT returns the live values of the whole selection in a single read.
  2. Transport. The gateway script submits the payload with its HTTP request function — REQUESTHTTPX on eWON — as an HTTPS POST to the endpoint URL.
  3. Storage. A server-side script validates the request, maps each tag to its field, and executes the database-specific write. The gateway never learns the database's protocol.

If the values already reach an OPC server on a PC, you can skip the gateway hop entirely and log straight from the PC, as in the OPC server to SQL Server logging path ([article:logging-plc-values-from-an-opc-server-into-sql-server]).

What sets the update rate #

Two documented constraints on the eWON platform define the timing:

  • The HTTP request function may be called at most once per second, triggered by a 1-second timer in the script. That is the cadence cap.
  • The HTTPS call is not executed inline. It is handed to a separate scheduler — the Schedule actions task — which may add a small, unquantified delay between the script's call and the actual send.

So the endpoint path delivers one batch per tick, and each batch is one export read. The controller-side equivalent of disciplined once-per-second execution is a cyclic interrupt: the S7-1200 cyclic interrupt OB that executes code exactly once per second is the PLC counterpart to the gateway's 1-second timer ([guide:s7-1200-cyclic-interrupt-ob-execute-code-once-per-second]).

Example: 200 tags pushed every second versus hourly extraction #

Inputs, and where each comes from:

  • Batch size: 200 tag values per call — the documented single tag-export read on the eWON platform.
  • Cadence cap: 1 call per second — the documented maximum for the request function with the 1-second timer.
  • Current method: mailbox API extraction once per hour, delivering the same 200 values in each pull — the case as reported.

Rule in words: hourly capacity equals the tags per call multiplied by the calls per hour; delivery latency is roughly the interval between consecutive sends.

Arithmetic:

  • Calls per hour = 3600 s/h ÷ 1 s/call = 3600 calls/h
  • Endpoint capacity = 3600 calls/h × 200 values/call = 720,000 values/h
  • Hourly mailbox capacity = 1 extraction/h × 200 values = 200 values/h
  • Volume ratio = 720,000 ÷ 200 = 3600 times the hourly extraction
  • Latency: the mailbox path delivers values up to 3600 s old (about 1800 s on average); the endpoint path delivers within about 1 s of the timer tick, plus the small scheduler delay the vendor does not quantify.

Decision: at up to the documented batch size and the cadence cap, the endpoint path carries 720,000 values per hour — 3600 times the mailbox volume — and each value lands in seconds instead of up to an hour later. If the application needs more than that batch in one second or a faster cadence, this platform's documented limits stop you: split the tags across gateways or move collection onto a PC-based host that runs a full database client.

What the server-side script owns #

The endpoint is where every decision about the data gets made. Define before deployment: the payload format, the tag-to-field mapping, timestamp handling (gateway time versus receipt time), endpoint authentication, retry behavior, and duplicate handling. None of these is specified by the platform, so they are yours to choose and test.

One security note: require authentication on the endpoint and open exactly one firewall rule from the gateway to it on the needed port — never expose a write endpoint unauthenticated where the plant network can reach it.

MongoDB fits only at this layer. No native gateway support is documented, so the endpoint script must implement the store's own write operation, and the store is evaluated as middleware, not as a gateway feature. The endpoint host itself is modest: a VM, an existing server, or a fanless mini PC at the plant edge ([category:all-mini-pc]). During commissioning, verify records at the database and compare receipt times with the gateway's send schedule, following the edge gateway commissioning sequence ([article:edge-gateway-commissioning-sequence-for-plant-data]).

The decision for each case #

  • Hourly delivery is good enough. Keep the mailbox API extraction. It works, and building the endpoint buys nothing at that cadence.
  • Near real time, up to the documented batch, from a gateway. Build the endpoint pattern: one tag-export read per tick, one HTTPS POST per tick, the endpoint writes. Commit to the 1-second timer as the design.
  • More throughput, buffering, or historian features. The gateway path has no store-and-forward and a hard cadence cap. Move collection onto a PC-based edge host with a real database client; if the destination is a broker rather than SQL, the OPC UA PLC data to MQTT edge pattern is the matching design ([article:bridging-opc-ua-plc-data-to-mqtt-with-an-edge-pc]).
  • Values already on a PC via OPC. Skip the gateway and log directly from the PC into the database.

The pattern is not a workaround — it is the supported architecture. The gateway collects and transports; the endpoint, on a machine that has a database client, writes.

Questions asked

What happens to a batch if the endpoint is down when the timer fires?

The HTTPS call fails and that batch is gone, because this path documents no automatic buffering or retry. Whether a failed send is retried is logic you write into the gateway script yourself, or buffering you add at the endpoint. If you need loss-free logging through an outage, put local store-and-forward between the gateway and the database and test the backlog behavior on your platform before you trust it.

Where should the HTTPS endpoint run?

On a server or DMZ segment the gateway can reach, behind one firewall rule limited to that gateway and that port. A small virtual machine is enough for this write load; a fanless box at the plant edge works when the endpoint must live on site. Keep the endpoint out of the control network, require authentication, and log the source address of every accepted request.

Can the gateway write to MongoDB directly?

No native support is documented for writing MongoDB from the gateway runtime, and the same holds for any store whose protocol the runtime does not ship. The only supported evaluation point is the middleware layer: the endpoint script implements the store's own driver or connector operations, and you confirm the exact connector version on the endpoint host before you commit to that database.

Keep reading

  • Comparison

    Getting Wonderware Historian data into Ignition Edge for MQTT

    Yes — Ignition Edge can publish this data as MQTT Sparkplug, but through two separate routes. Live values come from the existing DAServer acquisition layer behind a DA-to-UA gateway, because Edge's OPC client is UA-only. History and aggregates come from SQL queries against the Historian Runtime database, using its documented stored procedures.

    Edge computing and IIoT

  • How-to

    Write tags on an edge gateway from an MQTT JSON payload

    Yes. Subscribe the gateway to one command topic with QoS 0, publish a flat JSON object whose property names match tag names exactly, and run a BASIC callback that splits the payload at commas, writes strings directly when the tag type is "6", converts numerics through VAL, and skips any name that fails to load with LSTERR -4.

    Edge computing and IIoT

  • How-to

    Bridging OPC UA PLC data to MQTT with an edge PC

    Keep the OPC UA server on the PLC side and give MQTT publishing its own role on a separate edge PC that acts as the OPC UA client and MQTT publisher. Commission the two links independently — first a verified tag read, then a verified subscriber message — and only then widen the tag set.

    Edge computing and IIoT