Sample code for 30+ languages & platforms
AutoIt

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 AutoIt Downloads

AutoIt
Local $bSuccess = False

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

$oHttp = ObjCreate("Chilkat.Http")

; Set the "Accept" header to tell the web server that we'll accept an XML response.
$oHttp.Accept = "application/xml"

; Tell Chilkat to cache any received cookies to files in a particular directory
$oHttp.CookieDir = "c:/qa_data/cookies"
$oHttp.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.
$oHttp.SendCookies = True

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

Local $sHttpRequestBody = $oXml.GetXml()
$oResp = ObjCreate("Chilkat.HttpResponse")
$bSuccess = $oHttp.HttpStr("POST","http://integration.winwebconnect.com/api/v1/Awb",$sHttpRequestBody,"utf-8","application/xml",$oResp)
If ($bSuccess = False) Then
    ConsoleWrite($oHttp.LastErrorText & @CRLF)
    Exit
EndIf

$oXmlResponse = ObjCreate("Chilkat.Xml")
$oXmlResponse.LoadXml($oResp.BodyStr)

; See below for an example XML response body.
ConsoleWrite("Response Body:" & @CRLF)
ConsoleWrite($oXmlResponse.GetXml() & @CRLF)
ConsoleWrite("---" & @CRLF)

ConsoleWrite("Response Header:" & @CRLF)
ConsoleWrite($oResp.Header & @CRLF)
ConsoleWrite("Success." & @CRLF)