Sample Code |
[This is preliminary documentation and is subject to change.]
Sample Code
Click on the links below to download sample applications that implement the Purolator International web services.
The exact process for creating an application to interact with the web service will differ significantly between programming languages, but the process for some languages can be summarized by:
Use a tool to generate a proxy/wrapper/client class from the WSDL file. This class will typically have a set of objects representing web service methods, the associated Request and Response objects, and data objects used to create Requests and Responses.
The Purolator International Web Service WSDL can be found at http://sandbox.purolatorshipping.com/WebServices/ShippingServicesV3.asmx?WSDL .
Typically, this will need to be completed once and only updated if our web service changes, but for some languages/frameworks this may need to be completed once each time the application starts.
Determine which web service method needs to be executed.
Use the proxy class to create the Request object.
Populate the Request object with the relevant data.
Pass the Request object to the proxy class to execute the web service method.
Handle the Response returned from calling the proxy class as appropriate. For example:
If Response.Status is 2 (Error) then fix the problems in the request and resubmit.
See Return Codes for information about each error message.
Closeout any outstanding orders which are being shipped. This typically occurs at the end of a day, but multiple closeouts can occur within one day and a closeout may cover multiple days.
Closing out a collection of orders:
Finalizes them in the OLS database and prevents future modification.
Consolidates rates for all orders with the same order information (including the exact destination address, ship method, and other shipping options).
May create required documentation for customs.
Since sample (working) source code is often the most helpful way to demonstrate using an API (at least to a programmer) we have created a few sample applications: .NET (C#, VB.NET) / Java (TBD)