Skip to main content

Quick Start — SOAP API

ECGridOS SOAP is standard SOAP 1.1 over HTTPS. Under the hood it is a plain HTTP POST with an XML envelope body — any HTTP client in any language can call it.

Service Endpoint & WSDL

URL
Service endpointhttps://os.ecgrid.io/v4.1/prod/ECGridOS.asmx
WSDLhttps://os.ecgrid.io/v4.1/prod/ECGridOS.asmx?WSDL
XML namespacehttps://os.ecgrid.io/

How SOAP Works

Every call is an HTTP POST to the service endpoint with a SOAPAction header identifying the method. You can build this with any HTTP library, or use a SOAP library that consumes the WSDL directly.

POST https://os.ecgrid.io/v4.1/prod/ECGridOS.asmx
Content-Type: text/xml; charset=utf-8
SOAPAction: "https://os.ecgrid.io/MethodName"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/>
<soap:Body>
<MethodName>
<SessionID>YOUR_SESSION_ID</SessionID>
<Param1>value</Param1>
</MethodName>
</soap:Body>
</soap:Envelope>

Every method except Login takes SessionID as its first parameter.


Step 1 — Login

Obtain a SessionID by calling Login or use your User account API Key the two are interchangeable. Pass it as the first parameter to every subsequent call.

SOAPAction: "https://os.ecgrid.io/Login"

using System.Net.Http;
using System.Text;
using System.Xml.Linq;

var username = Environment.GetEnvironmentVariable("ECGRID_USER")!;
var password = Environment.GetEnvironmentVariable("ECGRID_PASS")!;

using var http = new HttpClient();

var envelope = $"""
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/>
<soap:Body>
<Login>
<UserID>{username}</UserID>
<Password>{password}</Password>
</Login>
</soap:Body>
</soap:Envelope>
""";

using var content = new StringContent(envelope, Encoding.UTF8, "text/xml");
content.Headers.Add("SOAPAction", "\"https://os.ecgrid.io/Login\"");

var response = await http.PostAsync(
"https://os.ecgrid.io/v4.1/prod/ECGridOS.asmx", content);
response.EnsureSuccessStatusCode();

var xml = XDocument.Parse(await response.Content.ReadAsStringAsync());
XNamespace ns = "https://os.ecgrid.io/";
var sessionId = xml.Descendants(ns + "LoginResult").First().Value;

The SessionID is passed as the first XML element in every subsequent call. Sessions expire after inactivity — always call Logout when finished.


Step 2 — Check Your Inbox

SOAPAction: "https://os.ecgrid.io/ParcelInBox"

<ParcelInBoxEx>
<SessionID>YOUR_SESSION_ID</SessionID>
</ParcelInBoxEx>

The response XML contains ParcelIDInfo elements with ParcelID, FileName, Bytes, and ECGridIDFrom/ECGridIDTo — iterate them to build your download list.

The HTTP call pattern (wrap this envelope in a full SOAP Envelope/Body, POST to the service endpoint with the appropriate SOAPAction header) is identical to Login above — just swap the method name and parameters.


Step 3 — Download a Parcel

SOAPAction: "https://os.ecgrid.io/ParcelDownload"

<ParcelDownload>
<SessionID>YOUR_SESSION_ID</SessionID>
<ParcelID>123456</ParcelID>
</ParcelDownload>

The response contains the EDI file as a base64-encoded string inside ParcelDownloadResult. Decode it and write to disk.


Step 4 — Confirm the Download

SOAPAction: "https://os.ecgrid.io/ParcelDownloadConfirm"

<ParcelDownloadConfirm>
<SessionID>YOUR_SESSION_ID</SessionID>
<ParcelID>123456</ParcelID>
</ParcelDownloadConfirm>

Un-confirmed parcels remain InBoxReady and re-appear on the next inbox poll — call this after every successful save.


Step 5 — Logout

SOAPAction: "https://os.ecgrid.io/Logout"

<Logout>
<SessionID>YOUR_SESSION_ID</SessionID>
</Logout>

Always call Logout, even on error if you did not use the User API Key to Authenticate. Use a try/finally block to guarantee the session is released.


SOAP Libraries

To avoid constructing XML envelopes by hand, use a SOAP library that consumes the WSDL at https://os.ecgrid.io/v4.1/prod/ECGridOS.asmx?WSDL:

LanguageLibraries
C# / .NETdotnet-svcutil (typed proxy), CoreWCF (WCF migration)
JavaJAX-WS (wsimport), Apache CXF
Node.jssoap (npm), strong-soap
Pythonzeep, suds-community

Next Steps