Returns

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

Retrieve Next Open Return Artifact – SOAP

Summary

Name: Retrieve Next Open Return Artifact
Reason to Call: Used to retrieve the next available artifact (label) associated with an open return template.
Input: Template ID
Output: PDF or ZPL II document
Typical Next Call: Repeat this call to retrieve another label.
Version history: Release notes
Retrieve Next Open Return Artifact – Summary of Service

Retrieve Next Open Return Artifact – 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: RetrieveNextOpenReturnArtifact

SOAP Body

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

Retrieve Next Open Return Artifact – Request Elements
Element Name Type Required / Optional Description

retrieve-next-open-return-artifact-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

Retrieve Next Open Return Artifact – Structure of the XML Request

Retrieve Next Open Return Artifact – Structure of the XML Request

Response Details

Response – Elements

The following table describes the XML elements in the response to Retrieve Next Open Return Artifact. For the hierarchy of the response, see the XML diagram.

Retrieve Next Open Return Artifact – Response Elements
Element Name Type Description

retrieve-next-open-return-artifact-response

complex

The top level XML structure of the response.

It will either contain the results of a successful completion or the error message structure.

artifact-data

complex

The XML structure containing the results of a successful completion of the service.

image

simple

The image of the label. The data provided is a Base64 encoding of the actual image. For pdfs the encoded file contains binary data.

mime-type

simple

Represents the mime-type of the image file (after Base64 decoding). Will have the value: image/pdf or image/zpl

Response – XML Diagram

Retrieve Next Open Return Artifact – Structure of the XML Response

Retrieve Next Open Return Artifact – 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 Status Code Application Error Message
500 N/A Schema validation error

Examples

Sample SOAP XML Request – Retrieve Next Open Return Artifact

<retrieve-next-open-return-artifact-request>
<mailed-by>1111111</mailed-by>
<locale>EN</locale>
<template-id>349641323786705649</template-id>
</retrieve-next-open-return-artifact-request>

Sample SOAP XML Response – Retrieve Next Open Return Artifact

<retrieve-next-open-return-artifact-response>
<artifact-data>
<image>JVBERi0x(Etc... base 64 encoded PDF)</image>
<mime-type>application/pdf</mime-type>
</artifact-data>
</retrieve-next-open-return-artifact-response>