Lua
Lua
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 Lua Downloads
local chilkat = require("chilkat")
-- This example assumes the Chilkat HTTP API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
local http = chilkat.Http.new()
-- 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.cookie_dir = "c:/qa_data/cookies"
http.save_cookies = 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.send_cookies = true
-- Build out XML pouch request...
local xml = chilkat.Xml.new()
xml.tag = "PouchDTO"
xml:update_child_content("Mawb|AwbID", "")
xml:update_child_content("Mawb|AwbNumber", "001-12312123")
xml:update_child_content("Mawb|AwbStatus", "D")
xml:update_child_content("Mawb|eAWB", "false")
xml:update_child_content("Mawb|WithPaper", "false")
xml:update_child_content("Mawb|Parties|Shipper|WinID", "444444")
xml:update_child_content("Mawb|Parties|Shipper|AccountNumber", "12345")
xml:update_child_content("Mawb|Parties|Shipper|Name", "AABC SHIPPING & PACKAGING, INC.")
xml:update_child_content("Mawb|Parties|Shipper|Phone", "111-222-3334")
xml:update_child_content("Mawb|Parties|Shipper|Fax", "222-111-3334")
xml:update_child_content("Mawb|Parties|Shipper|Email", "")
xml:update_child_content("Mawb|Parties|Shipper|Address|Line1", "500 HARBOR DRIVE")
xml:update_child_content("Mawb|Parties|Shipper|Address|Line2", "SUITE B1211")
xml:update_child_content("Mawb|Parties|Shipper|Address|Place", "BEAUFORT")
xml:update_child_content("Mawb|Parties|Shipper|Address|PostalCode", "28516")
xml:update_child_content("Mawb|Parties|Shipper|Address|StateProvince", "NC")
xml:update_child_content("Mawb|Parties|Shipper|Address|Country|Code", "US")
xml:update_child_content("Mawb|Parties|Shipper|Address|Country|Name", "U.S.A.")
xml:update_child_content("Mawb|Parties|Consignee|WinID", "0")
xml:update_child_content("Mawb|Parties|Consignee|AccountNumber", "")
xml:update_child_content("Mawb|Parties|Consignee|Name", "DELTA MANUFACTURING")
xml:update_child_content("Mawb|Parties|Consignee|Phone", "444-555-3333")
xml:update_child_content("Mawb|Parties|Consignee|Fax", "")
xml:update_child_content("Mawb|Parties|Consignee|Email", "")
xml:update_child_content("Mawb|Parties|Consignee|Address|Line1", "185 RUE LAMANDE")
xml:update_child_content("Mawb|Parties|Consignee|Address|Line2", "")
xml:update_child_content("Mawb|Parties|Consignee|Address|Place", "PARIS")
xml:update_child_content("Mawb|Parties|Consignee|Address|PostalCode", "75017")
xml:update_child_content("Mawb|Parties|Consignee|Address|StateProvince", "")
xml:update_child_content("Mawb|Parties|Consignee|Address|Country|Code", "FR")
xml:update_child_content("Mawb|Parties|Consignee|Address|Country|Name", "FRANCE")
xml:update_child_content("Mawb|Parties|Notify|WinID", "")
xml:update_child_content("Mawb|Parties|Notify|AccountNumber", "")
xml:update_child_content("Mawb|Parties|Notify|Name", "AABC SHIPPING, INC.")
xml:update_child_content("Mawb|Parties|Notify|Phone", "")
xml:update_child_content("Mawb|Parties|Notify|Fax", "")
xml:update_child_content("Mawb|Parties|Notify|Email", "")
xml:update_child_content("Mawb|Parties|Notify|Address|Line1", "110 FARA WAY")
xml:update_child_content("Mawb|Parties|Notify|Address|Line2", "")
xml:update_child_content("Mawb|Parties|Notify|Address|Place", "OZ")
xml:update_child_content("Mawb|Parties|Notify|Address|PostalCode", "11222")
xml:update_child_content("Mawb|Parties|Notify|Address|StateProvince", "NY")
xml:update_child_content("Mawb|Parties|Notify|Address|Country|Code", "US")
xml:update_child_content("Mawb|Parties|Notify|Address|Country|Name", "U.S.A.")
xml:update_child_content("Mawb|Parties|Agent|WinID", "")
xml:update_child_content("Mawb|Parties|Agent|AccountNumber", "FACCT#1234")
xml:update_child_content("Mawb|Accounting|Identifier", "GEN")
xml:update_child_content("Mawb|Accounting|Information", "SARFWER")
xml:update_child_content("Mawb|Accounting|Identifier", "MCO")
xml:update_child_content("Mawb|Accounting|Information", "WERWERWER")
xml:update_child_content("Mawb|ShipmentReference|ReferenceNumber", "ZDFASF")
xml:update_child_content("Mawb|ShipmentReference|AdditionalInformation", "ZDFASF")
xml:update_child_content("Mawb|RoutingDetails|FromAirportCode", "EWN")
xml:update_child_content("Mawb|RoutingDetails|ToAirportCode", "LON")
xml:update_child_content("Mawb|RoutingDetails|CarrierCode", "AA")
xml:update_child_content("Mawb|RoutingDetails|FlightNumber", "N123")
xml:update_child_content("Mawb|RoutingDetails|FlightDate", "2016-11-30T00:00:00")
xml:update_child_content("Mawb|ChargesDeclaration|CurrencyCode", "USD")
xml:update_child_content("Mawb|ChargesDeclaration|ChargeCode", "PP")
xml:update_child_content("Mawb|ChargesDeclaration|WeightOrValuation", "P")
xml:update_child_content("Mawb|ChargesDeclaration|Other", "P")
xml:update_child_content("Mawb|ChargesDeclaration|ValuesForCarriage", "1300.00")
xml:update_child_content("Mawb|ChargesDeclaration|ValuesForCustoms", "12000.00")
xml:update_child_content("Mawb|ChargesDeclaration|ValuesForInsurance", "11000.00")
xml:update_child_content("Mawb|Handling|SpecialServiceInformation", "Please Notify Consigneetestwwwww")
xml:update_child_content("Mawb|Handling|OtherServiceInformation", "")
xml:update_child_content("Mawb|Handling|SCI", "")
xml:update_child_content("Mawb|Handling|SpecialHandling|Code", "AOG")
xml:update_child_content("Mawb|Handling|SpecialHandling|Code", "ATT")
xml:update_child_content("Mawb|Rates|NumberOfPieces", "12")
xml:update_child_content("Mawb|Rates|GrossWeight|Value", "244.70")
xml:update_child_content("Mawb|Rates|GrossWeight|UOM", "L")
xml:update_child_content("Mawb|Rates|SLAC", "12")
xml:update_child_content("Mawb|Rates|RateClassCode", "N")
xml:update_child_content("Mawb|Rates|CommodityItemNumber", "")
xml:update_child_content("Mawb|Rates|ChargeableWeight", "245.0")
xml:update_child_content("Mawb|Rates|RateOrCharge", "8.00")
xml:update_child_content("Mawb|Rates|ChargeAmount", "1960.00")
xml:update_child_content("Mawb|Rates|NatureAndQuantityOfGoods", "CONSOLIDATION PER ATTACHED MANIFEST.")
xml:update_child_content("Mawb|Rates|Dims|Pcs", "12")
xml:update_child_content("Mawb|Rates|Dims|Length", "4")
xml:update_child_content("Mawb|Rates|Dims|Width", "8")
xml:update_child_content("Mawb|Rates|Dims|Height", "4")
xml:update_child_content("Mawb|Rates|Dims|UOM", "CMT")
xml:update_child_content("Mawb|ChargesSummary|WeightCharge", "1960.00")
xml:update_child_content("Mawb|OtherCharges|Description", "AW")
xml:update_child_content("Mawb|OtherCharges|Amount", "123.00")
xml:update_child_content("Mawb|OtherCharges|ChargeIdentifier", "C")
xml:update_child_content("Mawb|OtherCharges|PrepaidCollect", "C")
xml:update_child_content("Mawb|OtherCharges|Description", "FC")
xml:update_child_content("Mawb|OtherCharges|Amount", "55.00")
xml:update_child_content("Mawb|OtherCharges|ChargeIdentifier", "A")
xml:update_child_content("Mawb|OtherCharges|PrepaidCollect", "P")
xml:update_child_content("Mawb|OtherCharges|Description", "FC")
xml:update_child_content("Mawb|OtherCharges|Amount", "101.00")
xml:update_child_content("Mawb|OtherCharges|ChargeIdentifier", "C")
xml:update_child_content("Mawb|OtherCharges|PrepaidCollect", "C")
xml:update_child_content("Mawb|EmailNotifications|Name", "")
xml:update_child_content("Mawb|EmailNotifications|Email", "")
xml:update_child_content("Mawb|EmailNotifications|Name", "")
xml:update_child_content("Mawb|EmailNotifications|Email", "")
xml:update_child_content("Mawb|EmailNotifications|Name", "")
xml:update_child_content("Mawb|EmailNotifications|Email", "")
xml:update_child_content("Mawb|EmailNotifications|Name", "")
xml:update_child_content("Mawb|EmailNotifications|Email", "")
xml:update_child_content("Mawb|Execution|Date", "2015-08-07T00:00:00")
xml:update_child_content("Mawb|Execution|Place", "OZ NY")
xml:update_child_content("Mawb|Execution|ShipperSignature", "OAS FREIGHT FORWARDE")
xml:update_child_content("Mawb|Execution|CarrierSignature", "OAS FREIGHT FORWARDE")
xml:update_child_content("Hawbs|AwbNumber", "001-12312123")
xml:update_child_content("Hawbs|HawbNumber", "CGL201107-27")
xml:update_child_content("Hawbs|HawbStatus", "D")
xml:update_child_content("Hawbs|NumberOfPieces", "12")
xml:update_child_content("Hawbs|GrossWeight|Value", "244.70")
xml:update_child_content("Hawbs|GrossWeight|UOM", "K")
xml:update_child_content("Hawbs|Locations|PortOfOrigin|Code", "EWN")
xml:update_child_content("Hawbs|Locations|PortOfDestination|Code", "LON")
xml:update_child_content("Hawbs|Commodity", "HWB #: CGL20110")
xml:update_child_content("Hawbs|SLAC", "12")
xml:update_child_content("Hawbs|Parties|Shipper|Name", "ABC SHIPPNG AGAIN")
xml:update_child_content("Hawbs|Parties|Shipper|Phone", "111-222-3333")
xml:update_child_content("Hawbs|Parties|Shipper|Fax", "")
xml:update_child_content("Hawbs|Parties|Shipper|Email", "")
xml:update_child_content("Hawbs|Parties|Shipper|Address|Line1", "100 MAIN STREET")
xml:update_child_content("Hawbs|Parties|Shipper|Address|Place", "OZ")
xml:update_child_content("Hawbs|Parties|Shipper|Address|PostalCode", "ZIP")
xml:update_child_content("Hawbs|Parties|Shipper|Address|StateProvince", "NY")
xml:update_child_content("Hawbs|Parties|Shipper|Address|Country|Code", "US")
xml:update_child_content("Hawbs|Parties|Consignee|Name", "AABC SHIPPING & PACKAGING, INC.")
xml:update_child_content("Hawbs|Parties|Consignee|Phone", "111-222-3334")
xml:update_child_content("Hawbs|Parties|Consignee|Fax", "222-111-3334")
xml:update_child_content("Hawbs|Parties|Consignee|Email", "")
xml:update_child_content("Hawbs|Parties|Consignee|Address|Line1", "500 HARBOR DRIVE")
xml:update_child_content("Hawbs|Parties|Consignee|Address|Place", "BEAUFORT")
xml:update_child_content("Hawbs|Parties|Consignee|Address|PostalCode", "28516")
xml:update_child_content("Hawbs|Parties|Consignee|Address|StateProvince", "NC")
xml:update_child_content("Hawbs|Parties|Consignee|Address|Country|Code", "US")
xml.emit_xml_decl = false
local httpRequestBody = xml:get_xml()
local resp = chilkat.HttpResponse.new()
local success = http:http_str("POST", "http://integration.winwebconnect.com/api/v1/Awb", httpRequestBody, "utf-8", "application/xml", resp)
if not success then
print(http.last_error_text)
return
end
local xmlResponse = chilkat.Xml.new()
xmlResponse:load_xml(resp.body_str)
-- See below for an example XML response body.
print("Response Body:")
print(xmlResponse:get_xml())
print("---")
print("Response Header:")
print(resp.header)
print("Success.")