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
(SQL Server) WIN Air Freight - Send New Pouch RequestSends a "POST /api/v1/Awb" to send a new pouch request.
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls. -- CREATE PROCEDURE ChilkatSample AS BEGIN DECLARE @hr int DECLARE @iTmp0 int -- Important: Do not use nvarchar(max). See the warning about using nvarchar(max). DECLARE @sTmp0 nvarchar(4000) -- This example assumes the Chilkat HTTP API to have been previously unlocked. -- See Global Unlock Sample for sample code. DECLARE @http int -- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0 EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT IF @hr <> 0 BEGIN PRINT 'Failed to create ActiveX component' RETURN END -- Set the "Accept" header to tell the web server that we'll accept an XML response. EXEC sp_OASetProperty @http, 'Accept', 'application/xml' -- Tell Chilkat to cache any received cookies to files in a particular directory EXEC sp_OASetProperty @http, 'CookieDir', 'c:/qa_data/cookies' EXEC sp_OASetProperty @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. EXEC sp_OASetProperty @http, 'SendCookies', 1 -- Build out XML pouch request... DECLARE @xml int -- Use "Chilkat_9_5_0.Xml" for versions of Chilkat < 10.0.0 EXEC @hr = sp_OACreate 'Chilkat.Xml', @xml OUT EXEC sp_OASetProperty @xml, 'Tag', 'PouchDTO' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|AwbID', '' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|AwbNumber', '001-12312123' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|AwbStatus', 'D' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|eAWB', 'false' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|WithPaper', 'false' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Shipper|WinID', '444444' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Shipper|AccountNumber', '12345' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Shipper|Name', 'AABC SHIPPING & PACKAGING, INC.' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Shipper|Phone', '111-222-3334' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Shipper|Fax', '222-111-3334' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Shipper|Email', '' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Shipper|Address|Line1', '500 HARBOR DRIVE' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Shipper|Address|Line2', 'SUITE B1211' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Shipper|Address|Place', 'BEAUFORT' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Shipper|Address|PostalCode', '28516' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Shipper|Address|StateProvince', 'NC' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Shipper|Address|Country|Code', 'US' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Shipper|Address|Country|Name', 'U.S.A.' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Consignee|WinID', '0' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Consignee|AccountNumber', '' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Consignee|Name', 'DELTA MANUFACTURING' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Consignee|Phone', '444-555-3333' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Consignee|Fax', '' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Consignee|Email', '' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Consignee|Address|Line1', '185 RUE LAMANDE' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Consignee|Address|Line2', '' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Consignee|Address|Place', 'PARIS' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Consignee|Address|PostalCode', '75017' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Consignee|Address|StateProvince', '' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Consignee|Address|Country|Code', 'FR' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Consignee|Address|Country|Name', 'FRANCE' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Notify|WinID', '' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Notify|AccountNumber', '' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Notify|Name', 'AABC SHIPPING, INC.' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Notify|Phone', '' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Notify|Fax', '' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Notify|Email', '' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Notify|Address|Line1', '110 FARA WAY' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Notify|Address|Line2', '' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Notify|Address|Place', 'OZ' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Notify|Address|PostalCode', '11222' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Notify|Address|StateProvince', 'NY' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Notify|Address|Country|Code', 'US' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Notify|Address|Country|Name', 'U.S.A.' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Agent|WinID', '' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Parties|Agent|AccountNumber', 'FACCT#1234' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Accounting|Identifier', 'GEN' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Accounting|Information', 'SARFWER' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Accounting|Identifier', 'MCO' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Accounting|Information', 'WERWERWER' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|ShipmentReference|ReferenceNumber', 'ZDFASF' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|ShipmentReference|AdditionalInformation', 'ZDFASF' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|RoutingDetails|FromAirportCode', 'EWN' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|RoutingDetails|ToAirportCode', 'LON' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|RoutingDetails|CarrierCode', 'AA' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|RoutingDetails|FlightNumber', 'N123' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|RoutingDetails|FlightDate', '2016-11-30T00:00:00' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|ChargesDeclaration|CurrencyCode', 'USD' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|ChargesDeclaration|ChargeCode', 'PP' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|ChargesDeclaration|WeightOrValuation', 'P' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|ChargesDeclaration|Other', 'P' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|ChargesDeclaration|ValuesForCarriage', '1300.00' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|ChargesDeclaration|ValuesForCustoms', '12000.00' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|ChargesDeclaration|ValuesForInsurance', '11000.00' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Handling|SpecialServiceInformation', 'Please Notify Consigneetestwwwww' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Handling|OtherServiceInformation', '' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Handling|SCI', '' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Handling|SpecialHandling|Code', 'AOG' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Handling|SpecialHandling|Code', 'ATT' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Rates|NumberOfPieces', '12' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Rates|GrossWeight|Value', '244.70' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Rates|GrossWeight|UOM', 'L' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Rates|SLAC', '12' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Rates|RateClassCode', 'N' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Rates|CommodityItemNumber', '' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Rates|ChargeableWeight', '245.0' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Rates|RateOrCharge', '8.00' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Rates|ChargeAmount', '1960.00' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Rates|NatureAndQuantityOfGoods', 'CONSOLIDATION PER ATTACHED MANIFEST.' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Rates|Dims|Pcs', '12' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Rates|Dims|Length', '4' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Rates|Dims|Width', '8' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Rates|Dims|Height', '4' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Rates|Dims|UOM', 'CMT' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|ChargesSummary|WeightCharge', '1960.00' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|OtherCharges|Description', 'AW' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|OtherCharges|Amount', '123.00' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|OtherCharges|ChargeIdentifier', 'C' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|OtherCharges|PrepaidCollect', 'C' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|OtherCharges|Description', 'FC' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|OtherCharges|Amount', '55.00' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|OtherCharges|ChargeIdentifier', 'A' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|OtherCharges|PrepaidCollect', 'P' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|OtherCharges|Description', 'FC' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|OtherCharges|Amount', '101.00' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|OtherCharges|ChargeIdentifier', 'C' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|OtherCharges|PrepaidCollect', 'C' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|EmailNotifications|Name', '' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|EmailNotifications|Email', '' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|EmailNotifications|Name', '' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|EmailNotifications|Email', '' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|EmailNotifications|Name', '' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|EmailNotifications|Email', '' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|EmailNotifications|Name', '' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|EmailNotifications|Email', '' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Execution|Date', '2015-08-07T00:00:00' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Execution|Place', 'OZ NY' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Execution|ShipperSignature', 'OAS FREIGHT FORWARDE' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Mawb|Execution|CarrierSignature', 'OAS FREIGHT FORWARDE' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Hawbs|AwbNumber', '001-12312123' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Hawbs|HawbNumber', 'CGL201107-27' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Hawbs|HawbStatus', 'D' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Hawbs|NumberOfPieces', '12' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Hawbs|GrossWeight|Value', '244.70' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Hawbs|GrossWeight|UOM', 'K' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Hawbs|Locations|PortOfOrigin|Code', 'EWN' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Hawbs|Locations|PortOfDestination|Code', 'LON' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Hawbs|Commodity', 'HWB #: CGL20110' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Hawbs|SLAC', '12' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Hawbs|Parties|Shipper|Name', 'ABC SHIPPNG AGAIN' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Hawbs|Parties|Shipper|Phone', '111-222-3333' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Hawbs|Parties|Shipper|Fax', '' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Hawbs|Parties|Shipper|Email', '' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Hawbs|Parties|Shipper|Address|Line1', '100 MAIN STREET' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Hawbs|Parties|Shipper|Address|Place', 'OZ' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Hawbs|Parties|Shipper|Address|PostalCode', 'ZIP' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Hawbs|Parties|Shipper|Address|StateProvince', 'NY' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Hawbs|Parties|Shipper|Address|Country|Code', 'US' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Hawbs|Parties|Consignee|Name', 'AABC SHIPPING & PACKAGING, INC.' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Hawbs|Parties|Consignee|Phone', '111-222-3334' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Hawbs|Parties|Consignee|Fax', '222-111-3334' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Hawbs|Parties|Consignee|Email', '' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Hawbs|Parties|Consignee|Address|Line1', '500 HARBOR DRIVE' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Hawbs|Parties|Consignee|Address|Place', 'BEAUFORT' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Hawbs|Parties|Consignee|Address|PostalCode', '28516' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Hawbs|Parties|Consignee|Address|StateProvince', 'NC' EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'Hawbs|Parties|Consignee|Address|Country|Code', 'US' EXEC sp_OASetProperty @xml, 'EmitXmlDecl', 0 DECLARE @resp int EXEC sp_OAMethod @xml, 'GetXml', @sTmp0 OUT EXEC sp_OAMethod @http, 'PText', @resp OUT, 'POST', 'http://integration.winwebconnect.com/api/v1/Awb', @sTmp0, 'utf-8', 'application/xml', 0, 0 EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT IF @iTmp0 <> 1 BEGIN EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 EXEC @hr = sp_OADestroy @http EXEC @hr = sp_OADestroy @xml RETURN END DECLARE @xmlResponse int -- Use "Chilkat_9_5_0.Xml" for versions of Chilkat < 10.0.0 EXEC @hr = sp_OACreate 'Chilkat.Xml', @xmlResponse OUT DECLARE @success int EXEC sp_OAGetProperty @resp, 'BodyStr', @sTmp0 OUT EXEC sp_OAMethod @xmlResponse, 'LoadXml', @success OUT, @sTmp0 -- See below for an example XML response body. PRINT 'Response Body:' EXEC sp_OAMethod @xmlResponse, 'GetXml', @sTmp0 OUT PRINT @sTmp0 PRINT '---' PRINT 'Response Header:' EXEC sp_OAGetProperty @resp, 'Header', @sTmp0 OUT PRINT @sTmp0 EXEC @hr = sp_OADestroy @resp PRINT 'Success.' EXEC @hr = sp_OADestroy @http EXEC @hr = sp_OADestroy @xml EXEC @hr = sp_OADestroy @xmlResponse END GO |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.