Transform
The XML messages received from the CargoWise eAdaptor Outbound Service may not be suitable for the destination they are being forwarded to. The eAdaptor Relay Service can be used to:
- Extract key message details.
- Reduce the message size.
- Change the message format from XML to JSON, CSV, or any other format required.
Some destination services being forwarded to impose size limitations. Transformations can be used to extract only the essential details needed from the original CargoWise message to forward to the required service.
Example Transformation
The following provides an example to illustrate what's possible.
Original XUS messages received from CargoWise (with irrelevant parts to the example removed):
<?xml version="1.0" encoding="utf-8"?><UniversalInterchange xmlns="http://www.cargowise.com/Schemas/Universal/2011/11" version="1.1">
<Header>
<SenderID>TSTORGCHC</SenderID>
<RecipientID>Complect-eAdaptorRelay</RecipientID>
</Header>
<Body>
<UniversalShipment xmlns="http://www.cargowise.com/Schemas/Universal/2011/11" version="1.1">
<Shipment>
<DataContext>
<DataSourceCollection>
<DataSource>
<Type>WarehouseOrder</Type>
<Key>W00012345</Key>
</DataSource>
</DataSourceCollection>
...
<Order>
<OrderNumber>SO-00056789</OrderNumber>
...
</Order>
...
<MilestoneCollection>
...
<Milestone>
<Description>Finalized</Description>
<EventCode>FIN</EventCode>
<Sequence>3</Sequence>
<ActualDate>2022-04-04T11:18:12.583</ActualDate>
<ConditionReference></ConditionReference>
<ConditionType></ConditionType>
<EstimatedDate></EstimatedDate>
</Milestone>
...
</MilestoneCollection>
...
<OrganizationAddressCollection>
<OrganizationAddress>
<AddressType>ConsignorDocumentaryAddress</AddressType>
...
<OrganizationCode>CLT001CHC</OrganizationCode>
...
</OrganizationAddress>
...
</OrganizationAddressCollection>
</Shipment>
</UniversalShipment>
</Body>
</UniversalInterchange>
Transformed to a compact JSON message for forwarding on to the destination service:
{
"organizationCode": "CLT001CHC",
"docketId": "W00012345",
"orderNo": "SO-00056789",
"finalized": "2022-04-04T11:18:12.583",
"correlationId": "9b5c9c8e-8a5b-40ed-91a5-4a4fe9060dbd"
}
correlationId
isn't provided within the XUS and XUE messages themselves. The CargoWise eAdaptor Outbound Service provides this ID alongside the message, which the eAdaptor Relay can then pass along to the destination service. This unique ID can be used to track a message all the way from CargoWise to the destination system.