Contract Shipping

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

Void Shipment – SOAP

Summary

Name: Void Shipment
Reason to Call:

To delete a specific shipment prior to transmit. Making this call indicates that the previously printed label is spoiled or will otherwise not be used.

Note: As an alternative to voiding a shipment, you can exclude it from a transmit request so it remains active for inclusion in a subsequent transmit request.
Input: Shipment-id; mailed-by; and locale (optional).
Output: None (an empty top-level element)
Error Example: Invalid / Expired shipment-id
Version history: Release notes
Void Shipment – Summary of Service

Void Shipment – Summary of Service

Call Details

WSDL: shipment.wsdl
Endpoint (Development): https://ct.soa-gw.canadapost.ca/rs/soap/shipment/v8
Endpoint (Production): https://soa-gw.canadapost.ca/rs/soap/shipment/v8
Namespace: http://www.canadapost.ca/ws/soap/shipment/v8
Operation: VoidShipment

SOAP Body

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

Void Shipment – Request Elements
Element Name Type Required / Optional Description

void-shipment-request

complex

required

The overall XML structure for the request input information.

mailed-by

simple

required

(1-10 digit numeric)

The 10-digit customer number of the mailed-by customer.

If the number provided has fewer than 10 digits, the system will add leading zeros.

mobo

simple

optional

(1-10 digit numeric)

The 10-digit customer number of the mailed-on-behalf-of customer.

If this element is missing, it will default to the mailed-by customer number.

If the number provided has fewer than 10 digits, the system will add leading zeros.

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.

shipment-id

simple

required

(Alphanumeric String – up to 32 letters/digits)

An identification number representing the existing shipment for which information is being requested.

Note: Retrieve the shipment-id provided by previous calls to Create Shipment or Get Shipment. The output of those services will include a shipment-id element.

Request – XML Diagram

Void Shipment – Structure of the XML Request

Void Shipment – Structure of the XML Request

Response Details

Response – Elements

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

Void Shipment – Response Elements
Element Name Type Description

void-shipment-response

Complex

The top level of the XML structure.

void-shipment-success

Simple

True | False

A simple flag to indicate success of the void shipment.

Response – XML Diagram

Void Shipment – Structure of the XML Response

Void Shipment – Structure of the XML Response

Response – Possible Error Responses

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.

Possible error messages for this service include the following.

HTTP Code Code Message Meaning

200

404

Not Found

The resource was not found. This means the shipment-id is incorrect, the shipment has already been voided or the shipment has already been transmitted.

500

Server

/rs/soap/shipment: cvc-simple-type 1: element shipment-id of type

{http://www.canadapost.ca/ws/soap/shipment/v8}ShipmentIDType may not be empty

SOAP fault—no shipment id was specified.

8064

A shipment can only be void if it is in a PROCESSED or PRINTED state.

The shipment has already been transmitted. A refund must be requested.

Examples

Sample SOAP XML Request – Void Shipment

<void-shipment-request>
<mailed-by>1111111</mailed-by>
<locale>EN</locale>
<shipment-id>340531309186521749</shipment-id>
</void-shipment-request>

Sample SOAP XML Response – Void Shipment

<void-shipment-response>
<void-shipment-success>true</void-shipment-success>
</void-shipment-response>