3.1.1 Create / Modify Shipments (C#)
Create Shipment
Sample source code to create shipment
ShipmentsCredentials cred = new ShipmentsCredentials();
cred.UserName = "username";
cred.Password = "password";
cred.CultureType = CultureType.English;
ShipperInfo shipper = new ShipperInfo();
shipper.ShipperName = "Unixus Solutions Sdn. Bhd.";
shipper.ContactPerson = "IT Department";
shipper.Address1 = "46-02 JALAN TUN ABDUL RAZAK,";
shipper.Address2 = "SUSUR 1,";
shipper.Address3 = string.Empty;
shipper.PostCode = "80000";
shipper.City = "JOHOR BHARU";
shipper.State = "JOHOR";
shipper.CountryCode = "MY";
shipper.StationCode = "";
shipper.Phone1 = "607-2222668";
shipper.Phone2 = "";
shipper.MobilePhone = "";
shipper.Fax = "";
shipper.Email = "[email protected]";
shipper.Url = "";
ConsigneeInfo consignee = new ConsigneeInfo();
consignee.ConsigneeName = "LWE (AU) Ltd.";
consignee.ContactPerson = "Mr. Ng";
consignee.IdentityNo= "0123abcd";
consignee.Address1 = "Test Address 1";
consignee.Address2 = "Test Address 2";
consignee.Address3 = string.Empty;
consignee.PostCode = "0845";
consignee.City = "BATCHELOR";
consignee.State = "NT";
consignee.CountryCode = "AU";
consignee.StationCode = "";
consignee.Phone1 = "60-7-2222668";
consignee.Phone2 = "";
consignee.MobilePhone = "";
consignee.Fax = "";
consignee.Email = "[email protected]";
consignee.Url = "http://www.lwe.com.hk";
ShipmentsParameter ship = new ShipmentsParameter();
ship.ShipmentsCredentials = cred;
ship.ActionType = ActionType.Add;
ship.ShipperInfo = shipper;
ship.ConsigneeInfo = consignee;
ship.CustomerCode = "300001";
ship.ProfitCentreCode = string.Empty;
ship.ShipmentDate = DateTime.Now;
ship.HawbNo = string.Empty;
ship.ReferenceNo = "123456";
ship.ReferenceAgent = string.Empty;
ship.TOSMode = "AU-E-EXPRESS";
ship.PackageType = PackageType.SPX;
ship.NatureOfGoods = "SHOES";
ship.NoOfPieces = 1;
ship.WeightType = WeightType.Kilogram;
ship.CurrencyCode = "AUD";
ship.Remarks = "The shipment easy to broke, please becareful.";
ship.WeightInfo = new WeightInfo[ship.NoOfPieces];
ship.WeightInfo[0] = new WeightInfo();
ship.WeightInfo[0].PackageReference = "PKG01";
ship.WeightInfo[0].PackageHeight = 1.00;
ship.WeightInfo[0].PackageWidth = 1.00;
ship.WeightInfo[0].PackageLength = 1.00;
ship.WeightInfo[0].ActualWeight = 5.00;
ship.ItemInfo = new ItemInfo[1];
ship.ItemInfo[0] = new ItemInfo();
ship.ItemInfo[0].ItemReference = "LADIES SHOES";
ship.ItemInfo[0].NoOfUnit = 3;
ship.ItemInfo[0].ItemValue = 15;
ship.TagsInfo = new TagsInfo[1]
ship.TagsInfo[0] = new TagsInfo();
ship.TagsInfo[0].TagCode = "TAG1";
ship.TagsInfo[0].TagValue = "ANY EXTRA INFORMATION";
ShipmentsClient client = new ShipmentsClient();
ShipmentsResponse response = client.ProcessShipments(ship);
Sample source code for crete multiple shipments
If users are required to send multiple shipment in a time, then user have to use this multiple process shipment API.
ShipmentsCredentials cred = new ShipmentsCredentials();
cred.UserName = "username";
cred.Password = "password";
cred.CultureType = CultureType.English;
ShipperInfo shipper = new ShipperInfo();
shipper.ShipperName = "Unixus Solutions Sdn. Bhd.";
shipper.ContactPerson = "IT Department";
shipper.Address1 = "46-02 JALAN TUN ABDUL RAZAK,";
shipper.Address2 = "SUSUR 1,";
shipper.Address3 = string.Empty;
shipper.PostCode = "80000";
shipper.City = "JOHOR BHARU";
shipper.State = "JOHOR";
shipper.CountryCode = "MY";
shipper.StationCode = "";
shipper.Phone1 = "607-2222668";
shipper.Phone2 = "";
shipper.MobilePhone = "";
shipper.Fax = "";
shipper.Email = "[email protected]";
shipper.Url = "";
ConsigneeInfo consignee = new ConsigneeInfo();
consignee.ConsigneeName = "LWE (AU) Ltd.";
consignee.ContactPerson = "Mr. Ng";
consignee.IdentityNo= "0123abcd";
consignee.Address1 = "Test Address 1";
consignee.Address2 = "Test Address 2";
consignee.Address3 = string.Empty;
consignee.PostCode = "0845";
consignee.City = "BATCHELOR";
consignee.State = "NT";
consignee.CountryCode = "AU";
consignee.StationCode = "";
consignee.Phone1 = "60-7-2222668";
consignee.Phone2 = "";
consignee.MobilePhone = "";
consignee.Fax = "";
consignee.Email = "[email protected]";
consignee.Url = "http://www.lwe.com.hk";
ShipmentsParameter ship = new ShipmentsParameter();
ship.ShipmentsCredentials = cred;
ship.ActionType = ActionType.Add;
ship.ShipperInfo = shipper;
ship.ConsigneeInfo = consignee;
ship.CustomerCode = "300001";
ship.ProfitCentreCode = string.Empty;
ship.ShipmentDate = DateTime.Now;
ship.HawbNo = string.Empty;
ship.ReferenceNo = "123456";
ship.ReferenceAgent = string.Empty;
ship.TOSMode = "AU-E-EXPRESS";
ship.PackageType = PackageType.SPX;
ship.NatureOfGoods = "SHOES";
ship.NoOfPieces = 1;
ship.WeightType = WeightType.Kilogram;
ship.CurrencyCode = "AUD";
ship.Remarks = "The shipment easy to broke, please becareful.";
ship.WeightInfo = new WeightInfo[ship.NoOfPieces];
ship.WeightInfo[0] = new WeightInfo();
ship.WeightInfo[0].PackageReference = "PKG01";
ship.WeightInfo[0].PackageHeight = 1.00;
ship.WeightInfo[0].PackageWidth = 1.00;
ship.WeightInfo[0].PackageLength = 1.00;
ship.WeightInfo[0].ActualWeight = 5.00;
ship.ItemInfo = new ItemInfo[1];
ship.ItemInfo[0] = new ItemInfo();
ship.ItemInfo[0].ItemReference = "LADIES SHOES";
ship.ItemInfo[0].NoOfUnit = 3;
ship.ItemInfo[0].ItemValue = 15;
ship.TagsInfo = new TagsInfo[1]
ship.TagsInfo[0] = new TagsInfo();
ship.TagsInfo[0].TagCode = "TAG1";
ship.TagsInfo[0].TagValue = "ANY EXTRA INFORMATION";
ShipmentsClient client = new ShipmentsClient();
ShipmentListRequest _request = new ShipmentListRequest();
_request.ShipmentsCredentials = cred;
_request.ShipmentList = new ShipmentParameter[1];
_request.ShipmentList[0] = ship;
ShipmentListResponse res = client.ProcessShipmentList(_request);
Modify Shipment
Sample source code for modify shipment
ShipmentsCredentials cred = new ShipmentsCredentials();
cred.UserName = "username";
cred.Password = "password";
cred.CultureType = CultureType.English;
ShipperInfo shipper = new ShipperInfo();
shipper.ShipperName = "Unixus Solutions Sdn. Bhd.";
shipper.ContactPerson = "IT Department";
shipper.Address1 = "46-02 JALAN TUN ABDUL RAZAK,";
shipper.Address2 = "SUSUR 1,";
shipper.Address3 = string.Empty;
shipper.PostCode = "80000";
shipper.City = "JOHOR BHARU";
shipper.State = "JOHOR";
shipper.CountryCode = "MY";
shipper.StationCode = "";
shipper.Phone1 = "607-2222668";
shipper.Phone2 = "";
shipper.MobilePhone = "";
shipper.Fax = "";
shipper.Email = "[email protected]";
shipper.Url = "";
ConsigneeInfo consignee = new ConsigneeInfo();
consignee.ConsigneeName = "LWE (AU) Ltd.";
consignee.ContactPerson = "Mr. Ng";
consignee.IdentityNo= "0123abcd";
consignee.Address1 = "Test Address 1";
consignee.Address2 = "Test Address 2";
consignee.Address3 = string.Empty;
consignee.PostCode = "0845";
consignee.City = "BATCHELOR";
consignee.State = "NT";
consignee.CountryCode = "AU";
consignee.StationCode = "";
consignee.Phone1 = "60-7-2222668";
consignee.Phone2 = "";
consignee.MobilePhone = "";
consignee.Fax = "";
consignee.Email = "[email protected]";
consignee.Url = "http://www.lwe.com.hk";
ShipmentsParameter ship = new ShipmentsParameter();
ship.ShipmentsCredentials = cred;
ship.ActionType = ActionType.Update; /* Or ActionType.UpdateByHawb*/
ship.ShipperInfo = shipper;
ship.ConsigneeInfo = consignee;
ship.CustomerCode = "300001";
ship.ProfitCentreCode = string.Empty;
ship.ShipmentDate = DateTime.Now;
ship.HawbNo = "344010500000151"; /* Provide the correct Hawb No.*/
ship.ReferenceNo = "123456";
ship.ReferenceAgent = string.Empty;
ship.TOSMode = "AU-E-EXPRESS";
ship.PackageType = PackageType.SPX;
ship.NatureOfGoods = "SHOES";
ship.NoOfPieces = 1;
ship.WeightType = WeightType.Kilogram;
ship.CurrencyCode = "AUD";
ship.Remarks = "The shipment easy to broke, please becareful.";
ship.WeightInfo = new WeightInfo[ship.NoOfPieces];
ship.WeightInfo[0] = new WeightInfo();
ship.WeightInfo[0].PackageReference = "PKG01";
ship.WeightInfo[0].PackageHeight = 1.00;
ship.WeightInfo[0].PackageWidth = 1.00;
ship.WeightInfo[0].PackageLength = 1.00;
ship.WeightInfo[0].ActualWeight = 5.00;
ship.ItemInfo = new ItemInfo[1];
ship.ItemInfo[0] = new ItemInfo();
ship.ItemInfo[0].ItemReference = "LADIES SHOES";
ship.ItemInfo[0].NoOfUnit = 3;
ship.ItemInfo[0].ItemValue = 15;
ship.TagsInfo = new TagsInfo[1]
ship.TagsInfo[0] = new TagsInfo();
ship.TagsInfo[0].TagCode = "TAG1";
ship.TagsInfo[0].TagValue = "ANY EXTRA INFORMATION";
ShipmentsClient client = new ShipmentsClient();
ShipmentsResponse response = client.ProcessShipments(ship);