Understanding parent-level vs SubShipment DataContext rules is the difference between a working eAdapter integration and hours of debugging cryptic validation errors.

If you have ever stared at a CargoWise eAdapter validation error that says absolutely nothing useful, you are not alone. The DataContext block is the single most misunderstood piece of eAdapter XML, and getting it wrong means your shipment data silently goes nowhere.
This guide covers the rules that WiseTech's documentation leaves you to discover the hard way.
Every eAdapter XML message needs a DataContext block. It tells CargoWise who is sending the data, which company it belongs to, and where it should be routed. Think of it as the envelope around your shipment payload.
Here is what a complete parent-level DataContext looks like:
<UniversalShipment xmlns="http://www.cargowise.com/Schemas/Universal/2011/11">
<ShipmentCollection>
<Shipment>
<DataContext>
<Company>
<Code>SYD</Code>
</Company>
<DataProvider>YOUR_PROVIDER_CODE</DataProvider>
<EnterpriseID>YOUR_ENTERPRISE</EnterpriseID>
<ServerID>YOUR_SERVER</ServerID>
<DataTargetCollection>
<DataTarget>
<Type>ForwardingConsol</Type>
</DataTarget>
</DataTargetCollection>
</DataContext>
<!-- shipment fields here -->
</Shipment>
</ShipmentCollection>
</UniversalShipment>
Five elements. Miss one and you get a validation error. Include the wrong one in the wrong context and you get a different validation error.
At the top-level Shipment (the consol or direct shipment), DataContext requires all five elements:
| Element | Purpose | What Happens If Missing |
|---|---|---|
Company.Code | Identifies the branch/office | Rejected: "Company code is required" |
DataProvider | Your integration identity | Rejected: cannot authenticate |
EnterpriseID | Multi-tenant routing | Rejected or routed to wrong environment |
ServerID | Target CW server instance | Rejected or silent misroute |
DataTargetCollection | What module to write into | Rejected: "No DataTarget specified" |
The DataTarget.Type value determines which CargoWise module receives your data. Common values:
ForwardingConsol — ocean/air consol shipmentsForwardingShipment — direct (non-consol) shipmentsCustomsDeclaration — customs entriesTransportBooking — transport/cartage jobsCritical mistake: Using ForwardingShipment when you mean ForwardingConsol. CargoWise will accept the XML, create a record in the wrong module, and you will spend a week wondering why your consol has no house bills attached.
When you send a consol with house bills (SubShipmentCollection), each SubShipment also needs a DataContext. But here is where developers get burned: SubShipment DataContext must be minimal.
<SubShipmentCollection>
<SubShipment>
<DataContext>
<DataTargetCollection>
<DataTarget>
<Type>ForwardingShipment</Type>
</DataTarget>
</DataTargetCollection>
</DataContext>
<!-- house bill fields here -->
</SubShipment>
</SubShipmentCollection>
Notice what is missing: no Company, no DataProvider, no EnterpriseID, no ServerID. The SubShipment inherits these from the parent.
If you include them, you get one of these:
"DataProvider is not valid at this level" — the clear one"Unable to resolve target" — the vague one| Context | Company | DataProvider | EnterpriseID | ServerID | DataTargetCollection |
|---|---|---|---|---|---|
| Parent Shipment | Required | Required | Required | Required | Required |
| SubShipment | Omit | Omit | Omit | Omit | Required |
That is the entire rule. It should be on the first page of the eAdapter documentation. It is not.
"No matching shipment found" — Your DataTarget type does not match the record type in CargoWise. You sent ForwardingShipment but the record is a consol.
"DataContext validation failed" — You are missing a required element at the parent level, or you included a forbidden element at the SubShipment level.
"Unable to determine target company" — The Company.Code does not match any branch configured in your CargoWise instance. Check the exact branch code in CW Administration.
No error at all, but data is missing — You sent the right DataContext but the wrong DataTarget.Type. CargoWise created a record in a module you are not looking at.
DataTargetCollectionThese DataContext rules took us months of production debugging to catalogue — across dozens of integrations with different CargoWise configurations. The patterns above will save you the most common headaches, but there are deeper traps around multi-company setups, cross-branch routing, and conditional DataTarget combinations.
Our Complete eAdapter Integration Guide covers every DataContext scenario we have encountered, with copy-paste XML templates and a validation checklist. If you are building or maintaining a CargoWise integration, it will save you weeks.
Join freight forwarders saving hours every week with CargoMode.
Start for free