[{"data":1,"prerenderedAt":636},["ShallowReactive",2],{"article-eadapter-datacontext-rules":3},{"id":4,"title":5,"author":6,"body":7,"category":620,"description":621,"extension":622,"featured":623,"image":624,"meta":625,"navigation":626,"path":627,"publishedAt":628,"readingTime":83,"seo":629,"stem":630,"tags":631,"videoUrl":634,"__hash__":635},"articles/articles/eadapter-datacontext-rules.md","CargoWise eAdapter DataContext Rules: The Guide Nobody Wrote","Don Dappa",{"type":8,"value":9,"toc":611},"minimark",[10,14,17,22,43,46,177,184,188,200,288,295,323,335,339,345,410,428,431,448,452,505,508,512,521,527,536,545,549,582,586,589,600,607],[11,12,13],"p",{},"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.",[11,15,16],{},"This guide covers the rules that WiseTech's documentation leaves you to discover the hard way.",[18,19,21],"h2",{"id":20},"what-is-datacontext","What Is DataContext?",[11,23,24,25,29,30,34,35,38,39,42],{},"Every eAdapter XML message needs a ",[26,27,28],"code",{},"DataContext"," block. It tells CargoWise ",[31,32,33],"em",{},"who"," is sending the data, ",[31,36,37],{},"which company"," it belongs to, and ",[31,40,41],{},"where"," it should be routed. Think of it as the envelope around your shipment payload.",[11,44,45],{},"Here is what a complete parent-level DataContext looks like:",[47,48,53],"pre",{"className":49,"code":50,"language":51,"meta":52,"style":52},"language-xml shiki shiki-themes github-light","\u003CUniversalShipment xmlns=\"http://www.cargowise.com/Schemas/Universal/2011/11\">\n  \u003CShipmentCollection>\n    \u003CShipment>\n      \u003CDataContext>\n        \u003CCompany>\n          \u003CCode>SYD\u003C/Code>\n        \u003C/Company>\n        \u003CDataProvider>YOUR_PROVIDER_CODE\u003C/DataProvider>\n        \u003CEnterpriseID>YOUR_ENTERPRISE\u003C/EnterpriseID>\n        \u003CServerID>YOUR_SERVER\u003C/ServerID>\n        \u003CDataTargetCollection>\n          \u003CDataTarget>\n            \u003CType>ForwardingConsol\u003C/Type>\n          \u003C/DataTarget>\n        \u003C/DataTargetCollection>\n      \u003C/DataContext>\n      \u003C!-- shipment fields here -->\n    \u003C/Shipment>\n  \u003C/ShipmentCollection>\n\u003C/UniversalShipment>\n","xml","",[26,54,55,63,69,75,81,87,93,99,105,111,117,123,129,135,141,147,153,159,165,171],{"__ignoreMap":52},[56,57,60],"span",{"class":58,"line":59},"line",1,[56,61,62],{},"\u003CUniversalShipment xmlns=\"http://www.cargowise.com/Schemas/Universal/2011/11\">\n",[56,64,66],{"class":58,"line":65},2,[56,67,68],{},"  \u003CShipmentCollection>\n",[56,70,72],{"class":58,"line":71},3,[56,73,74],{},"    \u003CShipment>\n",[56,76,78],{"class":58,"line":77},4,[56,79,80],{},"      \u003CDataContext>\n",[56,82,84],{"class":58,"line":83},5,[56,85,86],{},"        \u003CCompany>\n",[56,88,90],{"class":58,"line":89},6,[56,91,92],{},"          \u003CCode>SYD\u003C/Code>\n",[56,94,96],{"class":58,"line":95},7,[56,97,98],{},"        \u003C/Company>\n",[56,100,102],{"class":58,"line":101},8,[56,103,104],{},"        \u003CDataProvider>YOUR_PROVIDER_CODE\u003C/DataProvider>\n",[56,106,108],{"class":58,"line":107},9,[56,109,110],{},"        \u003CEnterpriseID>YOUR_ENTERPRISE\u003C/EnterpriseID>\n",[56,112,114],{"class":58,"line":113},10,[56,115,116],{},"        \u003CServerID>YOUR_SERVER\u003C/ServerID>\n",[56,118,120],{"class":58,"line":119},11,[56,121,122],{},"        \u003CDataTargetCollection>\n",[56,124,126],{"class":58,"line":125},12,[56,127,128],{},"          \u003CDataTarget>\n",[56,130,132],{"class":58,"line":131},13,[56,133,134],{},"            \u003CType>ForwardingConsol\u003C/Type>\n",[56,136,138],{"class":58,"line":137},14,[56,139,140],{},"          \u003C/DataTarget>\n",[56,142,144],{"class":58,"line":143},15,[56,145,146],{},"        \u003C/DataTargetCollection>\n",[56,148,150],{"class":58,"line":149},16,[56,151,152],{},"      \u003C/DataContext>\n",[56,154,156],{"class":58,"line":155},17,[56,157,158],{},"      \u003C!-- shipment fields here -->\n",[56,160,162],{"class":58,"line":161},18,[56,163,164],{},"    \u003C/Shipment>\n",[56,166,168],{"class":58,"line":167},19,[56,169,170],{},"  \u003C/ShipmentCollection>\n",[56,172,174],{"class":58,"line":173},20,[56,175,176],{},"\u003C/UniversalShipment>\n",[11,178,179,180,183],{},"Five elements. Miss one and you get a validation error. Include the wrong one in the wrong context and you get a ",[31,181,182],{},"different"," validation error.",[18,185,187],{"id":186},"the-parent-level-rules","The Parent-Level Rules",[11,189,190,191,194,195,199],{},"At the top-level ",[26,192,193],{},"Shipment"," (the consol or direct shipment), DataContext requires ",[196,197,198],"strong",{},"all five"," elements:",[201,202,203,219],"table",{},[204,205,206],"thead",{},[207,208,209,213,216],"tr",{},[210,211,212],"th",{},"Element",[210,214,215],{},"Purpose",[210,217,218],{},"What Happens If Missing",[220,221,222,236,249,262,275],"tbody",{},[207,223,224,230,233],{},[225,226,227],"td",{},[26,228,229],{},"Company.Code",[225,231,232],{},"Identifies the branch/office",[225,234,235],{},"Rejected: \"Company code is required\"",[207,237,238,243,246],{},[225,239,240],{},[26,241,242],{},"DataProvider",[225,244,245],{},"Your integration identity",[225,247,248],{},"Rejected: cannot authenticate",[207,250,251,256,259],{},[225,252,253],{},[26,254,255],{},"EnterpriseID",[225,257,258],{},"Multi-tenant routing",[225,260,261],{},"Rejected or routed to wrong environment",[207,263,264,269,272],{},[225,265,266],{},[26,267,268],{},"ServerID",[225,270,271],{},"Target CW server instance",[225,273,274],{},"Rejected or silent misroute",[207,276,277,282,285],{},[225,278,279],{},[26,280,281],{},"DataTargetCollection",[225,283,284],{},"What module to write into",[225,286,287],{},"Rejected: \"No DataTarget specified\"",[11,289,290,291,294],{},"The ",[26,292,293],{},"DataTarget.Type"," value determines which CargoWise module receives your data. Common values:",[296,297,298,305,311,317],"ul",{},[299,300,301,304],"li",{},[26,302,303],{},"ForwardingConsol"," — ocean/air consol shipments",[299,306,307,310],{},[26,308,309],{},"ForwardingShipment"," — direct (non-consol) shipments",[299,312,313,316],{},[26,314,315],{},"CustomsDeclaration"," — customs entries",[299,318,319,322],{},[26,320,321],{},"TransportBooking"," — transport/cartage jobs",[11,324,325,328,329,331,332,334],{},[196,326,327],{},"Critical mistake:"," Using ",[26,330,309],{}," when you mean ",[26,333,303],{},". 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.",[18,336,338],{"id":337},"the-subshipment-trap","The SubShipment Trap",[11,340,341,342],{},"When you send a consol with house bills (SubShipmentCollection), each SubShipment also needs a DataContext. But here is where developers get burned: ",[196,343,344],{},"SubShipment DataContext must be minimal.",[47,346,348],{"className":49,"code":347,"language":51,"meta":52,"style":52},"\u003CSubShipmentCollection>\n  \u003CSubShipment>\n    \u003CDataContext>\n      \u003CDataTargetCollection>\n        \u003CDataTarget>\n          \u003CType>ForwardingShipment\u003C/Type>\n        \u003C/DataTarget>\n      \u003C/DataTargetCollection>\n    \u003C/DataContext>\n    \u003C!-- house bill fields here -->\n  \u003C/SubShipment>\n\u003C/SubShipmentCollection>\n",[26,349,350,355,360,365,370,375,380,385,390,395,400,405],{"__ignoreMap":52},[56,351,352],{"class":58,"line":59},[56,353,354],{},"\u003CSubShipmentCollection>\n",[56,356,357],{"class":58,"line":65},[56,358,359],{},"  \u003CSubShipment>\n",[56,361,362],{"class":58,"line":71},[56,363,364],{},"    \u003CDataContext>\n",[56,366,367],{"class":58,"line":77},[56,368,369],{},"      \u003CDataTargetCollection>\n",[56,371,372],{"class":58,"line":83},[56,373,374],{},"        \u003CDataTarget>\n",[56,376,377],{"class":58,"line":89},[56,378,379],{},"          \u003CType>ForwardingShipment\u003C/Type>\n",[56,381,382],{"class":58,"line":95},[56,383,384],{},"        \u003C/DataTarget>\n",[56,386,387],{"class":58,"line":101},[56,388,389],{},"      \u003C/DataTargetCollection>\n",[56,391,392],{"class":58,"line":107},[56,393,394],{},"    \u003C/DataContext>\n",[56,396,397],{"class":58,"line":113},[56,398,399],{},"    \u003C!-- house bill fields here -->\n",[56,401,402],{"class":58,"line":119},[56,403,404],{},"  \u003C/SubShipment>\n",[56,406,407],{"class":58,"line":125},[56,408,409],{},"\u003C/SubShipmentCollection>\n",[11,411,412,413,416,417,420,421,420,423,420,425,427],{},"Notice what is ",[196,414,415],{},"missing",": no ",[26,418,419],{},"Company",", no ",[26,422,242],{},[26,424,255],{},[26,426,268],{},". The SubShipment inherits these from the parent.",[11,429,430],{},"If you include them, you get one of these:",[296,432,433,439,445],{},[299,434,435,438],{},[26,436,437],{},"\"DataProvider is not valid at this level\""," — the clear one",[299,440,441,444],{},[26,442,443],{},"\"Unable to resolve target\""," — the vague one",[299,446,447],{},"Complete silence with your data written nowhere — the worst one",[18,449,451],{"id":450},"the-rule-table","The Rule Table",[201,453,454,471],{},[204,455,456],{},[207,457,458,461,463,465,467,469],{},[210,459,460],{},"Context",[210,462,419],{},[210,464,242],{},[210,466,255],{},[210,468,268],{},[210,470,281],{},[220,472,473,489],{},[207,474,475,478,481,483,485,487],{},[225,476,477],{},"Parent Shipment",[225,479,480],{},"Required",[225,482,480],{},[225,484,480],{},[225,486,480],{},[225,488,480],{},[207,490,491,494,497,499,501,503],{},[225,492,493],{},"SubShipment",[225,495,496],{},"Omit",[225,498,496],{},[225,500,496],{},[225,502,496],{},[225,504,480],{},[11,506,507],{},"That is the entire rule. It should be on the first page of the eAdapter documentation. It is not.",[18,509,511],{"id":510},"common-validation-errors-and-what-they-mean","Common Validation Errors and What They Mean",[11,513,514,517,518,520],{},[196,515,516],{},"\"No matching shipment found\""," — Your DataTarget type does not match the record type in CargoWise. You sent ",[26,519,309],{}," but the record is a consol.",[11,522,523,526],{},[196,524,525],{},"\"DataContext validation failed\""," — You are missing a required element at the parent level, or you included a forbidden element at the SubShipment level.",[11,528,529,532,533,535],{},[196,530,531],{},"\"Unable to determine target company\""," — The ",[26,534,229],{}," does not match any branch configured in your CargoWise instance. Check the exact branch code in CW Administration.",[11,537,538,541,542,544],{},[196,539,540],{},"No error at all, but data is missing"," — You sent the right DataContext but the wrong ",[26,543,293],{},". CargoWise created a record in a module you are not looking at.",[18,546,548],{"id":547},"debugging-checklist","Debugging Checklist",[550,551,552,558,566,571,576],"ol",{},[299,553,554,557],{},[196,555,556],{},"Parent level",": Verify all five DataContext elements are present and correct",[299,559,560,563,564],{},[196,561,562],{},"SubShipment level",": Verify DataContext contains ONLY ",[26,565,281],{},[299,567,568,570],{},[196,569,293],{},": Confirm it matches the actual CW module (consol vs shipment vs customs)",[299,572,573,575],{},[196,574,229],{},": Confirm the exact branch code from CW Administration, not the display name",[299,577,578,581],{},[196,579,580],{},"Check the response",": Even HTTP 200 does not mean success (see our ProcessingLog article)",[18,583,585],{"id":584},"stop-guessing-start-shipping","Stop Guessing, Start Shipping",[11,587,588],{},"These 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.",[11,590,591,592,599],{},"Our ",[196,593,594],{},[595,596,598],"a",{"href":597},"/eadapter","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.",[11,601,602],{},[196,603,604],{},[595,605,606],{"href":597},"Get the Complete Guide →",[608,609,610],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":52,"searchDepth":65,"depth":65,"links":612},[613,614,615,616,617,618,619],{"id":20,"depth":65,"text":21},{"id":186,"depth":65,"text":187},{"id":337,"depth":65,"text":338},{"id":450,"depth":65,"text":451},{"id":510,"depth":65,"text":511},{"id":547,"depth":65,"text":548},{"id":584,"depth":65,"text":585},"technical","Understanding parent-level vs SubShipment DataContext rules is the difference between a working eAdapter integration and hours of debugging cryptic validation errors.","md",false,"/images/articles/eadapter-datacontext.webp",{},true,"/articles/eadapter-datacontext-rules","2026-03-18",{"title":5,"description":621},"articles/eadapter-datacontext-rules",[632,633,28],"CargoWise eAdapter","XML integration",null,"ZnFF4XtjLvnrnHhQwO-jq8Fkigf1tnOZ7OhXl1IFSho",1775327519976]