Sample code for 30+ languages & platforms
PowerBuilder

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

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Http
oleobject loo_Xml
string ls_HttpRequestBody
oleobject loo_Resp
oleobject loo_XmlResponse

li_Success = 0

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

loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

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

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

// Build out XML pouch request...
loo_Xml = create oleobject
li_rc = loo_Xml.ConnectToNewObject("Chilkat.Xml")

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

ls_HttpRequestBody = loo_Xml.GetXml()
loo_Resp = create oleobject
li_rc = loo_Resp.ConnectToNewObject("Chilkat.HttpResponse")

li_Success = loo_Http.HttpStr("POST","http://integration.winwebconnect.com/api/v1/Awb",ls_HttpRequestBody,"utf-8","application/xml",loo_Resp)
if li_Success = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_Xml
    destroy loo_Resp
    return
end if

loo_XmlResponse = create oleobject
li_rc = loo_XmlResponse.ConnectToNewObject("Chilkat.Xml")

loo_XmlResponse.LoadXml(loo_Resp.BodyStr)

// See below for an example XML response body.
Write-Debug "Response Body:"
Write-Debug loo_XmlResponse.GetXml()
Write-Debug "---"

Write-Debug "Response Header:"
Write-Debug loo_Resp.Header
Write-Debug "Success."


destroy loo_Http
destroy loo_Xml
destroy loo_Resp
destroy loo_XmlResponse