Dart
Dart
WIN Air Freight - Send New Pouch Request
See more HTTP Misc Examples
Sends a "POST /api/v1/Awb" to send a new pouch request.Chilkat Dart Downloads
import 'package:chilkat/chilkat.dart';
void main() {
// This example assumes the Chilkat HTTP API to have been previously unlocked.
// See Global Unlock Sample for sample code.
final http = CkHttp();
// Set the "Accept" header to tell the web server that we'll accept an XML response.
http.accept = 'application/xml';
// Tell Chilkat to cache any received cookies to files in a particular directory
http.cookieDir = 'c:/qa_data/cookies';
http.saveCookies = true;
// Also tell Chilkat to load and send matching cookies from the CookieDir.
// The authToken cookie is first obtained in the login request. Each subsequent
// request sends the authToken cookie and saves the new authToken cookie to the CookieDir.
http.sendCookies = true;
// Build out XML pouch request...
final xml = CkXml();
xml.tag = 'PouchDTO';
xml.updateChildContent('Mawb|AwbID', '');
xml.updateChildContent('Mawb|AwbNumber', '001-12312123');
xml.updateChildContent('Mawb|AwbStatus', 'D');
xml.updateChildContent('Mawb|eAWB', 'false');
xml.updateChildContent('Mawb|WithPaper', 'false');
xml.updateChildContent('Mawb|Parties|Shipper|WinID', '444444');
xml.updateChildContent('Mawb|Parties|Shipper|AccountNumber', '12345');
xml.updateChildContent('Mawb|Parties|Shipper|Name', 'AABC SHIPPING & PACKAGING, INC.');
xml.updateChildContent('Mawb|Parties|Shipper|Phone', '111-222-3334');
xml.updateChildContent('Mawb|Parties|Shipper|Fax', '222-111-3334');
xml.updateChildContent('Mawb|Parties|Shipper|Email', '');
xml.updateChildContent('Mawb|Parties|Shipper|Address|Line1', '500 HARBOR DRIVE');
xml.updateChildContent('Mawb|Parties|Shipper|Address|Line2', 'SUITE B1211');
xml.updateChildContent('Mawb|Parties|Shipper|Address|Place', 'BEAUFORT');
xml.updateChildContent('Mawb|Parties|Shipper|Address|PostalCode', '28516');
xml.updateChildContent('Mawb|Parties|Shipper|Address|StateProvince', 'NC');
xml.updateChildContent('Mawb|Parties|Shipper|Address|Country|Code', 'US');
xml.updateChildContent('Mawb|Parties|Shipper|Address|Country|Name', 'U.S.A.');
xml.updateChildContent('Mawb|Parties|Consignee|WinID', '0');
xml.updateChildContent('Mawb|Parties|Consignee|AccountNumber', '');
xml.updateChildContent('Mawb|Parties|Consignee|Name', 'DELTA MANUFACTURING');
xml.updateChildContent('Mawb|Parties|Consignee|Phone', '444-555-3333');
xml.updateChildContent('Mawb|Parties|Consignee|Fax', '');
xml.updateChildContent('Mawb|Parties|Consignee|Email', '');
xml.updateChildContent('Mawb|Parties|Consignee|Address|Line1', '185 RUE LAMANDE');
xml.updateChildContent('Mawb|Parties|Consignee|Address|Line2', '');
xml.updateChildContent('Mawb|Parties|Consignee|Address|Place', 'PARIS');
xml.updateChildContent('Mawb|Parties|Consignee|Address|PostalCode', '75017');
xml.updateChildContent('Mawb|Parties|Consignee|Address|StateProvince', '');
xml.updateChildContent('Mawb|Parties|Consignee|Address|Country|Code', 'FR');
xml.updateChildContent('Mawb|Parties|Consignee|Address|Country|Name', 'FRANCE');
xml.updateChildContent('Mawb|Parties|Notify|WinID', '');
xml.updateChildContent('Mawb|Parties|Notify|AccountNumber', '');
xml.updateChildContent('Mawb|Parties|Notify|Name', 'AABC SHIPPING, INC.');
xml.updateChildContent('Mawb|Parties|Notify|Phone', '');
xml.updateChildContent('Mawb|Parties|Notify|Fax', '');
xml.updateChildContent('Mawb|Parties|Notify|Email', '');
xml.updateChildContent('Mawb|Parties|Notify|Address|Line1', '110 FARA WAY');
xml.updateChildContent('Mawb|Parties|Notify|Address|Line2', '');
xml.updateChildContent('Mawb|Parties|Notify|Address|Place', 'OZ');
xml.updateChildContent('Mawb|Parties|Notify|Address|PostalCode', '11222');
xml.updateChildContent('Mawb|Parties|Notify|Address|StateProvince', 'NY');
xml.updateChildContent('Mawb|Parties|Notify|Address|Country|Code', 'US');
xml.updateChildContent('Mawb|Parties|Notify|Address|Country|Name', 'U.S.A.');
xml.updateChildContent('Mawb|Parties|Agent|WinID', '');
xml.updateChildContent('Mawb|Parties|Agent|AccountNumber', 'FACCT#1234');
xml.updateChildContent('Mawb|Accounting|Identifier', 'GEN');
xml.updateChildContent('Mawb|Accounting|Information', 'SARFWER');
xml.updateChildContent('Mawb|Accounting|Identifier', 'MCO');
xml.updateChildContent('Mawb|Accounting|Information', 'WERWERWER');
xml.updateChildContent('Mawb|ShipmentReference|ReferenceNumber', 'ZDFASF');
xml.updateChildContent('Mawb|ShipmentReference|AdditionalInformation', 'ZDFASF');
xml.updateChildContent('Mawb|RoutingDetails|FromAirportCode', 'EWN');
xml.updateChildContent('Mawb|RoutingDetails|ToAirportCode', 'LON');
xml.updateChildContent('Mawb|RoutingDetails|CarrierCode', 'AA');
xml.updateChildContent('Mawb|RoutingDetails|FlightNumber', 'N123');
xml.updateChildContent('Mawb|RoutingDetails|FlightDate', '2016-11-30T00:00:00');
xml.updateChildContent('Mawb|ChargesDeclaration|CurrencyCode', 'USD');
xml.updateChildContent('Mawb|ChargesDeclaration|ChargeCode', 'PP');
xml.updateChildContent('Mawb|ChargesDeclaration|WeightOrValuation', 'P');
xml.updateChildContent('Mawb|ChargesDeclaration|Other', 'P');
xml.updateChildContent('Mawb|ChargesDeclaration|ValuesForCarriage', '1300.00');
xml.updateChildContent('Mawb|ChargesDeclaration|ValuesForCustoms', '12000.00');
xml.updateChildContent('Mawb|ChargesDeclaration|ValuesForInsurance', '11000.00');
xml.updateChildContent('Mawb|Handling|SpecialServiceInformation', 'Please Notify Consigneetestwwwww');
xml.updateChildContent('Mawb|Handling|OtherServiceInformation', '');
xml.updateChildContent('Mawb|Handling|SCI', '');
xml.updateChildContent('Mawb|Handling|SpecialHandling|Code', 'AOG');
xml.updateChildContent('Mawb|Handling|SpecialHandling|Code', 'ATT');
xml.updateChildContent('Mawb|Rates|NumberOfPieces', '12');
xml.updateChildContent('Mawb|Rates|GrossWeight|Value', '244.70');
xml.updateChildContent('Mawb|Rates|GrossWeight|UOM', 'L');
xml.updateChildContent('Mawb|Rates|SLAC', '12');
xml.updateChildContent('Mawb|Rates|RateClassCode', 'N');
xml.updateChildContent('Mawb|Rates|CommodityItemNumber', '');
xml.updateChildContent('Mawb|Rates|ChargeableWeight', '245.0');
xml.updateChildContent('Mawb|Rates|RateOrCharge', '8.00');
xml.updateChildContent('Mawb|Rates|ChargeAmount', '1960.00');
xml.updateChildContent('Mawb|Rates|NatureAndQuantityOfGoods', 'CONSOLIDATION PER ATTACHED MANIFEST.');
xml.updateChildContent('Mawb|Rates|Dims|Pcs', '12');
xml.updateChildContent('Mawb|Rates|Dims|Length', '4');
xml.updateChildContent('Mawb|Rates|Dims|Width', '8');
xml.updateChildContent('Mawb|Rates|Dims|Height', '4');
xml.updateChildContent('Mawb|Rates|Dims|UOM', 'CMT');
xml.updateChildContent('Mawb|ChargesSummary|WeightCharge', '1960.00');
xml.updateChildContent('Mawb|OtherCharges|Description', 'AW');
xml.updateChildContent('Mawb|OtherCharges|Amount', '123.00');
xml.updateChildContent('Mawb|OtherCharges|ChargeIdentifier', 'C');
xml.updateChildContent('Mawb|OtherCharges|PrepaidCollect', 'C');
xml.updateChildContent('Mawb|OtherCharges|Description', 'FC');
xml.updateChildContent('Mawb|OtherCharges|Amount', '55.00');
xml.updateChildContent('Mawb|OtherCharges|ChargeIdentifier', 'A');
xml.updateChildContent('Mawb|OtherCharges|PrepaidCollect', 'P');
xml.updateChildContent('Mawb|OtherCharges|Description', 'FC');
xml.updateChildContent('Mawb|OtherCharges|Amount', '101.00');
xml.updateChildContent('Mawb|OtherCharges|ChargeIdentifier', 'C');
xml.updateChildContent('Mawb|OtherCharges|PrepaidCollect', 'C');
xml.updateChildContent('Mawb|EmailNotifications|Name', '');
xml.updateChildContent('Mawb|EmailNotifications|Email', '');
xml.updateChildContent('Mawb|EmailNotifications|Name', '');
xml.updateChildContent('Mawb|EmailNotifications|Email', '');
xml.updateChildContent('Mawb|EmailNotifications|Name', '');
xml.updateChildContent('Mawb|EmailNotifications|Email', '');
xml.updateChildContent('Mawb|EmailNotifications|Name', '');
xml.updateChildContent('Mawb|EmailNotifications|Email', '');
xml.updateChildContent('Mawb|Execution|Date', '2015-08-07T00:00:00');
xml.updateChildContent('Mawb|Execution|Place', 'OZ NY');
xml.updateChildContent('Mawb|Execution|ShipperSignature', 'OAS FREIGHT FORWARDE');
xml.updateChildContent('Mawb|Execution|CarrierSignature', 'OAS FREIGHT FORWARDE');
xml.updateChildContent('Hawbs|AwbNumber', '001-12312123');
xml.updateChildContent('Hawbs|HawbNumber', 'CGL201107-27');
xml.updateChildContent('Hawbs|HawbStatus', 'D');
xml.updateChildContent('Hawbs|NumberOfPieces', '12');
xml.updateChildContent('Hawbs|GrossWeight|Value', '244.70');
xml.updateChildContent('Hawbs|GrossWeight|UOM', 'K');
xml.updateChildContent('Hawbs|Locations|PortOfOrigin|Code', 'EWN');
xml.updateChildContent('Hawbs|Locations|PortOfDestination|Code', 'LON');
xml.updateChildContent('Hawbs|Commodity', 'HWB #: CGL20110');
xml.updateChildContent('Hawbs|SLAC', '12');
xml.updateChildContent('Hawbs|Parties|Shipper|Name', 'ABC SHIPPNG AGAIN');
xml.updateChildContent('Hawbs|Parties|Shipper|Phone', '111-222-3333');
xml.updateChildContent('Hawbs|Parties|Shipper|Fax', '');
xml.updateChildContent('Hawbs|Parties|Shipper|Email', '');
xml.updateChildContent('Hawbs|Parties|Shipper|Address|Line1', '100 MAIN STREET');
xml.updateChildContent('Hawbs|Parties|Shipper|Address|Place', 'OZ');
xml.updateChildContent('Hawbs|Parties|Shipper|Address|PostalCode', 'ZIP');
xml.updateChildContent('Hawbs|Parties|Shipper|Address|StateProvince', 'NY');
xml.updateChildContent('Hawbs|Parties|Shipper|Address|Country|Code', 'US');
xml.updateChildContent('Hawbs|Parties|Consignee|Name', 'AABC SHIPPING & PACKAGING, INC.');
xml.updateChildContent('Hawbs|Parties|Consignee|Phone', '111-222-3334');
xml.updateChildContent('Hawbs|Parties|Consignee|Fax', '222-111-3334');
xml.updateChildContent('Hawbs|Parties|Consignee|Email', '');
xml.updateChildContent('Hawbs|Parties|Consignee|Address|Line1', '500 HARBOR DRIVE');
xml.updateChildContent('Hawbs|Parties|Consignee|Address|Place', 'BEAUFORT');
xml.updateChildContent('Hawbs|Parties|Consignee|Address|PostalCode', '28516');
xml.updateChildContent('Hawbs|Parties|Consignee|Address|StateProvince', 'NC');
xml.updateChildContent('Hawbs|Parties|Consignee|Address|Country|Code', 'US');
xml.emitXmlDecl = false;
final httpRequestBody = xml.getXml();
final resp = CkHttpResponse();
try {
http.httpStr('POST', 'http://integration.winwebconnect.com/api/v1/Awb', httpRequestBody, 'utf-8', 'application/xml', resp);
} on ChilkatException catch (e) {
print(e.lastErrorText);
return;
}
final xmlResponse = CkXml();
xmlResponse.loadXml(resp.bodyStr);
// See below for an example XML response body.
print('Response Body:');
print(xmlResponse.getXml());
print('---');
print('Response Header:');
print(resp.header);
print('Success.');
}