Sample code for 30+ languages & platforms
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

Unicode C++
#include <CkHttpW.h>
#include <CkXmlW.h>
#include <CkHttpResponseW.h>

void ChilkatSample(void)
    {
    bool success = false;

    // This example assumes the Chilkat HTTP API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    CkHttpW http;

    // Set the "Accept" header to tell the web server that we'll accept an XML response.
    http.put_Accept(L"application/xml");

    // Tell Chilkat to cache any received cookies to files in a particular directory
    http.put_CookieDir(L"c:/qa_data/cookies");
    http.put_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.put_SendCookies(true);

    // Build out XML pouch request...
    CkXmlW xml;
    xml.put_Tag(L"PouchDTO");
    xml.UpdateChildContent(L"Mawb|AwbID",L"");
    xml.UpdateChildContent(L"Mawb|AwbNumber",L"001-12312123");
    xml.UpdateChildContent(L"Mawb|AwbStatus",L"D");
    xml.UpdateChildContent(L"Mawb|eAWB",L"false");
    xml.UpdateChildContent(L"Mawb|WithPaper",L"false");
    xml.UpdateChildContent(L"Mawb|Parties|Shipper|WinID",L"444444");
    xml.UpdateChildContent(L"Mawb|Parties|Shipper|AccountNumber",L"12345");
    xml.UpdateChildContent(L"Mawb|Parties|Shipper|Name",L"AABC SHIPPING & PACKAGING, INC.");
    xml.UpdateChildContent(L"Mawb|Parties|Shipper|Phone",L"111-222-3334");
    xml.UpdateChildContent(L"Mawb|Parties|Shipper|Fax",L"222-111-3334");
    xml.UpdateChildContent(L"Mawb|Parties|Shipper|Email",L"");
    xml.UpdateChildContent(L"Mawb|Parties|Shipper|Address|Line1",L"500 HARBOR DRIVE");
    xml.UpdateChildContent(L"Mawb|Parties|Shipper|Address|Line2",L"SUITE B1211");
    xml.UpdateChildContent(L"Mawb|Parties|Shipper|Address|Place",L"BEAUFORT");
    xml.UpdateChildContent(L"Mawb|Parties|Shipper|Address|PostalCode",L"28516");
    xml.UpdateChildContent(L"Mawb|Parties|Shipper|Address|StateProvince",L"NC");
    xml.UpdateChildContent(L"Mawb|Parties|Shipper|Address|Country|Code",L"US");
    xml.UpdateChildContent(L"Mawb|Parties|Shipper|Address|Country|Name",L"U.S.A.");
    xml.UpdateChildContent(L"Mawb|Parties|Consignee|WinID",L"0");
    xml.UpdateChildContent(L"Mawb|Parties|Consignee|AccountNumber",L"");
    xml.UpdateChildContent(L"Mawb|Parties|Consignee|Name",L"DELTA MANUFACTURING");
    xml.UpdateChildContent(L"Mawb|Parties|Consignee|Phone",L"444-555-3333");
    xml.UpdateChildContent(L"Mawb|Parties|Consignee|Fax",L"");
    xml.UpdateChildContent(L"Mawb|Parties|Consignee|Email",L"");
    xml.UpdateChildContent(L"Mawb|Parties|Consignee|Address|Line1",L"185 RUE LAMANDE");
    xml.UpdateChildContent(L"Mawb|Parties|Consignee|Address|Line2",L"");
    xml.UpdateChildContent(L"Mawb|Parties|Consignee|Address|Place",L"PARIS");
    xml.UpdateChildContent(L"Mawb|Parties|Consignee|Address|PostalCode",L"75017");
    xml.UpdateChildContent(L"Mawb|Parties|Consignee|Address|StateProvince",L"");
    xml.UpdateChildContent(L"Mawb|Parties|Consignee|Address|Country|Code",L"FR");
    xml.UpdateChildContent(L"Mawb|Parties|Consignee|Address|Country|Name",L"FRANCE");
    xml.UpdateChildContent(L"Mawb|Parties|Notify|WinID",L"");
    xml.UpdateChildContent(L"Mawb|Parties|Notify|AccountNumber",L"");
    xml.UpdateChildContent(L"Mawb|Parties|Notify|Name",L"AABC SHIPPING, INC.");
    xml.UpdateChildContent(L"Mawb|Parties|Notify|Phone",L"");
    xml.UpdateChildContent(L"Mawb|Parties|Notify|Fax",L"");
    xml.UpdateChildContent(L"Mawb|Parties|Notify|Email",L"");
    xml.UpdateChildContent(L"Mawb|Parties|Notify|Address|Line1",L"110 FARA WAY");
    xml.UpdateChildContent(L"Mawb|Parties|Notify|Address|Line2",L"");
    xml.UpdateChildContent(L"Mawb|Parties|Notify|Address|Place",L"OZ");
    xml.UpdateChildContent(L"Mawb|Parties|Notify|Address|PostalCode",L"11222");
    xml.UpdateChildContent(L"Mawb|Parties|Notify|Address|StateProvince",L"NY");
    xml.UpdateChildContent(L"Mawb|Parties|Notify|Address|Country|Code",L"US");
    xml.UpdateChildContent(L"Mawb|Parties|Notify|Address|Country|Name",L"U.S.A.");
    xml.UpdateChildContent(L"Mawb|Parties|Agent|WinID",L"");
    xml.UpdateChildContent(L"Mawb|Parties|Agent|AccountNumber",L"FACCT#1234");
    xml.UpdateChildContent(L"Mawb|Accounting|Identifier",L"GEN");
    xml.UpdateChildContent(L"Mawb|Accounting|Information",L"SARFWER");
    xml.UpdateChildContent(L"Mawb|Accounting|Identifier",L"MCO");
    xml.UpdateChildContent(L"Mawb|Accounting|Information",L"WERWERWER");
    xml.UpdateChildContent(L"Mawb|ShipmentReference|ReferenceNumber",L"ZDFASF");
    xml.UpdateChildContent(L"Mawb|ShipmentReference|AdditionalInformation",L"ZDFASF");
    xml.UpdateChildContent(L"Mawb|RoutingDetails|FromAirportCode",L"EWN");
    xml.UpdateChildContent(L"Mawb|RoutingDetails|ToAirportCode",L"LON");
    xml.UpdateChildContent(L"Mawb|RoutingDetails|CarrierCode",L"AA");
    xml.UpdateChildContent(L"Mawb|RoutingDetails|FlightNumber",L"N123");
    xml.UpdateChildContent(L"Mawb|RoutingDetails|FlightDate",L"2016-11-30T00:00:00");
    xml.UpdateChildContent(L"Mawb|ChargesDeclaration|CurrencyCode",L"USD");
    xml.UpdateChildContent(L"Mawb|ChargesDeclaration|ChargeCode",L"PP");
    xml.UpdateChildContent(L"Mawb|ChargesDeclaration|WeightOrValuation",L"P");
    xml.UpdateChildContent(L"Mawb|ChargesDeclaration|Other",L"P");
    xml.UpdateChildContent(L"Mawb|ChargesDeclaration|ValuesForCarriage",L"1300.00");
    xml.UpdateChildContent(L"Mawb|ChargesDeclaration|ValuesForCustoms",L"12000.00");
    xml.UpdateChildContent(L"Mawb|ChargesDeclaration|ValuesForInsurance",L"11000.00");
    xml.UpdateChildContent(L"Mawb|Handling|SpecialServiceInformation",L"Please Notify Consigneetestwwwww");
    xml.UpdateChildContent(L"Mawb|Handling|OtherServiceInformation",L"");
    xml.UpdateChildContent(L"Mawb|Handling|SCI",L"");
    xml.UpdateChildContent(L"Mawb|Handling|SpecialHandling|Code",L"AOG");
    xml.UpdateChildContent(L"Mawb|Handling|SpecialHandling|Code",L"ATT");
    xml.UpdateChildContent(L"Mawb|Rates|NumberOfPieces",L"12");
    xml.UpdateChildContent(L"Mawb|Rates|GrossWeight|Value",L"244.70");
    xml.UpdateChildContent(L"Mawb|Rates|GrossWeight|UOM",L"L");
    xml.UpdateChildContent(L"Mawb|Rates|SLAC",L"12");
    xml.UpdateChildContent(L"Mawb|Rates|RateClassCode",L"N");
    xml.UpdateChildContent(L"Mawb|Rates|CommodityItemNumber",L"");
    xml.UpdateChildContent(L"Mawb|Rates|ChargeableWeight",L"245.0");
    xml.UpdateChildContent(L"Mawb|Rates|RateOrCharge",L"8.00");
    xml.UpdateChildContent(L"Mawb|Rates|ChargeAmount",L"1960.00");
    xml.UpdateChildContent(L"Mawb|Rates|NatureAndQuantityOfGoods",L"CONSOLIDATION PER ATTACHED MANIFEST.");
    xml.UpdateChildContent(L"Mawb|Rates|Dims|Pcs",L"12");
    xml.UpdateChildContent(L"Mawb|Rates|Dims|Length",L"4");
    xml.UpdateChildContent(L"Mawb|Rates|Dims|Width",L"8");
    xml.UpdateChildContent(L"Mawb|Rates|Dims|Height",L"4");
    xml.UpdateChildContent(L"Mawb|Rates|Dims|UOM",L"CMT");
    xml.UpdateChildContent(L"Mawb|ChargesSummary|WeightCharge",L"1960.00");
    xml.UpdateChildContent(L"Mawb|OtherCharges|Description",L"AW");
    xml.UpdateChildContent(L"Mawb|OtherCharges|Amount",L"123.00");
    xml.UpdateChildContent(L"Mawb|OtherCharges|ChargeIdentifier",L"C");
    xml.UpdateChildContent(L"Mawb|OtherCharges|PrepaidCollect",L"C");
    xml.UpdateChildContent(L"Mawb|OtherCharges|Description",L"FC");
    xml.UpdateChildContent(L"Mawb|OtherCharges|Amount",L"55.00");
    xml.UpdateChildContent(L"Mawb|OtherCharges|ChargeIdentifier",L"A");
    xml.UpdateChildContent(L"Mawb|OtherCharges|PrepaidCollect",L"P");
    xml.UpdateChildContent(L"Mawb|OtherCharges|Description",L"FC");
    xml.UpdateChildContent(L"Mawb|OtherCharges|Amount",L"101.00");
    xml.UpdateChildContent(L"Mawb|OtherCharges|ChargeIdentifier",L"C");
    xml.UpdateChildContent(L"Mawb|OtherCharges|PrepaidCollect",L"C");
    xml.UpdateChildContent(L"Mawb|EmailNotifications|Name",L"");
    xml.UpdateChildContent(L"Mawb|EmailNotifications|Email",L"");
    xml.UpdateChildContent(L"Mawb|EmailNotifications|Name",L"");
    xml.UpdateChildContent(L"Mawb|EmailNotifications|Email",L"");
    xml.UpdateChildContent(L"Mawb|EmailNotifications|Name",L"");
    xml.UpdateChildContent(L"Mawb|EmailNotifications|Email",L"");
    xml.UpdateChildContent(L"Mawb|EmailNotifications|Name",L"");
    xml.UpdateChildContent(L"Mawb|EmailNotifications|Email",L"");
    xml.UpdateChildContent(L"Mawb|Execution|Date",L"2015-08-07T00:00:00");
    xml.UpdateChildContent(L"Mawb|Execution|Place",L"OZ NY");
    xml.UpdateChildContent(L"Mawb|Execution|ShipperSignature",L"OAS FREIGHT FORWARDE");
    xml.UpdateChildContent(L"Mawb|Execution|CarrierSignature",L"OAS FREIGHT FORWARDE");
    xml.UpdateChildContent(L"Hawbs|AwbNumber",L"001-12312123");
    xml.UpdateChildContent(L"Hawbs|HawbNumber",L"CGL201107-27");
    xml.UpdateChildContent(L"Hawbs|HawbStatus",L"D");
    xml.UpdateChildContent(L"Hawbs|NumberOfPieces",L"12");
    xml.UpdateChildContent(L"Hawbs|GrossWeight|Value",L"244.70");
    xml.UpdateChildContent(L"Hawbs|GrossWeight|UOM",L"K");
    xml.UpdateChildContent(L"Hawbs|Locations|PortOfOrigin|Code",L"EWN");
    xml.UpdateChildContent(L"Hawbs|Locations|PortOfDestination|Code",L"LON");
    xml.UpdateChildContent(L"Hawbs|Commodity",L"HWB #: CGL20110");
    xml.UpdateChildContent(L"Hawbs|SLAC",L"12");
    xml.UpdateChildContent(L"Hawbs|Parties|Shipper|Name",L"ABC SHIPPNG AGAIN");
    xml.UpdateChildContent(L"Hawbs|Parties|Shipper|Phone",L"111-222-3333");
    xml.UpdateChildContent(L"Hawbs|Parties|Shipper|Fax",L"");
    xml.UpdateChildContent(L"Hawbs|Parties|Shipper|Email",L"");
    xml.UpdateChildContent(L"Hawbs|Parties|Shipper|Address|Line1",L"100 MAIN STREET");
    xml.UpdateChildContent(L"Hawbs|Parties|Shipper|Address|Place",L"OZ");
    xml.UpdateChildContent(L"Hawbs|Parties|Shipper|Address|PostalCode",L"ZIP");
    xml.UpdateChildContent(L"Hawbs|Parties|Shipper|Address|StateProvince",L"NY");
    xml.UpdateChildContent(L"Hawbs|Parties|Shipper|Address|Country|Code",L"US");
    xml.UpdateChildContent(L"Hawbs|Parties|Consignee|Name",L"AABC SHIPPING & PACKAGING, INC.");
    xml.UpdateChildContent(L"Hawbs|Parties|Consignee|Phone",L"111-222-3334");
    xml.UpdateChildContent(L"Hawbs|Parties|Consignee|Fax",L"222-111-3334");
    xml.UpdateChildContent(L"Hawbs|Parties|Consignee|Email",L"");
    xml.UpdateChildContent(L"Hawbs|Parties|Consignee|Address|Line1",L"500 HARBOR DRIVE");
    xml.UpdateChildContent(L"Hawbs|Parties|Consignee|Address|Place",L"BEAUFORT");
    xml.UpdateChildContent(L"Hawbs|Parties|Consignee|Address|PostalCode",L"28516");
    xml.UpdateChildContent(L"Hawbs|Parties|Consignee|Address|StateProvince",L"NC");
    xml.UpdateChildContent(L"Hawbs|Parties|Consignee|Address|Country|Code",L"US");
    xml.put_EmitXmlDecl(false);

    const wchar_t *httpRequestBody = xml.getXml();
    CkHttpResponseW resp;
    success = http.HttpStr(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",http.lastErrorText());
        return;
    }

    CkXmlW xmlResponse;
    xmlResponse.LoadXml(resp.bodyStr());

    // See below for an example XML response body.
    wprintf(L"Response Body:\n");
    wprintf(L"%s\n",xmlResponse.getXml());
    wprintf(L"---\n");

    wprintf(L"Response Header:\n");
    wprintf(L"%s\n",resp.header());
    wprintf(L"Success.\n");
    }