Unicode C
Unicode C
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 Unicode C Downloads
#include <C_CkHttpW.h>
#include <C_CkXmlW.h>
#include <C_CkHttpResponseW.h>
void ChilkatSample(void)
{
BOOL success;
HCkHttpW http;
HCkXmlW xml;
const wchar_t *httpRequestBody;
HCkHttpResponseW resp;
HCkXmlW xmlResponse;
success = FALSE;
// This example assumes the Chilkat HTTP API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http = CkHttpW_Create();
// Set the "Accept" header to tell the web server that we'll accept an XML response.
CkHttpW_putAccept(http,L"application/xml");
// Tell Chilkat to cache any received cookies to files in a particular directory
CkHttpW_putCookieDir(http,L"c:/qa_data/cookies");
CkHttpW_putSaveCookies(http,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.
CkHttpW_putSendCookies(http,TRUE);
// Build out XML pouch request...
xml = CkXmlW_Create();
CkXmlW_putTag(xml,L"PouchDTO");
CkXmlW_UpdateChildContent(xml,L"Mawb|AwbID",L"");
CkXmlW_UpdateChildContent(xml,L"Mawb|AwbNumber",L"001-12312123");
CkXmlW_UpdateChildContent(xml,L"Mawb|AwbStatus",L"D");
CkXmlW_UpdateChildContent(xml,L"Mawb|eAWB",L"false");
CkXmlW_UpdateChildContent(xml,L"Mawb|WithPaper",L"false");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Shipper|WinID",L"444444");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Shipper|AccountNumber",L"12345");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Shipper|Name",L"AABC SHIPPING & PACKAGING, INC.");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Shipper|Phone",L"111-222-3334");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Shipper|Fax",L"222-111-3334");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Shipper|Email",L"");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Shipper|Address|Line1",L"500 HARBOR DRIVE");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Shipper|Address|Line2",L"SUITE B1211");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Shipper|Address|Place",L"BEAUFORT");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Shipper|Address|PostalCode",L"28516");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Shipper|Address|StateProvince",L"NC");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Shipper|Address|Country|Code",L"US");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Shipper|Address|Country|Name",L"U.S.A.");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Consignee|WinID",L"0");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Consignee|AccountNumber",L"");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Consignee|Name",L"DELTA MANUFACTURING");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Consignee|Phone",L"444-555-3333");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Consignee|Fax",L"");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Consignee|Email",L"");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Consignee|Address|Line1",L"185 RUE LAMANDE");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Consignee|Address|Line2",L"");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Consignee|Address|Place",L"PARIS");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Consignee|Address|PostalCode",L"75017");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Consignee|Address|StateProvince",L"");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Consignee|Address|Country|Code",L"FR");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Consignee|Address|Country|Name",L"FRANCE");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Notify|WinID",L"");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Notify|AccountNumber",L"");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Notify|Name",L"AABC SHIPPING, INC.");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Notify|Phone",L"");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Notify|Fax",L"");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Notify|Email",L"");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Notify|Address|Line1",L"110 FARA WAY");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Notify|Address|Line2",L"");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Notify|Address|Place",L"OZ");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Notify|Address|PostalCode",L"11222");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Notify|Address|StateProvince",L"NY");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Notify|Address|Country|Code",L"US");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Notify|Address|Country|Name",L"U.S.A.");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Agent|WinID",L"");
CkXmlW_UpdateChildContent(xml,L"Mawb|Parties|Agent|AccountNumber",L"FACCT#1234");
CkXmlW_UpdateChildContent(xml,L"Mawb|Accounting|Identifier",L"GEN");
CkXmlW_UpdateChildContent(xml,L"Mawb|Accounting|Information",L"SARFWER");
CkXmlW_UpdateChildContent(xml,L"Mawb|Accounting|Identifier",L"MCO");
CkXmlW_UpdateChildContent(xml,L"Mawb|Accounting|Information",L"WERWERWER");
CkXmlW_UpdateChildContent(xml,L"Mawb|ShipmentReference|ReferenceNumber",L"ZDFASF");
CkXmlW_UpdateChildContent(xml,L"Mawb|ShipmentReference|AdditionalInformation",L"ZDFASF");
CkXmlW_UpdateChildContent(xml,L"Mawb|RoutingDetails|FromAirportCode",L"EWN");
CkXmlW_UpdateChildContent(xml,L"Mawb|RoutingDetails|ToAirportCode",L"LON");
CkXmlW_UpdateChildContent(xml,L"Mawb|RoutingDetails|CarrierCode",L"AA");
CkXmlW_UpdateChildContent(xml,L"Mawb|RoutingDetails|FlightNumber",L"N123");
CkXmlW_UpdateChildContent(xml,L"Mawb|RoutingDetails|FlightDate",L"2016-11-30T00:00:00");
CkXmlW_UpdateChildContent(xml,L"Mawb|ChargesDeclaration|CurrencyCode",L"USD");
CkXmlW_UpdateChildContent(xml,L"Mawb|ChargesDeclaration|ChargeCode",L"PP");
CkXmlW_UpdateChildContent(xml,L"Mawb|ChargesDeclaration|WeightOrValuation",L"P");
CkXmlW_UpdateChildContent(xml,L"Mawb|ChargesDeclaration|Other",L"P");
CkXmlW_UpdateChildContent(xml,L"Mawb|ChargesDeclaration|ValuesForCarriage",L"1300.00");
CkXmlW_UpdateChildContent(xml,L"Mawb|ChargesDeclaration|ValuesForCustoms",L"12000.00");
CkXmlW_UpdateChildContent(xml,L"Mawb|ChargesDeclaration|ValuesForInsurance",L"11000.00");
CkXmlW_UpdateChildContent(xml,L"Mawb|Handling|SpecialServiceInformation",L"Please Notify Consigneetestwwwww");
CkXmlW_UpdateChildContent(xml,L"Mawb|Handling|OtherServiceInformation",L"");
CkXmlW_UpdateChildContent(xml,L"Mawb|Handling|SCI",L"");
CkXmlW_UpdateChildContent(xml,L"Mawb|Handling|SpecialHandling|Code",L"AOG");
CkXmlW_UpdateChildContent(xml,L"Mawb|Handling|SpecialHandling|Code",L"ATT");
CkXmlW_UpdateChildContent(xml,L"Mawb|Rates|NumberOfPieces",L"12");
CkXmlW_UpdateChildContent(xml,L"Mawb|Rates|GrossWeight|Value",L"244.70");
CkXmlW_UpdateChildContent(xml,L"Mawb|Rates|GrossWeight|UOM",L"L");
CkXmlW_UpdateChildContent(xml,L"Mawb|Rates|SLAC",L"12");
CkXmlW_UpdateChildContent(xml,L"Mawb|Rates|RateClassCode",L"N");
CkXmlW_UpdateChildContent(xml,L"Mawb|Rates|CommodityItemNumber",L"");
CkXmlW_UpdateChildContent(xml,L"Mawb|Rates|ChargeableWeight",L"245.0");
CkXmlW_UpdateChildContent(xml,L"Mawb|Rates|RateOrCharge",L"8.00");
CkXmlW_UpdateChildContent(xml,L"Mawb|Rates|ChargeAmount",L"1960.00");
CkXmlW_UpdateChildContent(xml,L"Mawb|Rates|NatureAndQuantityOfGoods",L"CONSOLIDATION PER ATTACHED MANIFEST.");
CkXmlW_UpdateChildContent(xml,L"Mawb|Rates|Dims|Pcs",L"12");
CkXmlW_UpdateChildContent(xml,L"Mawb|Rates|Dims|Length",L"4");
CkXmlW_UpdateChildContent(xml,L"Mawb|Rates|Dims|Width",L"8");
CkXmlW_UpdateChildContent(xml,L"Mawb|Rates|Dims|Height",L"4");
CkXmlW_UpdateChildContent(xml,L"Mawb|Rates|Dims|UOM",L"CMT");
CkXmlW_UpdateChildContent(xml,L"Mawb|ChargesSummary|WeightCharge",L"1960.00");
CkXmlW_UpdateChildContent(xml,L"Mawb|OtherCharges|Description",L"AW");
CkXmlW_UpdateChildContent(xml,L"Mawb|OtherCharges|Amount",L"123.00");
CkXmlW_UpdateChildContent(xml,L"Mawb|OtherCharges|ChargeIdentifier",L"C");
CkXmlW_UpdateChildContent(xml,L"Mawb|OtherCharges|PrepaidCollect",L"C");
CkXmlW_UpdateChildContent(xml,L"Mawb|OtherCharges|Description",L"FC");
CkXmlW_UpdateChildContent(xml,L"Mawb|OtherCharges|Amount",L"55.00");
CkXmlW_UpdateChildContent(xml,L"Mawb|OtherCharges|ChargeIdentifier",L"A");
CkXmlW_UpdateChildContent(xml,L"Mawb|OtherCharges|PrepaidCollect",L"P");
CkXmlW_UpdateChildContent(xml,L"Mawb|OtherCharges|Description",L"FC");
CkXmlW_UpdateChildContent(xml,L"Mawb|OtherCharges|Amount",L"101.00");
CkXmlW_UpdateChildContent(xml,L"Mawb|OtherCharges|ChargeIdentifier",L"C");
CkXmlW_UpdateChildContent(xml,L"Mawb|OtherCharges|PrepaidCollect",L"C");
CkXmlW_UpdateChildContent(xml,L"Mawb|EmailNotifications|Name",L"");
CkXmlW_UpdateChildContent(xml,L"Mawb|EmailNotifications|Email",L"");
CkXmlW_UpdateChildContent(xml,L"Mawb|EmailNotifications|Name",L"");
CkXmlW_UpdateChildContent(xml,L"Mawb|EmailNotifications|Email",L"");
CkXmlW_UpdateChildContent(xml,L"Mawb|EmailNotifications|Name",L"");
CkXmlW_UpdateChildContent(xml,L"Mawb|EmailNotifications|Email",L"");
CkXmlW_UpdateChildContent(xml,L"Mawb|EmailNotifications|Name",L"");
CkXmlW_UpdateChildContent(xml,L"Mawb|EmailNotifications|Email",L"");
CkXmlW_UpdateChildContent(xml,L"Mawb|Execution|Date",L"2015-08-07T00:00:00");
CkXmlW_UpdateChildContent(xml,L"Mawb|Execution|Place",L"OZ NY");
CkXmlW_UpdateChildContent(xml,L"Mawb|Execution|ShipperSignature",L"OAS FREIGHT FORWARDE");
CkXmlW_UpdateChildContent(xml,L"Mawb|Execution|CarrierSignature",L"OAS FREIGHT FORWARDE");
CkXmlW_UpdateChildContent(xml,L"Hawbs|AwbNumber",L"001-12312123");
CkXmlW_UpdateChildContent(xml,L"Hawbs|HawbNumber",L"CGL201107-27");
CkXmlW_UpdateChildContent(xml,L"Hawbs|HawbStatus",L"D");
CkXmlW_UpdateChildContent(xml,L"Hawbs|NumberOfPieces",L"12");
CkXmlW_UpdateChildContent(xml,L"Hawbs|GrossWeight|Value",L"244.70");
CkXmlW_UpdateChildContent(xml,L"Hawbs|GrossWeight|UOM",L"K");
CkXmlW_UpdateChildContent(xml,L"Hawbs|Locations|PortOfOrigin|Code",L"EWN");
CkXmlW_UpdateChildContent(xml,L"Hawbs|Locations|PortOfDestination|Code",L"LON");
CkXmlW_UpdateChildContent(xml,L"Hawbs|Commodity",L"HWB #: CGL20110");
CkXmlW_UpdateChildContent(xml,L"Hawbs|SLAC",L"12");
CkXmlW_UpdateChildContent(xml,L"Hawbs|Parties|Shipper|Name",L"ABC SHIPPNG AGAIN");
CkXmlW_UpdateChildContent(xml,L"Hawbs|Parties|Shipper|Phone",L"111-222-3333");
CkXmlW_UpdateChildContent(xml,L"Hawbs|Parties|Shipper|Fax",L"");
CkXmlW_UpdateChildContent(xml,L"Hawbs|Parties|Shipper|Email",L"");
CkXmlW_UpdateChildContent(xml,L"Hawbs|Parties|Shipper|Address|Line1",L"100 MAIN STREET");
CkXmlW_UpdateChildContent(xml,L"Hawbs|Parties|Shipper|Address|Place",L"OZ");
CkXmlW_UpdateChildContent(xml,L"Hawbs|Parties|Shipper|Address|PostalCode",L"ZIP");
CkXmlW_UpdateChildContent(xml,L"Hawbs|Parties|Shipper|Address|StateProvince",L"NY");
CkXmlW_UpdateChildContent(xml,L"Hawbs|Parties|Shipper|Address|Country|Code",L"US");
CkXmlW_UpdateChildContent(xml,L"Hawbs|Parties|Consignee|Name",L"AABC SHIPPING & PACKAGING, INC.");
CkXmlW_UpdateChildContent(xml,L"Hawbs|Parties|Consignee|Phone",L"111-222-3334");
CkXmlW_UpdateChildContent(xml,L"Hawbs|Parties|Consignee|Fax",L"222-111-3334");
CkXmlW_UpdateChildContent(xml,L"Hawbs|Parties|Consignee|Email",L"");
CkXmlW_UpdateChildContent(xml,L"Hawbs|Parties|Consignee|Address|Line1",L"500 HARBOR DRIVE");
CkXmlW_UpdateChildContent(xml,L"Hawbs|Parties|Consignee|Address|Place",L"BEAUFORT");
CkXmlW_UpdateChildContent(xml,L"Hawbs|Parties|Consignee|Address|PostalCode",L"28516");
CkXmlW_UpdateChildContent(xml,L"Hawbs|Parties|Consignee|Address|StateProvince",L"NC");
CkXmlW_UpdateChildContent(xml,L"Hawbs|Parties|Consignee|Address|Country|Code",L"US");
CkXmlW_putEmitXmlDecl(xml,FALSE);
httpRequestBody = CkXmlW_getXml(xml);
resp = CkHttpResponseW_Create();
success = CkHttpW_HttpStr(http,L"POST",L"http://integration.winwebconnect.com/api/v1/Awb",httpRequestBody,L"utf-8",L"application/xml",resp);
if (success == FALSE) {
wprintf(L"%s\n",CkHttpW_lastErrorText(http));
CkHttpW_Dispose(http);
CkXmlW_Dispose(xml);
CkHttpResponseW_Dispose(resp);
return;
}
xmlResponse = CkXmlW_Create();
CkXmlW_LoadXml(xmlResponse,CkHttpResponseW_bodyStr(resp));
// See below for an example XML response body.
wprintf(L"Response Body:\n");
wprintf(L"%s\n",CkXmlW_getXml(xmlResponse));
wprintf(L"---\n");
wprintf(L"Response Header:\n");
wprintf(L"%s\n",CkHttpResponseW_header(resp));
wprintf(L"Success.\n");
CkHttpW_Dispose(http);
CkXmlW_Dispose(xml);
CkHttpResponseW_Dispose(resp);
CkXmlW_Dispose(xmlResponse);
}