Thank you for your question.
The "401 Unauthorized" error can be caused by the following issues:
Wrong development / production key or wrong development / production password. Please double check that the credentials you are providing are the ones given by Purolator when you applied for the keys. If five consecutive requests are sent to the server with a wrong password, the key automatically gets locked. You will either have to apply for another key or contact Purolator to unlock your key. (Note there are special characters that are part of the passwords like ":", "$" etc, you might need to use single cotes or the escape character)
Pointing to the wrong server.
If you are using the example codes on the Resource Center in your development stage, these are pointing to the production server. In order to fix this, you just need to add "DEV" (development) as a prefix for the location URL:
For example in PHP: 'location' => "https://devwebservices.purolator.com/PWS/V1/ShippingDocuments/ShippingDocumentsService.asmx" (in this case for Shipping Documents Service)
To point to the Production server use: 'location' => "https://webservices.purolator.com/PWS/V1/ShippingDocuments/ShippingDocumentsService.asmx" (in this case for Shipping Documents Service)
Feel free to post any Purolator specific questions (web services) on our Technical Support Forum for a prompt response: http://purolatorwebservices.com
Thank you,
Purolator E-Ship Web Services Team
webservices@purolator.com