Returns

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

Get Open Return Template Details – SOAP

Summary

Name: Get Open Return Template Details
Reason to Call:

To retrieve an XML representation of all of the initial information related to an existing open return template. This includes the final return destination address details.

This service would not typically be called during normal operations as it is not required to retrieve or print labels. It is provided for situations such as a recovery from a communications or other error.

Input: template-id
Output:

The details that were input at the time that the open return template was created, including:

  • address details of the final receiver
  • print preferences
  • settlement info
Version history: Release notes
Get Open Return Template Details – Summary of Service

Get Open Return Template Details – Summary of Service

Call Details

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

SOAP Body

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

Get Open Return Template Details – Request Elements
Element Name Type Required / Optional Description

get-open-return-template-details-request

complex

required

The top level element for the request.

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.

template-id

simple

required

The identifier of the previously created template for which the artifact is being retrieved.

Request – XML Diagram

Get Open Return Template Details – Structure of the XML Request

Get Open Return Template Details – Structure of the XML Request

Response Details

Response – Elements

The following table describes the XML elements in the response to Get Open Return Template Details. For the hierarchy of the response, see the XML diagram.

Get Open Return Template Details – Response Elements
Element Name Type Description

get-open-return-template-details-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.

template-details

complex

This structure contains the details that were used to create the template.

max-number-of-artifacts

simple

Indicates the maximum number of artifacts (return labels) you can generate and retrieve using this template. Must be numeric in the range of 1 - 100,000.

artifacts-remaining

simple

Indicates the current remaining number of artifacts (return labels) allowed to be generated and retrieved using this template.

service-code

simple

The returns service is appropriate for domestic returns only.

Service-Code Description
DOM.RP Regular Parcel
DOM.EP Expedited Parcel
DOM.XP Xpresspost
DOM.PC Priority

receiver

complex

This structure contains data about the final destination. This data appears in the “To” address of the return label. Blank fields will have been removed during address formatting.

name

simple

The name of the receiver

company

simple

The company of the receiver

domestic-address

complex

This structure contains the address data about the final receiver of the return shipment.

Blank fields will have been removed for formatting of the labels.

address-line-1

simple

Address line 1 of the receiver.

address-line-2

simple

Address line 2 of the receiver.

city

simple

City of receiver.

prov

simple

Province of the receiver.

postal-code

simple

Postal Code of the receiver

print-preferences

complex

This structure contains print preferences for the labels, such as output format.

output-format

simple

Valid values are:
- 8.5x11
- 4x6

encoding

simple

{PDF}

show-packing-instructions

simple

{true, false}

This element indicates whether packing instructions are to be included on the rendering of the label.

settlement-info

complex

This structure contains the elements that indicate how the delivery will be settled (paid for).

contract-id

simple

Required to use the Open Returns service. Only Canada Post commercial customers with a volume-based agreement can use the service.

Response – XML Diagram

Get Open Return Template Details – Structure of the XML Response
Get Open Return Template Details – 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.

Examples

Sample SOAP MXL Request – Get Open Return Template Details

<get-open-return-template-details-request>
<mailed-by>1111111</mailed-by>
<locale>EN</locale>
<template-id>349641323786705649</template-id>
</get-open-return-template-details-request>

Sample SOAP XML Response – Get Open Return Template Details

<get-open-return-template-details-response>
<open-return-details>
<artifacts-remaining>10</artifacts-remaining>
<open-return>
<max-number-of-artifacts>10</max-number-of-artifacts>
<service-code>DOM.EP</service-code>
<receiver>
<domestic-address>
<address-line-1>2701 Return Drive</address-line-1>
<city>Ottawa</city>
<province>ON</province>
<postal-code>K1A0B1</postal-code>
</domestic-address>
</receiver>
<print-preferences>
<output-format>8.5x11</output-format>
<encoding>PDF</encoding>
<show-packing-instructions>false</show-packing-instructions>
</print-preferences>
<settlement-info>
<contract-id>0012345678</contract-id>
</settlement-info>
</open-return>
</open-return-details>
</get-open-return-template-details-response>