Visual FoxPro
Visual FoxPro
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 Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loHttp
LOCAL loXml
LOCAL lcHttpRequestBody
LOCAL loResp
LOCAL loXmlResponse
lnSuccess = 0
* This example assumes the Chilkat HTTP API to have been previously unlocked.
* See Global Unlock Sample for sample code.
loHttp = CreateObject('Chilkat.Http')
* Set the "Accept" header to tell the web server that we'll accept an XML response.
loHttp.Accept = "application/xml"
* Tell Chilkat to cache any received cookies to files in a particular directory
loHttp.CookieDir = "c:/qa_data/cookies"
loHttp.SaveCookies = 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.
loHttp.SendCookies = 1
* Build out XML pouch request...
loXml = CreateObject('Chilkat.Xml')
loXml.Tag = "PouchDTO"
loXml.UpdateChildContent("Mawb|AwbID","")
loXml.UpdateChildContent("Mawb|AwbNumber","001-12312123")
loXml.UpdateChildContent("Mawb|AwbStatus","D")
loXml.UpdateChildContent("Mawb|eAWB","false")
loXml.UpdateChildContent("Mawb|WithPaper","false")
loXml.UpdateChildContent("Mawb|Parties|Shipper|WinID","444444")
loXml.UpdateChildContent("Mawb|Parties|Shipper|AccountNumber","12345")
loXml.UpdateChildContent("Mawb|Parties|Shipper|Name","AABC SHIPPING & PACKAGING, INC.")
loXml.UpdateChildContent("Mawb|Parties|Shipper|Phone","111-222-3334")
loXml.UpdateChildContent("Mawb|Parties|Shipper|Fax","222-111-3334")
loXml.UpdateChildContent("Mawb|Parties|Shipper|Email","")
loXml.UpdateChildContent("Mawb|Parties|Shipper|Address|Line1","500 HARBOR DRIVE")
loXml.UpdateChildContent("Mawb|Parties|Shipper|Address|Line2","SUITE B1211")
loXml.UpdateChildContent("Mawb|Parties|Shipper|Address|Place","BEAUFORT")
loXml.UpdateChildContent("Mawb|Parties|Shipper|Address|PostalCode","28516")
loXml.UpdateChildContent("Mawb|Parties|Shipper|Address|StateProvince","NC")
loXml.UpdateChildContent("Mawb|Parties|Shipper|Address|Country|Code","US")
loXml.UpdateChildContent("Mawb|Parties|Shipper|Address|Country|Name","U.S.A.")
loXml.UpdateChildContent("Mawb|Parties|Consignee|WinID","0")
loXml.UpdateChildContent("Mawb|Parties|Consignee|AccountNumber","")
loXml.UpdateChildContent("Mawb|Parties|Consignee|Name","DELTA MANUFACTURING")
loXml.UpdateChildContent("Mawb|Parties|Consignee|Phone","444-555-3333")
loXml.UpdateChildContent("Mawb|Parties|Consignee|Fax","")
loXml.UpdateChildContent("Mawb|Parties|Consignee|Email","")
loXml.UpdateChildContent("Mawb|Parties|Consignee|Address|Line1","185 RUE LAMANDE")
loXml.UpdateChildContent("Mawb|Parties|Consignee|Address|Line2","")
loXml.UpdateChildContent("Mawb|Parties|Consignee|Address|Place","PARIS")
loXml.UpdateChildContent("Mawb|Parties|Consignee|Address|PostalCode","75017")
loXml.UpdateChildContent("Mawb|Parties|Consignee|Address|StateProvince","")
loXml.UpdateChildContent("Mawb|Parties|Consignee|Address|Country|Code","FR")
loXml.UpdateChildContent("Mawb|Parties|Consignee|Address|Country|Name","FRANCE")
loXml.UpdateChildContent("Mawb|Parties|Notify|WinID","")
loXml.UpdateChildContent("Mawb|Parties|Notify|AccountNumber","")
loXml.UpdateChildContent("Mawb|Parties|Notify|Name","AABC SHIPPING, INC.")
loXml.UpdateChildContent("Mawb|Parties|Notify|Phone","")
loXml.UpdateChildContent("Mawb|Parties|Notify|Fax","")
loXml.UpdateChildContent("Mawb|Parties|Notify|Email","")
loXml.UpdateChildContent("Mawb|Parties|Notify|Address|Line1","110 FARA WAY")
loXml.UpdateChildContent("Mawb|Parties|Notify|Address|Line2","")
loXml.UpdateChildContent("Mawb|Parties|Notify|Address|Place","OZ")
loXml.UpdateChildContent("Mawb|Parties|Notify|Address|PostalCode","11222")
loXml.UpdateChildContent("Mawb|Parties|Notify|Address|StateProvince","NY")
loXml.UpdateChildContent("Mawb|Parties|Notify|Address|Country|Code","US")
loXml.UpdateChildContent("Mawb|Parties|Notify|Address|Country|Name","U.S.A.")
loXml.UpdateChildContent("Mawb|Parties|Agent|WinID","")
loXml.UpdateChildContent("Mawb|Parties|Agent|AccountNumber","FACCT#1234")
loXml.UpdateChildContent("Mawb|Accounting|Identifier","GEN")
loXml.UpdateChildContent("Mawb|Accounting|Information","SARFWER")
loXml.UpdateChildContent("Mawb|Accounting|Identifier","MCO")
loXml.UpdateChildContent("Mawb|Accounting|Information","WERWERWER")
loXml.UpdateChildContent("Mawb|ShipmentReference|ReferenceNumber","ZDFASF")
loXml.UpdateChildContent("Mawb|ShipmentReference|AdditionalInformation","ZDFASF")
loXml.UpdateChildContent("Mawb|RoutingDetails|FromAirportCode","EWN")
loXml.UpdateChildContent("Mawb|RoutingDetails|ToAirportCode","LON")
loXml.UpdateChildContent("Mawb|RoutingDetails|CarrierCode","AA")
loXml.UpdateChildContent("Mawb|RoutingDetails|FlightNumber","N123")
loXml.UpdateChildContent("Mawb|RoutingDetails|FlightDate","2016-11-30T00:00:00")
loXml.UpdateChildContent("Mawb|ChargesDeclaration|CurrencyCode","USD")
loXml.UpdateChildContent("Mawb|ChargesDeclaration|ChargeCode","PP")
loXml.UpdateChildContent("Mawb|ChargesDeclaration|WeightOrValuation","P")
loXml.UpdateChildContent("Mawb|ChargesDeclaration|Other","P")
loXml.UpdateChildContent("Mawb|ChargesDeclaration|ValuesForCarriage","1300.00")
loXml.UpdateChildContent("Mawb|ChargesDeclaration|ValuesForCustoms","12000.00")
loXml.UpdateChildContent("Mawb|ChargesDeclaration|ValuesForInsurance","11000.00")
loXml.UpdateChildContent("Mawb|Handling|SpecialServiceInformation","Please Notify Consigneetestwwwww")
loXml.UpdateChildContent("Mawb|Handling|OtherServiceInformation","")
loXml.UpdateChildContent("Mawb|Handling|SCI","")
loXml.UpdateChildContent("Mawb|Handling|SpecialHandling|Code","AOG")
loXml.UpdateChildContent("Mawb|Handling|SpecialHandling|Code","ATT")
loXml.UpdateChildContent("Mawb|Rates|NumberOfPieces","12")
loXml.UpdateChildContent("Mawb|Rates|GrossWeight|Value","244.70")
loXml.UpdateChildContent("Mawb|Rates|GrossWeight|UOM","L")
loXml.UpdateChildContent("Mawb|Rates|SLAC","12")
loXml.UpdateChildContent("Mawb|Rates|RateClassCode","N")
loXml.UpdateChildContent("Mawb|Rates|CommodityItemNumber","")
loXml.UpdateChildContent("Mawb|Rates|ChargeableWeight","245.0")
loXml.UpdateChildContent("Mawb|Rates|RateOrCharge","8.00")
loXml.UpdateChildContent("Mawb|Rates|ChargeAmount","1960.00")
loXml.UpdateChildContent("Mawb|Rates|NatureAndQuantityOfGoods","CONSOLIDATION PER ATTACHED MANIFEST.")
loXml.UpdateChildContent("Mawb|Rates|Dims|Pcs","12")
loXml.UpdateChildContent("Mawb|Rates|Dims|Length","4")
loXml.UpdateChildContent("Mawb|Rates|Dims|Width","8")
loXml.UpdateChildContent("Mawb|Rates|Dims|Height","4")
loXml.UpdateChildContent("Mawb|Rates|Dims|UOM","CMT")
loXml.UpdateChildContent("Mawb|ChargesSummary|WeightCharge","1960.00")
loXml.UpdateChildContent("Mawb|OtherCharges|Description","AW")
loXml.UpdateChildContent("Mawb|OtherCharges|Amount","123.00")
loXml.UpdateChildContent("Mawb|OtherCharges|ChargeIdentifier","C")
loXml.UpdateChildContent("Mawb|OtherCharges|PrepaidCollect","C")
loXml.UpdateChildContent("Mawb|OtherCharges|Description","FC")
loXml.UpdateChildContent("Mawb|OtherCharges|Amount","55.00")
loXml.UpdateChildContent("Mawb|OtherCharges|ChargeIdentifier","A")
loXml.UpdateChildContent("Mawb|OtherCharges|PrepaidCollect","P")
loXml.UpdateChildContent("Mawb|OtherCharges|Description","FC")
loXml.UpdateChildContent("Mawb|OtherCharges|Amount","101.00")
loXml.UpdateChildContent("Mawb|OtherCharges|ChargeIdentifier","C")
loXml.UpdateChildContent("Mawb|OtherCharges|PrepaidCollect","C")
loXml.UpdateChildContent("Mawb|EmailNotifications|Name","")
loXml.UpdateChildContent("Mawb|EmailNotifications|Email","")
loXml.UpdateChildContent("Mawb|EmailNotifications|Name","")
loXml.UpdateChildContent("Mawb|EmailNotifications|Email","")
loXml.UpdateChildContent("Mawb|EmailNotifications|Name","")
loXml.UpdateChildContent("Mawb|EmailNotifications|Email","")
loXml.UpdateChildContent("Mawb|EmailNotifications|Name","")
loXml.UpdateChildContent("Mawb|EmailNotifications|Email","")
loXml.UpdateChildContent("Mawb|Execution|Date","2015-08-07T00:00:00")
loXml.UpdateChildContent("Mawb|Execution|Place","OZ NY")
loXml.UpdateChildContent("Mawb|Execution|ShipperSignature","OAS FREIGHT FORWARDE")
loXml.UpdateChildContent("Mawb|Execution|CarrierSignature","OAS FREIGHT FORWARDE")
loXml.UpdateChildContent("Hawbs|AwbNumber","001-12312123")
loXml.UpdateChildContent("Hawbs|HawbNumber","CGL201107-27")
loXml.UpdateChildContent("Hawbs|HawbStatus","D")
loXml.UpdateChildContent("Hawbs|NumberOfPieces","12")
loXml.UpdateChildContent("Hawbs|GrossWeight|Value","244.70")
loXml.UpdateChildContent("Hawbs|GrossWeight|UOM","K")
loXml.UpdateChildContent("Hawbs|Locations|PortOfOrigin|Code","EWN")
loXml.UpdateChildContent("Hawbs|Locations|PortOfDestination|Code","LON")
loXml.UpdateChildContent("Hawbs|Commodity","HWB #: CGL20110")
loXml.UpdateChildContent("Hawbs|SLAC","12")
loXml.UpdateChildContent("Hawbs|Parties|Shipper|Name","ABC SHIPPNG AGAIN")
loXml.UpdateChildContent("Hawbs|Parties|Shipper|Phone","111-222-3333")
loXml.UpdateChildContent("Hawbs|Parties|Shipper|Fax","")
loXml.UpdateChildContent("Hawbs|Parties|Shipper|Email","")
loXml.UpdateChildContent("Hawbs|Parties|Shipper|Address|Line1","100 MAIN STREET")
loXml.UpdateChildContent("Hawbs|Parties|Shipper|Address|Place","OZ")
loXml.UpdateChildContent("Hawbs|Parties|Shipper|Address|PostalCode","ZIP")
loXml.UpdateChildContent("Hawbs|Parties|Shipper|Address|StateProvince","NY")
loXml.UpdateChildContent("Hawbs|Parties|Shipper|Address|Country|Code","US")
loXml.UpdateChildContent("Hawbs|Parties|Consignee|Name","AABC SHIPPING & PACKAGING, INC.")
loXml.UpdateChildContent("Hawbs|Parties|Consignee|Phone","111-222-3334")
loXml.UpdateChildContent("Hawbs|Parties|Consignee|Fax","222-111-3334")
loXml.UpdateChildContent("Hawbs|Parties|Consignee|Email","")
loXml.UpdateChildContent("Hawbs|Parties|Consignee|Address|Line1","500 HARBOR DRIVE")
loXml.UpdateChildContent("Hawbs|Parties|Consignee|Address|Place","BEAUFORT")
loXml.UpdateChildContent("Hawbs|Parties|Consignee|Address|PostalCode","28516")
loXml.UpdateChildContent("Hawbs|Parties|Consignee|Address|StateProvince","NC")
loXml.UpdateChildContent("Hawbs|Parties|Consignee|Address|Country|Code","US")
loXml.EmitXmlDecl = 0
lcHttpRequestBody = loXml.GetXml()
loResp = CreateObject('Chilkat.HttpResponse')
lnSuccess = loHttp.HttpStr("POST","http://integration.winwebconnect.com/api/v1/Awb",lcHttpRequestBody,"utf-8","application/xml",loResp)
IF (lnSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loXml
RELEASE loResp
CANCEL
ENDIF
loXmlResponse = CreateObject('Chilkat.Xml')
loXmlResponse.LoadXml(loResp.BodyStr)
* See below for an example XML response body.
? "Response Body:"
? loXmlResponse.GetXml()
? "---"
? "Response Header:"
? loResp.Header
? "Success."
RELEASE loHttp
RELEASE loXml
RELEASE loResp
RELEASE loXmlResponse