This example hosts ediFabric Native behind an AWS Lambda and API Gateway HTTP API. It translates X12 EDI to JSON and back, validates transaction sets, and generates acknowledgments using the C# bindings from edifabric-csharp-bindings.
The native library is a self-contained shared library. No EdiFabric.Api NuGet package (aka EdiNation InHouse) is required on the target machine beyond this Lambda host.
- Visual Studio or the .NET 10 SDK.
- An AWS account and the AWS Toolkit for Visual Studio or the Amazon.Lambda.Tools CLI.
- Download Postman - it's an application to consume/test your API.
- The native library for your platform:
| Platform | File |
|---|---|
| Windows (local) | edifabric-x12-tools.dll |
| Linux (AWS Lambda) | edifabric-x12-tools.so |
| macOS | edifabric-x12-tools.dylib |
Download ediFabric Native Library
Put the library in the repository root or in EdiFabric.Api.AWS, or set Configuration.LibraryPath / EDIFABRIC_X12_LIB. The project copies it next to the Lambda package on build when it is found in those folders. Deploy the Linux .so with the function.
Set Configuration.ApiKey to your serial. The free-plan serial is:
bd96a836feca45cb91c86ee65d281f52
The free plan authorizes with set_serial only. Tokens (S3Cache) are available for the Enterprise license.
Rebuild the solution. If there are any build errors, contact us at https://support.edifabric.com/hc/en-us/requests/new for assistance.
The C# bindings live in EdiFabric.Api.AWS/Native (NativeMethods.cs and EdiFabricX12.cs), copied from the edifabric-csharp-bindings repository.
By default the API uses the online spec service (SetMap with "default": "<serial>"). To use local JSON models instead, place a map/map.json next to the Lambda project (see the bindings README for the map format).
To deploy, follow the steps in the How to use EDI API as AWS Lambda article, then POST X12 EDI to:
| Endpoint | Native call | Input | Output |
|---|---|---|---|
POST /x12/read |
EdiFabricX12.Parse (JSON only) |
X12 | JSON |
POST /x12/write |
EdiFabricX12.Build |
JSON (the output from /read) | X12 |
POST /x12/validate |
EdiFabricX12.Parse (JSON + validation report) |
JSON (the output from /read) or X12 | JSON |
POST /x12/ack |
EdiFabricX12.Parse (JSON + validation + 999/997/TA1) |
JSON (the output from /read) or X12 | JSON |
The source code in these example projects is strictly for demonstrational purposes and is provided "AS IS" without warranty of any kind, whether expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.