benweatherman/python-ship

Rate Request Namespace

Closed this issue · 1 comments

I'm working on getting the rate() working with UPS, I sent the request that gets generated over to the UPS tech support, they responded saying the namespace was incorrect, I'm not sure how the namespaces get defined/assigned.

Here is the relevant part of the request to rate() :

ns2:Body
ns1:RateRequest
ns1:Request
ns0:RequestOptionShop/ns0:RequestOption
/ns1:Request
ns1:CustomerClassification

The UPS Tech Support responded saying that it should look like this:

ns1:RateRequest
ns0:Request
ns0:RequestOptionShop/ns0:RequestOption
/ns0:Request

With the explaination:
The cause of your error is an invalid namespace association for the /RateRequest/Request container. This is causing the API to ignore any data within the container.

The entire container is considered a Common element rather than specific to the Rating API. As such, the name space assignment should be as follows:

How do we go about getting the Request container to be ns0 instead of ns1?

I did the pull request backwards, editing ups.py here and pull requesting into my fork, should have gone the other way.

This issue was resolved with the following line in ups.py:

recurseElement(element,'ns1:Request','ns0:Request')

The rate() now returns a valid response.