Rating

Code Samples for Rating: Java (.zip) | PHP (.zip) | C# (.zip)

Discover Services – SOAP

Summary

Name: Discover Services
Reason to Call: To discover the list of postal services that can be used for a given destination country, customer, contract, origin and/or destination postal code.
Input: Destination Country
Output: Option descriptions, prerequisites and conflicts
Version history: Release notes

Call Details

WSDL: rating.wsdl
Endpoint (Development): https://ct.soa-gw.canadapost.ca/rs/soap/rating/v4
Endpoint (Production): https://soa-gw.canadapost.ca/rs/soap/rating/v4
Namespace: http://www.canadapost.ca/ws/soap/ship/rate/v4
Operation: DiscoverServices

SOAP Body

This section describes the XML input elements to this service. For the hierarchical structure, see the XML diagram.

Discover Services – Request Elements
Element Name Type Required / Optional Description

discover-services-request

complex

required

The top level XML element for the request input information.

locale

simple

optional

Indicates your language preference for receiving error messages.
EN = English
FR = French
If no value is provided, the default language is English.

destination-country-code

simple

optional

The 2-character country code representing the destination country for which available services are requested.

customer-number simple optional

(1-10 digit numeric)
The 10-digit number of the customer making the request. If the number provided has fewer than 10 digits, the system will add leading zeroes.

If provided in the request, the response will include all services accessible by the customer without a contract.
contract-id simple optional

(1-10-digit numeric)
The 10-digit contract number. If the number provided has fewer than 10 digits, the system will add leading zeroes.

If the contract-id is provided, the response will also include restricted services accessible with that contract

Request – XML Diagram

Discover Services – Structure of the XML Request

Discover Services – Structure of the XML Request

Response Details

Response – Elements

The following table describes the XML elements in the response to Discover Services. For the hierarchy of the response, see the
XML diagram.

Discover Services – Response Elements
Element Name Type Description

discover-services-response

complex

The top level XML element for the response.
It will either contain the results of a successful completion or the error message structure.

services

complex

Contains the list of shipping services that can be used for the specified parameters.

service

complex

Contains information about a single Canada Post shipping service.

service-code

simple

The code used to request the service.

service-name

simple

The full name of the shipping service in the language you requested.

Response – XML Diagram

Discover Services – Structure of the XML Response

Discover Services – Structure of the XML Response

Response – Possible Error Responses

Code Description

2550

The contract number is not valid.

7266 Postal Code must be in format A9A or A9A9A9.
8534 A valid destination country must be supplied.
9194 origin-postal-code must also be provided when destination-postal-code is provided.

The response to error conditions for this web service follows the standard SOAP error response approach used for all Canada Post web services. For more information, see SOAP Fundamentals of Canada Post Web Services.

Examples

Sample SOAP XML Request – Discover Services

<discover-services-request>
<locale>EN</locale>
<destination-country-code>GB</destination-country-code>
</discover-services-request>

Sample SOAP XML Response – Discover Services

<discover-services-response>
<services>
<service>
<service-code>INT.XP</service-code>
<service-name>Xpresspost International</service-name>
</service>
<service>
<service-code>INT.SP.SURF</service-code>
<service-name>Small Packet International Surface</service-name>
</service>
<service>
<service-code>INT.SP.AIR</service-code>
<service-name>Small Packet International Air</service-name>
</service>
</services>
</discover-services-response>