Skip to main content

InterchangeCancel

Cancel an outbound interchange that has not yet been delivered to the recipient.

:::caution Established API The SOAP API is in maintenance mode. For new integrations use the REST equivalent. :::

:::caution Outbound Only — Cannot Cancel Delivered Interchanges InterchangeCancel applies only to outbound interchanges still in the ECGrid delivery queue. Interchanges that have already been delivered to the recipient cannot be recalled. Verify the interchange status with InterchangeInfo before attempting cancellation. :::

Method Signature

bool InterchangeCancel(string SessionID, long InterchangeID)

Parameters

ParameterTypeRequiredDescription
SessionIDstringYesActive session token from Login()
InterchangeIDlongYesUnique identifier of the interchange to cancel

Response Object — bool

Returns true if the interchange was successfully cancelled. Returns false or a SOAP fault if the interchange has already been delivered, is already cancelled, or the session lacks permission.

<!-- Example response XML -->
<InterchangeCancelResult>true</InterchangeCancelResult>

Code Examples

// .NET 10 — dotnet-svcutil generated proxy
// Cancel an outbound interchange before it reaches the trading partner
using var client = new ECGridOSPortTypeClient();

// Confirm the interchange is still queued before cancelling
var info = await client.InterchangeInfoAsync(sessionID, interchangeId: 5551235L);
if (info.Status == "Queued")
{
bool cancelled = await client.InterchangeCancelAsync(sessionID, interchangeId: 5551235L);

if (cancelled)
{
Console.WriteLine($"Interchange {info.InterchangeID} cancelled successfully.");
}
else
{
Console.Error.WriteLine("Cancel failed — the interchange may have been delivered.");
}
}
else
{
Console.WriteLine($"Cannot cancel — current status is '{info.Status}'.");
}

REST Equivalent

See Cancel Interchange.