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
(PureBasic) WIN Air Freight - Send New Pouch RequestSends a "POST /api/v1/Awb" to send a new pouch request.
IncludeFile "CkHttpResponse.pb" IncludeFile "CkHttp.pb" IncludeFile "CkXml.pb" Procedure ChilkatExample() ; This example assumes the Chilkat HTTP API to have been previously unlocked. ; See Global Unlock Sample for sample code. http.i = CkHttp::ckCreate() If http.i = 0 Debug "Failed to create object." ProcedureReturn EndIf ; Set the "Accept" header to tell the web server that we'll accept an XML response. CkHttp::setCkAccept(http, "application/xml") ; Tell Chilkat to cache any received cookies to files in a particular directory CkHttp::setCkCookieDir(http, "c:/qa_data/cookies") CkHttp::setCkSaveCookies(http, 1) ; 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. CkHttp::setCkSendCookies(http, 1) ; Build out XML pouch request... xml.i = CkXml::ckCreate() If xml.i = 0 Debug "Failed to create object." ProcedureReturn EndIf CkXml::setCkTag(xml, "PouchDTO") CkXml::ckUpdateChildContent(xml,"Mawb|AwbID","") CkXml::ckUpdateChildContent(xml,"Mawb|AwbNumber","001-12312123") CkXml::ckUpdateChildContent(xml,"Mawb|AwbStatus","D") CkXml::ckUpdateChildContent(xml,"Mawb|eAWB","false") CkXml::ckUpdateChildContent(xml,"Mawb|WithPaper","false") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Shipper|WinID","444444") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Shipper|AccountNumber","12345") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Shipper|Name","AABC SHIPPING & PACKAGING, INC.") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Shipper|Phone","111-222-3334") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Shipper|Fax","222-111-3334") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Shipper|Email","") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Shipper|Address|Line1","500 HARBOR DRIVE") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Shipper|Address|Line2","SUITE B1211") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Shipper|Address|Place","BEAUFORT") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Shipper|Address|PostalCode","28516") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Shipper|Address|StateProvince","NC") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Shipper|Address|Country|Code","US") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Shipper|Address|Country|Name","U.S.A.") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Consignee|WinID","0") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Consignee|AccountNumber","") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Consignee|Name","DELTA MANUFACTURING") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Consignee|Phone","444-555-3333") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Consignee|Fax","") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Consignee|Email","") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Consignee|Address|Line1","185 RUE LAMANDE") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Consignee|Address|Line2","") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Consignee|Address|Place","PARIS") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Consignee|Address|PostalCode","75017") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Consignee|Address|StateProvince","") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Consignee|Address|Country|Code","FR") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Consignee|Address|Country|Name","FRANCE") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Notify|WinID","") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Notify|AccountNumber","") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Notify|Name","AABC SHIPPING, INC.") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Notify|Phone","") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Notify|Fax","") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Notify|Email","") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Notify|Address|Line1","110 FARA WAY") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Notify|Address|Line2","") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Notify|Address|Place","OZ") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Notify|Address|PostalCode","11222") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Notify|Address|StateProvince","NY") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Notify|Address|Country|Code","US") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Notify|Address|Country|Name","U.S.A.") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Agent|WinID","") CkXml::ckUpdateChildContent(xml,"Mawb|Parties|Agent|AccountNumber","FACCT#1234") CkXml::ckUpdateChildContent(xml,"Mawb|Accounting|Identifier","GEN") CkXml::ckUpdateChildContent(xml,"Mawb|Accounting|Information","SARFWER") CkXml::ckUpdateChildContent(xml,"Mawb|Accounting|Identifier","MCO") CkXml::ckUpdateChildContent(xml,"Mawb|Accounting|Information","WERWERWER") CkXml::ckUpdateChildContent(xml,"Mawb|ShipmentReference|ReferenceNumber","ZDFASF") CkXml::ckUpdateChildContent(xml,"Mawb|ShipmentReference|AdditionalInformation","ZDFASF") CkXml::ckUpdateChildContent(xml,"Mawb|RoutingDetails|FromAirportCode","EWN") CkXml::ckUpdateChildContent(xml,"Mawb|RoutingDetails|ToAirportCode","LON") CkXml::ckUpdateChildContent(xml,"Mawb|RoutingDetails|CarrierCode","AA") CkXml::ckUpdateChildContent(xml,"Mawb|RoutingDetails|FlightNumber","N123") CkXml::ckUpdateChildContent(xml,"Mawb|RoutingDetails|FlightDate","2016-11-30T00:00:00") CkXml::ckUpdateChildContent(xml,"Mawb|ChargesDeclaration|CurrencyCode","USD") CkXml::ckUpdateChildContent(xml,"Mawb|ChargesDeclaration|ChargeCode","PP") CkXml::ckUpdateChildContent(xml,"Mawb|ChargesDeclaration|WeightOrValuation","P") CkXml::ckUpdateChildContent(xml,"Mawb|ChargesDeclaration|Other","P") CkXml::ckUpdateChildContent(xml,"Mawb|ChargesDeclaration|ValuesForCarriage","1300.00") CkXml::ckUpdateChildContent(xml,"Mawb|ChargesDeclaration|ValuesForCustoms","12000.00") CkXml::ckUpdateChildContent(xml,"Mawb|ChargesDeclaration|ValuesForInsurance","11000.00") CkXml::ckUpdateChildContent(xml,"Mawb|Handling|SpecialServiceInformation","Please Notify Consigneetestwwwww") CkXml::ckUpdateChildContent(xml,"Mawb|Handling|OtherServiceInformation","") CkXml::ckUpdateChildContent(xml,"Mawb|Handling|SCI","") CkXml::ckUpdateChildContent(xml,"Mawb|Handling|SpecialHandling|Code","AOG") CkXml::ckUpdateChildContent(xml,"Mawb|Handling|SpecialHandling|Code","ATT") CkXml::ckUpdateChildContent(xml,"Mawb|Rates|NumberOfPieces","12") CkXml::ckUpdateChildContent(xml,"Mawb|Rates|GrossWeight|Value","244.70") CkXml::ckUpdateChildContent(xml,"Mawb|Rates|GrossWeight|UOM","L") CkXml::ckUpdateChildContent(xml,"Mawb|Rates|SLAC","12") CkXml::ckUpdateChildContent(xml,"Mawb|Rates|RateClassCode","N") CkXml::ckUpdateChildContent(xml,"Mawb|Rates|CommodityItemNumber","") CkXml::ckUpdateChildContent(xml,"Mawb|Rates|ChargeableWeight","245.0") CkXml::ckUpdateChildContent(xml,"Mawb|Rates|RateOrCharge","8.00") CkXml::ckUpdateChildContent(xml,"Mawb|Rates|ChargeAmount","1960.00") CkXml::ckUpdateChildContent(xml,"Mawb|Rates|NatureAndQuantityOfGoods","CONSOLIDATION PER ATTACHED MANIFEST.") CkXml::ckUpdateChildContent(xml,"Mawb|Rates|Dims|Pcs","12") CkXml::ckUpdateChildContent(xml,"Mawb|Rates|Dims|Length","4") CkXml::ckUpdateChildContent(xml,"Mawb|Rates|Dims|Width","8") CkXml::ckUpdateChildContent(xml,"Mawb|Rates|Dims|Height","4") CkXml::ckUpdateChildContent(xml,"Mawb|Rates|Dims|UOM","CMT") CkXml::ckUpdateChildContent(xml,"Mawb|ChargesSummary|WeightCharge","1960.00") CkXml::ckUpdateChildContent(xml,"Mawb|OtherCharges|Description","AW") CkXml::ckUpdateChildContent(xml,"Mawb|OtherCharges|Amount","123.00") CkXml::ckUpdateChildContent(xml,"Mawb|OtherCharges|ChargeIdentifier","C") CkXml::ckUpdateChildContent(xml,"Mawb|OtherCharges|PrepaidCollect","C") CkXml::ckUpdateChildContent(xml,"Mawb|OtherCharges|Description","FC") CkXml::ckUpdateChildContent(xml,"Mawb|OtherCharges|Amount","55.00") CkXml::ckUpdateChildContent(xml,"Mawb|OtherCharges|ChargeIdentifier","A") CkXml::ckUpdateChildContent(xml,"Mawb|OtherCharges|PrepaidCollect","P") CkXml::ckUpdateChildContent(xml,"Mawb|OtherCharges|Description","FC") CkXml::ckUpdateChildContent(xml,"Mawb|OtherCharges|Amount","101.00") CkXml::ckUpdateChildContent(xml,"Mawb|OtherCharges|ChargeIdentifier","C") CkXml::ckUpdateChildContent(xml,"Mawb|OtherCharges|PrepaidCollect","C") CkXml::ckUpdateChildContent(xml,"Mawb|EmailNotifications|Name","") CkXml::ckUpdateChildContent(xml,"Mawb|EmailNotifications|Email","") CkXml::ckUpdateChildContent(xml,"Mawb|EmailNotifications|Name","") CkXml::ckUpdateChildContent(xml,"Mawb|EmailNotifications|Email","") CkXml::ckUpdateChildContent(xml,"Mawb|EmailNotifications|Name","") CkXml::ckUpdateChildContent(xml,"Mawb|EmailNotifications|Email","") CkXml::ckUpdateChildContent(xml,"Mawb|EmailNotifications|Name","") CkXml::ckUpdateChildContent(xml,"Mawb|EmailNotifications|Email","") CkXml::ckUpdateChildContent(xml,"Mawb|Execution|Date","2015-08-07T00:00:00") CkXml::ckUpdateChildContent(xml,"Mawb|Execution|Place","OZ NY") CkXml::ckUpdateChildContent(xml,"Mawb|Execution|ShipperSignature","OAS FREIGHT FORWARDE") CkXml::ckUpdateChildContent(xml,"Mawb|Execution|CarrierSignature","OAS FREIGHT FORWARDE") CkXml::ckUpdateChildContent(xml,"Hawbs|AwbNumber","001-12312123") CkXml::ckUpdateChildContent(xml,"Hawbs|HawbNumber","CGL201107-27") CkXml::ckUpdateChildContent(xml,"Hawbs|HawbStatus","D") CkXml::ckUpdateChildContent(xml,"Hawbs|NumberOfPieces","12") CkXml::ckUpdateChildContent(xml,"Hawbs|GrossWeight|Value","244.70") CkXml::ckUpdateChildContent(xml,"Hawbs|GrossWeight|UOM","K") CkXml::ckUpdateChildContent(xml,"Hawbs|Locations|PortOfOrigin|Code","EWN") CkXml::ckUpdateChildContent(xml,"Hawbs|Locations|PortOfDestination|Code","LON") CkXml::ckUpdateChildContent(xml,"Hawbs|Commodity","HWB #: CGL20110") CkXml::ckUpdateChildContent(xml,"Hawbs|SLAC","12") CkXml::ckUpdateChildContent(xml,"Hawbs|Parties|Shipper|Name","ABC SHIPPNG AGAIN") CkXml::ckUpdateChildContent(xml,"Hawbs|Parties|Shipper|Phone","111-222-3333") CkXml::ckUpdateChildContent(xml,"Hawbs|Parties|Shipper|Fax","") CkXml::ckUpdateChildContent(xml,"Hawbs|Parties|Shipper|Email","") CkXml::ckUpdateChildContent(xml,"Hawbs|Parties|Shipper|Address|Line1","100 MAIN STREET") CkXml::ckUpdateChildContent(xml,"Hawbs|Parties|Shipper|Address|Place","OZ") CkXml::ckUpdateChildContent(xml,"Hawbs|Parties|Shipper|Address|PostalCode","ZIP") CkXml::ckUpdateChildContent(xml,"Hawbs|Parties|Shipper|Address|StateProvince","NY") CkXml::ckUpdateChildContent(xml,"Hawbs|Parties|Shipper|Address|Country|Code","US") CkXml::ckUpdateChildContent(xml,"Hawbs|Parties|Consignee|Name","AABC SHIPPING & PACKAGING, INC.") CkXml::ckUpdateChildContent(xml,"Hawbs|Parties|Consignee|Phone","111-222-3334") CkXml::ckUpdateChildContent(xml,"Hawbs|Parties|Consignee|Fax","222-111-3334") CkXml::ckUpdateChildContent(xml,"Hawbs|Parties|Consignee|Email","") CkXml::ckUpdateChildContent(xml,"Hawbs|Parties|Consignee|Address|Line1","500 HARBOR DRIVE") CkXml::ckUpdateChildContent(xml,"Hawbs|Parties|Consignee|Address|Place","BEAUFORT") CkXml::ckUpdateChildContent(xml,"Hawbs|Parties|Consignee|Address|PostalCode","28516") CkXml::ckUpdateChildContent(xml,"Hawbs|Parties|Consignee|Address|StateProvince","NC") CkXml::ckUpdateChildContent(xml,"Hawbs|Parties|Consignee|Address|Country|Code","US") CkXml::setCkEmitXmlDecl(xml, 0) resp.i = CkHttp::ckPText(http,"POST","http://integration.winwebconnect.com/api/v1/Awb",CkXml::ckGetXml(xml),"utf-8","application/xml",0,0) If CkHttp::ckLastMethodSuccess(http) <> 1 Debug CkHttp::ckLastErrorText(http) CkHttp::ckDispose(http) CkXml::ckDispose(xml) ProcedureReturn EndIf xmlResponse.i = CkXml::ckCreate() If xmlResponse.i = 0 Debug "Failed to create object." ProcedureReturn EndIf CkXml::ckLoadXml(xmlResponse,CkHttpResponse::ckBodyStr(resp)) ; See below for an example XML response body. Debug "Response Body:" Debug CkXml::ckGetXml(xmlResponse) Debug "---" Debug "Response Header:" Debug CkHttpResponse::ckHeader(resp) CkHttpResponse::ckDispose(resp) Debug "Success." CkHttp::ckDispose(http) CkXml::ckDispose(xml) CkXml::ckDispose(xmlResponse) ProcedureReturn EndProcedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.