Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

UPS unknown error


Ekko

Recommended Posts

Hello,

 

I saw few posts about this kind of problem but didn't find any solutions.

I have installed the UPSXML_1.04.1_1 module and i think i got everything set up. However when i tried to get a shipping rate from UPS, it says

Rating and Service 1.0001 0 An unknown error occured while attempting to contact the UPS gateway

 

This is what i have in my log file

 

UPS URL: https://wwwcie.ups.com:443/ups.app/xml/TimeInTransit

UPS REQUEST: <?xml version="1.0"?>

<AccessRequest xml:lang="en-US">

<AccessLicenseNumber>Number</AccessLicenseNumber>

<UserId>userid</UserId>

<Password>password</Password>

</AccessRequest>

<?xml version="1.0"?>

<TimeInTransitRequest xml:lang="en-US">

<Request>

<TransactionReference>

<CustomerContext>Time in Transit</CustomerContext>

<XpciVersion>1.0002</XpciVersion>

</TransactionReference>

<RequestAction>TimeInTransit</RequestAction>

</Request>

<TransitFrom>

<AddressArtifactFormat>

<PoliticalDivision2>Toronto</PoliticalDivision2>

<PoliticalDivision1>ON</PoliticalDivision1>

<CountryCode>CA</CountryCode>

<PostcodePrimaryLow>L3R8V2</PostcodePrimaryLow>

</AddressArtifactFormat>

</TransitFrom>

<TransitTo>

<AddressArtifactFormat>

<PoliticalDivision2>Toronto</PoliticalDivision2>

<PoliticalDivision1>ON</PoliticalDivision1>

<CountryCode>CA</CountryCode>

<PostcodePrimaryLow>M1V3P6</PostcodePrimaryLow>

<PostcodePrimaryHigh>M1V3P6</PostcodePrimaryHigh>

</AddressArtifactFormat>

</TransitTo>

<PickupDate>20041115</PickupDate>

<ShipmentWeight>

<UnitOfMeasurement>

<Code>LBS</Code>

</UnitOfMeasurement>

<Weight>10</Weight>

</ShipmentWeight>

<InvoiceLineTotal>

<CurrencyCode>USD</CurrencyCode>

<MonetaryValue>250.00</MonetaryValue>

</InvoiceLineTotal>

</TimeInTransitRequest>

 

UPS RESPONSE:

------------------------------------------

Time in Transit: This module supports only xpci version 1.0001 of the UPS Rates Interface. Please contact the webmaster for additional assistance.

------------------------------------------

UPS URL: https://wwwcie.ups.com:443/ups.app/xml/Rate

UPS REQUEST: <?xml version="1.0"?>

<AccessRequest xml:lang="en-US">

<AccessLicenseNumber>Number</AccessLicenseNumber>

<UserId>userid</UserId>

<Password>password</Password>

</AccessRequest>

<?xml version="1.0"?>

<RatingServiceSelectionRequest xml:lang="en-US">

<Request>

<TransactionReference>

<CustomerContext>Rating and Service</CustomerContext>

<XpciVersion>1.0001</XpciVersion>

</TransactionReference>

<RequestAction>Rate</RequestAction>

<RequestOption>Rate</RequestOption>

</Request>

<PickupType>

<Code>01</Code>

</PickupType>

<Shipment>

<Shipper>

<Address>

<City>Toronto</City>

<StateProvinceCode>ON</StateProvinceCode>

<CountryCode>CA</CountryCode>

<PostalCode>L3R8V2</PostalCode>

</Address>

</Shipper>

<ShipTo>

<Address>

<City>Toronto</City>

<StateProvinceCode>ON</StateProvinceCode>

<CountryCode>CA</CountryCode>

<PostalCode>M1V3P6</PostalCode>

</Address>

</ShipTo>

<ShipFrom>

<Address>

<City>Toronto</City>

<StateProvinceCode>ON</StateProvinceCode>

<CountryCode>CA</CountryCode>

<PostalCode>L3R8V2</PostalCode>

</Address>

</ShipFrom>

<Package>

<PackagingType>

<Code>02</Code>

</PackagingType>

<PackageWeight>

<UnitOfMeasurement>

<Code>LBS</Code>

</UnitOfMeasurement>

<Weight>4</Weight>

</PackageWeight>

</Package>

</Shipment>

<CustomerClassification>

<Code>04</Code>

</CustomerClassification>

</RatingServiceSelectionRequest>

 

UPS RESPONSE:

 

I have tried with UPS URL: https://wwwcie.ups.com:443/ups.app/xml/Rate for connecting too and it still gives the same error.

btw, what is the diff between Rate and TimeInTransit?

 

I've also changed

"    <RequestOption>shop</RequestOption>\n".

to

"    <RequestOption>Rate</RequestOption>\n".

near line 523 for function _upsGetQuote()

 

My store is at Canada and i really want to get UPS working. I have been working on this for almost a week and it's not getting anywhere. Could someone please help :'(

 

Thanks for your time,

Jen

Link to comment
Share on other sites

I couldn't make it work on two out of four servers eithers. The servers that had no trouble were Apache 1, and the other two Apache 2. I don't know if that is what the cause is.

 

Anyway, I added some lines of code that I found in another thread and it worked. Don't know why, but it did. It is around line 612 and the reference to the topic is in the source code:

   curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlRequest);
  curl_setopt($ch, CURLOPT_TIMEOUT, (int)$timeout);
  // see www.oscommerce.com/forums/index.php?showtopic=49832&st=100
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

  if ($this->logfile) {
//    error_log("UPS REQUEST: " . $xmlRequest . "\n", 3, $this->logfile);
error_log("Error Message: " . curl_error($ch) . "\nUPS RESPONSE: " . $xmlResponse . "\n", 3, $this->logfile);
  }

Hope this helps, but perhaps it is unrelated.

Link to comment
Share on other sites

Hello Jan,

 

Thanks for the help, it got me a bit further.

I modified it however i got another error ><

111100: The requested service is invalid from the selected origin.

 

now in my log file i have

 

(this test customer is from Ontario Canada)

------------------------------------------

shipto : Ontario -> TimeInTransit

UPS URL: https://wwwcie.ups.com:443/ups.app/xml/TimeInTransit

Error Message:

UPS RESPONSE:

UPS RESPONSE:

<?xml version="1.0"?>

<TimeInTransitResponse>

<Response>

<TransactionReference>

<CustomerContext>Time in Transit</CustomerContext>

<XpciVersion>1.0002</XpciVersion>

</TransactionReference>

<ResponseStatusCode>1</ResponseStatusCode>

<ResponseStatusDescription>Success</ResponseStatusDescription>

</Response>

<TransitResponse>

<PickupDate>2004-11-15</PickupDate>

<TransitFrom>

<AddressArtifactFormat>

<PoliticalDivision2>MARKHAM</PoliticalDivision2>

<PoliticalDivision1>ON</PoliticalDivision1>

<Country>CANADA</Country>

<CountryCode>CA</CountryCode>

<PostcodePrimaryLow>L3R8V2</PostcodePrimaryLow>

</AddressArtifactFormat>

</TransitFrom>

<TransitTo>

<AddressArtifactFormat>

<PoliticalDivision2>SCARBOROUGH</PoliticalDivision2>

<PoliticalDivision1>ON</PoliticalDivision1>

<Country>CANADA</Country>

<CountryCode>CA</CountryCode>

<PostcodePrimaryLow>M1V3P6</PostcodePrimaryLow>

</AddressArtifactFormat>

</TransitTo>

<AutoDutyCode>02</AutoDutyCode>

<ShipmentWeight>

<UnitOfMeasurement>

<Code>LBS</Code>

</UnitOfMeasurement

><Weight>10.0</Weight>

</ShipmentWeight>

<InvoiceLineTotal>

<CurrencyCode>USD</CurrencyCode>

<MonetaryValue>250.00</MonetaryValue>

</InvoiceLineTotal>

<Disclaimer>All services are guaranteed if shipment is paid for in full by a payee in Canada. Services listed as guaranteed are backed by a money-back guarantee for transportation charges only. See Terms and Conditions in the Service Guide for details. Certain commodities and high value shipments may require additional transit time for customs clearance.</Disclaimer>

<ServiceSummary>

<Service>

<Code>23</Code>

<Description>UPS Express Plus</Description>

</Service>

<Guaranteed>

<Code>Y</Code>

</Guaranteed>

<EstimatedArrival>

<BusinessTransitDays>1</BusinessTransitDays>

<Time>08:30:00</Time>

<PickupDate>2004-11-15</PickupDate>

<PickupTime>18:30:00</PickupTime>

<HolidayCount>0</HolidayCount>

<DelayCount>0</DelayCount>

<Date>2004-11-16</Date>

<DayOfWeek>TUE</DayOfWeek>

<TotalTransitDays>1</TotalTransitDays>

<CustomerCenterCutoff>17:30:00</CustomerCenterCutoff>

<RestDays>0</RestDays>

</EstimatedArrival>

</ServiceSummary>

<ServiceSummary>

<Service>

<Code>24</Code>

<Description>UPS Express</Description>

</Service>

<Guaranteed>

<Code>Y</Code>

</Guaranteed>

<EstimatedArrival>

<BusinessTransitDays>1</BusinessTransitDays>

<Time>10:30:00</Time>

<PickupDate>2004-11-15</PickupDate>

<PickupTime>18:30:00</PickupTime>

<HolidayCount>0</HolidayCount>

<DelayCount>0</DelayCount>

<Date>2004-11-16</Date>

<DayOfWeek>TUE</DayOfWeek>

<TotalTransitDays>1</TotalTransitDays>

<CustomerCenterCutoff>17:30:00</CustomerCenterCutoff>

<RestDays>0</RestDays>

</EstimatedArrival></ServiceSummary>

<ServiceSummary>

<Service>

<Code>20</Code>

<Description>UPS Express Saver</Description>

.

. (there's a lot more but i took them out)

.

<MaximumListSize>35</MaximumListSize>

</TransitResponse>

</TimeInTransitResponse>

------------------------------------------

Time in Transit: This module supports only xpci version 1.0001 of the UPS Rates Interface. Please contact the webmaster for additional assistance.

------------------------------------------

UPS URL: https://wwwcie.ups.com:443/ups.app/xml/Rate

Error Message:

UPS RESPONSE:

UPS RESPONSE:

<?xml version="1.0"?>

<RatingServiceSelectionResponse>

<Response>

<TransactionReference>

<CustomerContext>Rating and Service</CustomerContext>

<XpciVersion>1.0001</XpciVersion>

</TransactionReference>

<ResponseStatusCode>0</ResponseStatusCode>

<ResponseStatusDescription>Failure</ResponseStatusDescription>

<Error>

<ErrorSeverity>Hard</ErrorSeverity>

<ErrorCode>111100</ErrorCode>

<ErrorDescription>The requested service is invalid from the selected origin.</ErrorDescription>

</Error>

</Response>

</RatingServiceSelectionResponse>

 

Was I supposed to use a different service? (i'm located in Canada)

and for some reason it gave me all other shipping options from UPS which i didn't say i want :blink:

 

Jen

Link to comment
Share on other sites

111100: The requested service is invalid from the selected origin.

It's the time-in-transit API (again?). I bet if you comment out the call to the time-in-transit API you won't see the error. Obviously you are getting rates now. Actually, Stuart Owens (mugitty) knows a lot more about this than I do.

I got errors when the shipping was from the US to abroad, caused by this time-in-transit module. It looks like this time-in-transit module cannot be used from Canada (?).

 

Stuart is the authority in this, but my guess is you should comment out lines 214-218 (approximately):

 /*              $this->timeintransit = $this->_upsgetTime();  
               if ($this->logfile) {
      error_log("------------------------------------------\n", 3, $this->logfile);
      error_log("Time in Transit: " . $this->timeintransit . "\n", 3, $this->logfile);
   } */

to forgo the Time in Transit (at least for the time being...).

Link to comment
Share on other sites

Yeah, i was thinking the same thing about Canada not able to use TimeInTransit, and mugitty did mention it in one of his posts too. But then what should we use if we are at Canada?

i've tried the Rate and it didn't work. >_<

 

Oh, by commenting those lines out, isn't that just preventing the code to write to the log file? :blink:

 

I feel so lost working on this UPS shipping method :'(

 

Jen

Link to comment
Share on other sites

Ekko;

 

Also comment out the 2 entire functions towards the bottom of upsxml.php that start with:

    function _upsGetTime() {

and

    function _transitparseResult($xmlTransitResult) {

In version 1.04.1, this should mean that you would comment out lines 698 through 805. Be certain to leave the last } at the end of this section, before the

  function exclude_choices($type) {

begins, as it is not part of those 2 functions.

 

Doing this and the section that Jan said to comment out will completely eliminate the Time In Transit portion of the file, which I believe only works for US to US shipments (at least in its present form)

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Link to comment
Share on other sites

Oh, by commenting those lines out, isn't that just preventing the code to write to the log file?
As far as I can tell (I'm not too good with OO-code) the line: $this->timeintransit = $this->_upsgetTime(); calls the time-in-transit API. Since if that isn't called, there will be no error logging either I thought it would be safer to comment that out too.

 

My feeling is that the Time-in-Transit API is giving an educated guess how long it will take for a package to arrive, so it is nice-to-know but rates are more important IMO.

 

I now see Stuart gave a much better answer in the mean time so I better stop here. :-"

Link to comment
Share on other sites

Hello Mugitty,

 

Thanks for the help and i took all those lines out from 698 through 805

function _upsGetTime()

to right before

function exclude_choices($type) {

 

I've tested withboth

$this->transitpath = '/ups.app/xml/TimeInTransit';

and

$this->transitpath = '/ups.app/xml/Rate';

leaving

$this->path = '/ups.app/xml/Rate';

the same

(i think it doesn't matter what transitpath is anymore.... right?)

 

the result is, i got the same error.... >_<

Maybe i am too stupid to figure this out lol, i absolutely have no idea what to do now :T

 

Regards,

A person with headache

(Jen)

Link to comment
Share on other sites

Ekko,

 

One way or another if you get that error again the function _upsGetTime was called. If that function was commented out as Stuart advised you would have gotten the error that the function was not there (personally I don't think it should be necessary to comment out the function, the call to it should be sufficient). Anyway, in looking at the code I found a typo in line 678:

 $sheduledTime = $ratedShipments[$i]->getValueByPath("/ScheduledDeliveryTime");

It should be (scheduledTime instead of sheduledTime:

 $scheduledTime = $ratedShipments[$i]->getValueByPath("/ScheduledDeliveryTime");

What I wanted to say is that I think it should be possible (and best IMO) to make the time-in-transit call fail silently if an error code is encountered instead of returning an error message. Too late for me this evening to take a further look into that. Sorry.

Link to comment
Share on other sites

Jan,

 

Yeah i see what you mean and i've commented out all the calls to _GetTime and things that has to do with TimeInTransit, but i am still getting same error.

 

It kepts giving me "service is invalid from the selected origin", maybe i am using the wrong service?

 

I think there might be something that i didn't do but i don't know what, well i'll keep working on it.

 

Thanks for all the help,

 

Jen

Link to comment
Share on other sites

Ekko,

 

Yesterday Stuart Owens uploaded UPSXML version 1.1.1 and Greg MacLellan that same day added a fix for the time-in-transit module. I used Greg's UPSXML file and added the install query and a few more things to the file to get it working (it works fine). I suggest you download the latest version and upload that after a few changes.

 

These are the changes I made:

 

Added to includes/languages/english/modules/shipping/upsxml.php:

 

define('SHIPPING_DAYS_DELAY', 'Shipping Delay');

 

Changed includes/modules/shipping/upsxml.php:

 

MODULE_SHIPPING_UPSXML_RATES_TEXT_COMM_UNKNWON_ERROR around line 600 should be MODULE_SHIPPING_UPSXML_RATES_TEXT_COMM_UNKNOWN_ERROR

 

Added install query for shipping delay, starts around line 292, added SHIPPING_DAYS_DELAY to function keys():

 

        // add key for allowed shipping methods
       tep_db_query("insert into " . TABLE_CONFIGURATION . " ( configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Shipping Methods', 'MODULE_SHIPPING_UPSXML_TYPES', 'Next Day Air, 2nd Day Air, Ground, Worldwide Express, Standard, 3 Day Select', 'Select the UPS services to be offered.', '6', '20', 'tep_cfg_select_multioption(array(\'Next Day Air\', \'2nd Day Air\', \'Ground\', \'Worldwide Express\', \'Worldwide Expedited\', \'Standard\', \'3 Day Select\', \'Next Day Air Saver\', \'Next Day Air Early A.M.\', \'Worldwide Express Plus\', \'2nd Day Air A.M.\', \'Express NA1\', \'Express Saver\'), ',  now())");
       tep_db_query("insert into " . TABLE_CONFIGURATION . " ( configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) values ('', 'Shipping Delay', 'SHIPPING_DAYS_DELAY', '1', 'How many days from when an order is placed to when you ship it (Decimals are allowed). Arrival date estimations are based on this value.', '7', '6', NULL, now(), NULL, NULL)");
   }

   //****************
   function remove() {
       tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
   }

   //*************
   function keys() {
       // add MODULE_SHIPPING_UPSXML_TYPES to end of array for selectable shipping methods
       return array('MODULE_SHIPPING_UPSXML_RATES_STATUS', 'MODULE_SHIPPING_UPSXML_RATES_ACCESS_KEY', 'MODULE_SHIPPING_UPSXML_RATES_USERNAME', 'MODULE_SHIPPING_UPSXML_RATES_PASSWORD', 'MODULE_SHIPPING_UPSXML_RATES_PICKUP_METHOD', 'MODULE_SHIPPING_UPSXML_RATES_PACKAGE_TYPE', 'MODULE_SHIPPING_UPSXML_RATES_CUSTOMER_CLASSIFICATION_CODE', 'MODULE_SHIPPING_UPSXML_RATES_ORIGIN', 'MODULE_SHIPPING_UPSXML_RATES_CITY', 'MODULE_SHIPPING_UPSXML_RATES_STATEPROV', 'MODULE_SHIPPING_UPSXML_RATES_COUNTRY', 'MODULE_SHIPPING_UPSXML_RATES_POSTALCODE', 'MODULE_SHIPPING_UPSXML_RATES_MODE', 'MODULE_SHIPPING_UPSXML_RATES_UNIT_WEIGHT', 'MODULE_SHIPPING_UPSXML_RATES_UNIT_LENGTH', 'MODULE_SHIPPING_UPSXML_RATES_QUOTE_TYPE', 'MODULE_SHIPPING_UPSXML_RATES_HANDLING', 'MODULE_SHIPPING_UPSXML_RATES_TAX_CLASS', 'MODULE_SHIPPING_UPSXML_RATES_ZONE', 'MODULE_SHIPPING_UPSXML_RATES_SORT_ORDER', 'MODULE_SHIPPING_UPSXML_TYPES', 'SHIPPING_DAYS_DELAY');
   }

I also added two lines of code to the CURL "callings" to get it working on the production server around line 595:

        $ch = curl_init();
       curl_setopt($ch, CURLOPT_URL, $url);
       curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
       curl_setopt($ch, CURLOPT_HEADER, 0);
       curl_setopt($ch, CURLOPT_POST, 1);
       curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlRequest);
       curl_setopt($ch, CURLOPT_TIMEOUT, (int)$timeout);
       // see www.oscommerce.com/forums/index.php?showtopic=49832&st=100
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

       if ($this->logfile) {
           error_log("UPS REQUEST: " . $xmlRequest . "\n", 3, $this->logfile);
       }

After uploading the two files to the server I first removed UPSXML from the shipping options and then installed and edited it again. Make a note of your settings of course before doing that. Otherwise you can just use the SQL that Greg included with v2 of the fix (November 15).

 

Hopefully this fixes your error.

Link to comment
Share on other sites

I have tried both versions new and old and all the fixes. No go. I also have libcurl/7.12.0 zlib/1.1.4 installed. I believe that is new enough. Damn!! Nothing works... it used to and then all of a sudden it doesn't.

 

Rating and Service 1.0001 0 MODULE_SHIPPING_UPSXML_RATES_TEXT_COMM_UNKNWON_ERROR : Rating and Service 1.0001 0 MODULE_SHIPPING_UPSXML_RATES_TEXT_COMM_UNKNWON_ERROR

Edited by eTron
Link to comment
Share on other sites

United Parcel Service (XML)

Rating and Service 1.0001 0 An unknown error occured while attempting to contact the UPS gateway : Rating and Service 1.0001 0 An unknown error occured while attempting to contact the UPS gateway

 

Restored to a previous working version. Doesn't work at all now. It used to at least be intermitent. I'm convinved it's something on my server. Upgraded to the latest version of the module. Still nothing.

 

libcurl/7.12.0 zlib/1.1.4

 

apache 2

Link to comment
Share on other sites

I am not sure if this is relevant or not, but does the Rate and Service xml work for Canada?

 

People have got it working for the US but i am not sure if it'll work for Canada. I think TimeInTransit is only for the US when you connect to UPS, i suppose the Rate is for everywhere else?

Link to comment
Share on other sites

WOOT!!!

Finally got the UPSXML working!!!

 

ok, i did a fresh installation for UPSXML, using UPSXML_v1.1.3. i was able to get a connection from UPS with a price too, tho i haven't checked if the price's rigiht or not, i'll be doing more testing.

 

Thank you sooooooooo much JanZ!!!!

 

at least i got UPS response with no error!!

 

(oh and Jan, i took your advice not to install the dimension part :thumbsup: )

 

 

Jenny

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...