Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Swift 3,4,5...) WIN Air Freight - Send New Pouch RequestSends a "POST /api/v1/Awb" to send a new pouch request.
func chilkatTest() { // This example assumes the Chilkat HTTP API to have been previously unlocked. // See Global Unlock Sample for sample code. let http = CkoHttp()! // 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... let xml = CkoXml()! xml.tag = "PouchDTO" xml.updateChildContent("Mawb|AwbID", value: "") xml.updateChildContent("Mawb|AwbNumber", value: "001-12312123") xml.updateChildContent("Mawb|AwbStatus", value: "D") xml.updateChildContent("Mawb|eAWB", value: "false") xml.updateChildContent("Mawb|WithPaper", value: "false") xml.updateChildContent("Mawb|Parties|Shipper|WinID", value: "444444") xml.updateChildContent("Mawb|Parties|Shipper|AccountNumber", value: "12345") xml.updateChildContent("Mawb|Parties|Shipper|Name", value: "AABC SHIPPING & PACKAGING, INC.") xml.updateChildContent("Mawb|Parties|Shipper|Phone", value: "111-222-3334") xml.updateChildContent("Mawb|Parties|Shipper|Fax", value: "222-111-3334") xml.updateChildContent("Mawb|Parties|Shipper|Email", value: "") xml.updateChildContent("Mawb|Parties|Shipper|Address|Line1", value: "500 HARBOR DRIVE") xml.updateChildContent("Mawb|Parties|Shipper|Address|Line2", value: "SUITE B1211") xml.updateChildContent("Mawb|Parties|Shipper|Address|Place", value: "BEAUFORT") xml.updateChildContent("Mawb|Parties|Shipper|Address|PostalCode", value: "28516") xml.updateChildContent("Mawb|Parties|Shipper|Address|StateProvince", value: "NC") xml.updateChildContent("Mawb|Parties|Shipper|Address|Country|Code", value: "US") xml.updateChildContent("Mawb|Parties|Shipper|Address|Country|Name", value: "U.S.A.") xml.updateChildContent("Mawb|Parties|Consignee|WinID", value: "0") xml.updateChildContent("Mawb|Parties|Consignee|AccountNumber", value: "") xml.updateChildContent("Mawb|Parties|Consignee|Name", value: "DELTA MANUFACTURING") xml.updateChildContent("Mawb|Parties|Consignee|Phone", value: "444-555-3333") xml.updateChildContent("Mawb|Parties|Consignee|Fax", value: "") xml.updateChildContent("Mawb|Parties|Consignee|Email", value: "") xml.updateChildContent("Mawb|Parties|Consignee|Address|Line1", value: "185 RUE LAMANDE") xml.updateChildContent("Mawb|Parties|Consignee|Address|Line2", value: "") xml.updateChildContent("Mawb|Parties|Consignee|Address|Place", value: "PARIS") xml.updateChildContent("Mawb|Parties|Consignee|Address|PostalCode", value: "75017") xml.updateChildContent("Mawb|Parties|Consignee|Address|StateProvince", value: "") xml.updateChildContent("Mawb|Parties|Consignee|Address|Country|Code", value: "FR") xml.updateChildContent("Mawb|Parties|Consignee|Address|Country|Name", value: "FRANCE") xml.updateChildContent("Mawb|Parties|Notify|WinID", value: "") xml.updateChildContent("Mawb|Parties|Notify|AccountNumber", value: "") xml.updateChildContent("Mawb|Parties|Notify|Name", value: "AABC SHIPPING, INC.") xml.updateChildContent("Mawb|Parties|Notify|Phone", value: "") xml.updateChildContent("Mawb|Parties|Notify|Fax", value: "") xml.updateChildContent("Mawb|Parties|Notify|Email", value: "") xml.updateChildContent("Mawb|Parties|Notify|Address|Line1", value: "110 FARA WAY") xml.updateChildContent("Mawb|Parties|Notify|Address|Line2", value: "") xml.updateChildContent("Mawb|Parties|Notify|Address|Place", value: "OZ") xml.updateChildContent("Mawb|Parties|Notify|Address|PostalCode", value: "11222") xml.updateChildContent("Mawb|Parties|Notify|Address|StateProvince", value: "NY") xml.updateChildContent("Mawb|Parties|Notify|Address|Country|Code", value: "US") xml.updateChildContent("Mawb|Parties|Notify|Address|Country|Name", value: "U.S.A.") xml.updateChildContent("Mawb|Parties|Agent|WinID", value: "") xml.updateChildContent("Mawb|Parties|Agent|AccountNumber", value: "FACCT#1234") xml.updateChildContent("Mawb|Accounting|Identifier", value: "GEN") xml.updateChildContent("Mawb|Accounting|Information", value: "SARFWER") xml.updateChildContent("Mawb|Accounting|Identifier", value: "MCO") xml.updateChildContent("Mawb|Accounting|Information", value: "WERWERWER") xml.updateChildContent("Mawb|ShipmentReference|ReferenceNumber", value: "ZDFASF") xml.updateChildContent("Mawb|ShipmentReference|AdditionalInformation", value: "ZDFASF") xml.updateChildContent("Mawb|RoutingDetails|FromAirportCode", value: "EWN") xml.updateChildContent("Mawb|RoutingDetails|ToAirportCode", value: "LON") xml.updateChildContent("Mawb|RoutingDetails|CarrierCode", value: "AA") xml.updateChildContent("Mawb|RoutingDetails|FlightNumber", value: "N123") xml.updateChildContent("Mawb|RoutingDetails|FlightDate", value: "2016-11-30T00:00:00") xml.updateChildContent("Mawb|ChargesDeclaration|CurrencyCode", value: "USD") xml.updateChildContent("Mawb|ChargesDeclaration|ChargeCode", value: "PP") xml.updateChildContent("Mawb|ChargesDeclaration|WeightOrValuation", value: "P") xml.updateChildContent("Mawb|ChargesDeclaration|Other", value: "P") xml.updateChildContent("Mawb|ChargesDeclaration|ValuesForCarriage", value: "1300.00") xml.updateChildContent("Mawb|ChargesDeclaration|ValuesForCustoms", value: "12000.00") xml.updateChildContent("Mawb|ChargesDeclaration|ValuesForInsurance", value: "11000.00") xml.updateChildContent("Mawb|Handling|SpecialServiceInformation", value: "Please Notify Consigneetestwwwww") xml.updateChildContent("Mawb|Handling|OtherServiceInformation", value: "") xml.updateChildContent("Mawb|Handling|SCI", value: "") xml.updateChildContent("Mawb|Handling|SpecialHandling|Code", value: "AOG") xml.updateChildContent("Mawb|Handling|SpecialHandling|Code", value: "ATT") xml.updateChildContent("Mawb|Rates|NumberOfPieces", value: "12") xml.updateChildContent("Mawb|Rates|GrossWeight|Value", value: "244.70") xml.updateChildContent("Mawb|Rates|GrossWeight|UOM", value: "L") xml.updateChildContent("Mawb|Rates|SLAC", value: "12") xml.updateChildContent("Mawb|Rates|RateClassCode", value: "N") xml.updateChildContent("Mawb|Rates|CommodityItemNumber", value: "") xml.updateChildContent("Mawb|Rates|ChargeableWeight", value: "245.0") xml.updateChildContent("Mawb|Rates|RateOrCharge", value: "8.00") xml.updateChildContent("Mawb|Rates|ChargeAmount", value: "1960.00") xml.updateChildContent("Mawb|Rates|NatureAndQuantityOfGoods", value: "CONSOLIDATION PER ATTACHED MANIFEST.") xml.updateChildContent("Mawb|Rates|Dims|Pcs", value: "12") xml.updateChildContent("Mawb|Rates|Dims|Length", value: "4") xml.updateChildContent("Mawb|Rates|Dims|Width", value: "8") xml.updateChildContent("Mawb|Rates|Dims|Height", value: "4") xml.updateChildContent("Mawb|Rates|Dims|UOM", value: "CMT") xml.updateChildContent("Mawb|ChargesSummary|WeightCharge", value: "1960.00") xml.updateChildContent("Mawb|OtherCharges|Description", value: "AW") xml.updateChildContent("Mawb|OtherCharges|Amount", value: "123.00") xml.updateChildContent("Mawb|OtherCharges|ChargeIdentifier", value: "C") xml.updateChildContent("Mawb|OtherCharges|PrepaidCollect", value: "C") xml.updateChildContent("Mawb|OtherCharges|Description", value: "FC") xml.updateChildContent("Mawb|OtherCharges|Amount", value: "55.00") xml.updateChildContent("Mawb|OtherCharges|ChargeIdentifier", value: "A") xml.updateChildContent("Mawb|OtherCharges|PrepaidCollect", value: "P") xml.updateChildContent("Mawb|OtherCharges|Description", value: "FC") xml.updateChildContent("Mawb|OtherCharges|Amount", value: "101.00") xml.updateChildContent("Mawb|OtherCharges|ChargeIdentifier", value: "C") xml.updateChildContent("Mawb|OtherCharges|PrepaidCollect", value: "C") xml.updateChildContent("Mawb|EmailNotifications|Name", value: "") xml.updateChildContent("Mawb|EmailNotifications|Email", value: "") xml.updateChildContent("Mawb|EmailNotifications|Name", value: "") xml.updateChildContent("Mawb|EmailNotifications|Email", value: "") xml.updateChildContent("Mawb|EmailNotifications|Name", value: "") xml.updateChildContent("Mawb|EmailNotifications|Email", value: "") xml.updateChildContent("Mawb|EmailNotifications|Name", value: "") xml.updateChildContent("Mawb|EmailNotifications|Email", value: "") xml.updateChildContent("Mawb|Execution|Date", value: "2015-08-07T00:00:00") xml.updateChildContent("Mawb|Execution|Place", value: "OZ NY") xml.updateChildContent("Mawb|Execution|ShipperSignature", value: "OAS FREIGHT FORWARDE") xml.updateChildContent("Mawb|Execution|CarrierSignature", value: "OAS FREIGHT FORWARDE") xml.updateChildContent("Hawbs|AwbNumber", value: "001-12312123") xml.updateChildContent("Hawbs|HawbNumber", value: "CGL201107-27") xml.updateChildContent("Hawbs|HawbStatus", value: "D") xml.updateChildContent("Hawbs|NumberOfPieces", value: "12") xml.updateChildContent("Hawbs|GrossWeight|Value", value: "244.70") xml.updateChildContent("Hawbs|GrossWeight|UOM", value: "K") xml.updateChildContent("Hawbs|Locations|PortOfOrigin|Code", value: "EWN") xml.updateChildContent("Hawbs|Locations|PortOfDestination|Code", value: "LON") xml.updateChildContent("Hawbs|Commodity", value: "HWB #: CGL20110") xml.updateChildContent("Hawbs|SLAC", value: "12") xml.updateChildContent("Hawbs|Parties|Shipper|Name", value: "ABC SHIPPNG AGAIN") xml.updateChildContent("Hawbs|Parties|Shipper|Phone", value: "111-222-3333") xml.updateChildContent("Hawbs|Parties|Shipper|Fax", value: "") xml.updateChildContent("Hawbs|Parties|Shipper|Email", value: "") xml.updateChildContent("Hawbs|Parties|Shipper|Address|Line1", value: "100 MAIN STREET") xml.updateChildContent("Hawbs|Parties|Shipper|Address|Place", value: "OZ") xml.updateChildContent("Hawbs|Parties|Shipper|Address|PostalCode", value: "ZIP") xml.updateChildContent("Hawbs|Parties|Shipper|Address|StateProvince", value: "NY") xml.updateChildContent("Hawbs|Parties|Shipper|Address|Country|Code", value: "US") xml.updateChildContent("Hawbs|Parties|Consignee|Name", value: "AABC SHIPPING & PACKAGING, INC.") xml.updateChildContent("Hawbs|Parties|Consignee|Phone", value: "111-222-3334") xml.updateChildContent("Hawbs|Parties|Consignee|Fax", value: "222-111-3334") xml.updateChildContent("Hawbs|Parties|Consignee|Email", value: "") xml.updateChildContent("Hawbs|Parties|Consignee|Address|Line1", value: "500 HARBOR DRIVE") xml.updateChildContent("Hawbs|Parties|Consignee|Address|Place", value: "BEAUFORT") xml.updateChildContent("Hawbs|Parties|Consignee|Address|PostalCode", value: "28516") xml.updateChildContent("Hawbs|Parties|Consignee|Address|StateProvince", value: "NC") xml.updateChildContent("Hawbs|Parties|Consignee|Address|Country|Code", value: "US") xml.emitXmlDecl = false var resp: CkoHttpResponse? = http.pText("POST", url: "http://integration.winwebconnect.com/api/v1/Awb", textData: xml.getXml(), charset: "utf-8", contentType: "application/xml", md5: false, gzip: false) if http.lastMethodSuccess != true { print("\(http.lastErrorText!)") return } let xmlResponse = CkoXml()! xmlResponse.load(resp!.bodyStr) // See below for an example XML response body. print("Response Body:") print("\(xmlResponse.getXml()!)") print("---") print("Response Header:") print("\(resp!.header!)") resp = nil print("Success.") } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.