Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 2 of 2
Fix for UPS XML “Unavailable” Error
 
Pukos
Sr. Member
 
Avatar
Total Posts:  108
Joined:  2008-02-15
 

I just modified the file ups.php

This is the request (Code, user, pass, are partilally hidden) :

<?xml version="1.0"?>
<AccessRequest xml:lang="en-US">
  <
AccessLicenseNumber>4C2XXXXXXXXXX40A</AccessLicenseNumber>
  <
UserId>inXXX@XXX.it</UserId>
  <
Password>XXXXXXX</Password>
</
AccessRequest><?xml version="1.0"?>
<RatingServiceSelectionRequest xml:lang="en-US">
  <
Request>
    <
TransactionReference>

      <
CustomerContext>Rating and Service</CustomerContext>
      <
XpciVersion>1.0</XpciVersion>
    </
TransactionReference>
    <
RequestAction>Rate</RequestAction>
    <
RequestOption>Shop</RequestOption>
  </
Request>
  <
Service>

      <
Code></Code>
      <
Description></Description>
  </
Service>
  <
PickupType>
          <
Code>01</Code>
          <
Description>Regular Daily Pickup</Description>
  </
PickupType>

  <
Shipment>

      <
Shipper>
      <
ShipperNumber>6RR769</ShipperNumber>
      <
Address>
          <
City>Cantù (CO)</City>
          <
PostalCode>22063</PostalCode>
          <
CountryCode>IT</CountryCode>

      </
Address>
    </
Shipper>

    <
ShipTo>
      <
Address>
          <
PostalCode>00144</PostalCode>
          <
CountryCode>IT</CountryCode>
          <
ResidentialAddress>02</ResidentialAddress>      </Address>

    </
ShipTo>


    <
ShipFrom>
      <
Address>
          <
PostalCode>22063</PostalCode>
          <
CountryCode>IT</CountryCode>
      </
Address>
    </
ShipFrom>

    <
Package>
      <
PackagingType><Code>00</Code></PackagingType>
      <
PackageWeight>
         <
UnitOfMeasurement><Code>KGS</Code></UnitOfMeasurement>
        <
Weight>0.15</Weight>
      </
PackageWeight>
    </
Package>

    <
RateInformation>
        <
NegotiatedRatesIndicator/>
    </
RateInformation>

  </
Shipment>
</
RatingServiceSelectionRequest>
 
Magento Community Magento Community
Magento Community
Magento Community
 
Pukos
Sr. Member
 
Avatar
Total Posts:  108
Joined:  2008-02-15
 

And this is the response.

I had to attach it beacuse it is too big

Tnx!!

File Attachments
ups_response.xml  (File Size: 7KB - Downloads: 357)
 
Magento Community Magento Community
Magento Community
Magento Community
 
bw2008
Member
 
Total Posts:  39
Joined:  2008-06-21
 

Hi Pukos,

Thanks for the fix. May I know how exactly do you integrate your UPS XML fix with the Ups.php file?

I’ve been looking all over for a UPS XML fix.

Does this allow negotiated UPS rates?

Does this fix the currency conversion rate issue as well?

 
Magento Community Magento Community
Magento Community
Magento Community
 
leetaylordoes
Sr. Member
 
Total Posts:  227
Joined:  2008-02-05
San Diego, CA
 

Hi @Pukos and all desiring to have UPS Negotiated Rates enabled via their Magento store,

I’ve referenced your file/code and notice that there are still quite a few more modifications that are necessary in order to obtain UPS negotiated Rates. It would take us some talking back and forth in order to address the necessary corrections that still need changing.

We are about to finish up a community extension that will be available via the Magento Connect Manager (though possibly for a small fee). It is an alternative UPS shipping module that will allow Negotiated Rates (for accounts that have negotiated rates enabled.)

It may be in your best interest to wait a few more days on this until we come out with the new extension.

Thanks,
Lee Taylor

 
Magento Community Magento Community
Magento Community
Magento Community
 
bw2008
Member
 
Total Posts:  39
Joined:  2008-06-21
 

Does this mean that Varien is not going to fix the broken UPS shipping module and include negotiated rates anytime soon?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Danimaltron
Jr. Member
 
Avatar
Total Posts:  9
Joined:  2008-01-29
 

Wow thanks so much! this worked for me.

 
Magento Community Magento Community
Magento Community
Magento Community
 
jaggsr
Member
 
Total Posts:  39
Joined:  2009-03-25
Ahmedabad, India
 

I was also getting the
“UPS: 10002: The XML document is well formed but the document is not valid”
in the response from UPS.

I tried this & it worked for me..

http://forum.turnkeywebtools.com/showthread.php?t=5471

 
Magento Community Magento Community
Magento Community
Magento Community
 
collieradmin
Jr. Member
 
Total Posts:  7
Joined:  2009-07-30
 
CreedFeed - 20 June 2008 09:48 AM

Edit >> Note, I am using Magento ver. 1.0.19870.4

I was attempting to configure the UPS XML Shipping Method today and kept getting the following error message when trying to obtain a quote:

This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.

I did some searching and found other people were having problems with the UPS XML Shipping Method. I found this thread which contains a bunch of information for updating the settings in the admin panel as well as a few changes to the core code to update the way the CURL request was made. I tried all of these methods and still received the same error.

I did a bit more investigating and found that I was actually receiving data from UPS. Assuming you have not made any changes to the core files, the following file deals with the UPS XML Shipping:

app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php

In this file on line 570 the CURL request is made and the response back is stored in $xmlResponse

$xmlResponse curl_exec ($ch);

On the next line I added a var_dump to see what response I was receiving, and I was in fact receiving a valid response with shipping prices!

$xmlResponse curl_exec ($ch);
var_dump($xmlResponse); die;

This led me to further investigate and I found what appears to be a bug in the code. The error was occuring in the function _parseXmlResponse. Again, assuming you have not touched this file, the following code block is the problem. It starts at line 581:

581        if (strlen(trim($xmlResponse))>0) {
582            $xml 
= new Varien_Simplexml_Config();
583            $xml->loadString($xmlResponse);
584            $arr $xml->getXpath("//RatingServiceSelectionResponse/Response/ResponseStatusCode/text()");
585            $success = (int)$arr[0][0];
586            $result Mage::getModel('shipping/rate_result');
587            if($success===1){
588                $arr 
$xml->getXpath("//RatingServiceSelectionResponse/RatedShipment");
589                $allowedMethods explode(","$this->getConfigData('allowed_methods'));
590                foreach ($arr as $shipElement){
591                    $code 
= (string)$shipElement->Service->Code;
592                    #$shipment = $this->getShipmentByCode($code);
593                    if (in_array($code$allowedMethods)) {
594                        $costArr[$code] 
$shipElement->TotalCharges->MonetaryValue;
595                        $priceArr[$code] $this->getMethodPrice(floatval($shipElement->TotalCharges->MonetaryValue),$code);
596                    }
597                }
598            } 
else {
599                $arr 
$xml->getXpath("//RatingServiceSelectionResponse/Response/Error/ErrorDescription/text()");
600                $errorTitle = (string)$arr[0][0];
601                $error Mage::getModel('shipping/rate_result_error');
602                $error->setCarrier('ups');
603                $error->setCarrierTitle($this->getConfigData('title'));
604                //$error->setErrorMessage($errorTitle);
605                $error->setErrorMessage($this->getConfigData('specificerrmsg'));
606            }
607        }

On line 584 we grab the ResponseStatusCode from the response we get back from UPS. If it was successful, that tag should be set to the value “1”. What we actually get back here (assigned to the variable $arr) is an array of data. On line 585 we extract the specific value we need from that array and store it in the variable $success. This is where the bug is. Line 585 is assuming that the array $arr is an array holding an array so $arr[0][0] would be the value we need. This is wrong though. There is actually an object being stored in $arr[0] of the type Varien_Simplexml_Element. Thus the code needs to be modified to grab the value from this object. The modification I made is as follows:

$arr $xml->getXpath("//RatingServiceSelectionResponse/Response/ResponseStatusCode/text()");
            
$tmp $arr[0]->asArray();
            
$success = (int)$tmp[0];
            ....

Making this change appears to have solved the problem as the proper shipping quotes are displaying in the shopping cart page.

I have a huge favour to ask CreedFeed… Would you be able to upload a copy of your edited UPS.php file?

 
Magento Community Magento Community
Magento Community
Magento Community
 
miceduan
Jr. Member
 
Total Posts:  2
Joined:  2009-07-09
 

I have fresh install of 1.3.2.4, and both UPS and Fedex are turned on. But nothing seems to work. It doesn’t give any warning, just simply doesn’t show up at all. I would be happy if there is a warning or error.
I have implemented the UPS fix on this thread, but no luck too.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Template fans
Guru
 
Total Posts:  446
Joined:  2009-11-02
 

Still can not have this function on.

 
Magento Community Magento Community
Magento Community
Magento Community
 
squart
Jr. Member
 
Total Posts:  19
Joined:  2009-01-27
 

Also still having this problem and I think it might be that somehow it’s grabbing the wrong service since the service hasn’t even been selected yet by the user.

2011-04-17T19:16:00+00:00 DEBUG (7): Array
(
    
[request] => Array
        (
            
[accept_UPS_license_agreement] => yes
            [10_action] 
=> 4
            [13_product] 
=> GNDRES
            [14_origCountry] 
=> IT
            [15_origPostal] 
=> 20144
            [origCity] 
=> Milan
            [19_destPostal] 
=> 28026
            [22_destCountry] 
=> ES
            [23_weight] 
=> 16
            [47_rate_chart] 
=> Regular Daily Pickup
            [48_container] 
=> 00
            [49_residential] 
=> 01
            [weight_std] 
=> kgs
        
)

    
[result] => UPSOnLine5&#xUn;supported country specified&#x69;20

    
[__pid] => 8805
)
 
Magento Community Magento Community
Magento Community
Magento Community
 
rfoote
Jr. Member
 
Total Posts:  2
Joined:  2010-11-30
 
sayersteach - 30 August 2011 04:24 PM

I’m running into this error while trying to create a FedEx Shipping Label in the admin are of a Magento 1.6 Store.

The XML document is well formed but the document is not valid…

Any Idea’s what I’m doing wrong?

I’m having the same problem. Go to generate a UPS shipping label on an order and this same error message is returned. As far as I can tell, everything is correct when putting the package together. Anyone have any thoughts on things I should be checking in the admin?

 
Magento Community Magento Community
Magento Community
Magento Community
 
clayman80
Jr. Member
 
Total Posts:  23
Joined:  2010-02-20
 

I am having the same issue

“The XML document is well formed but the document is not valid”

Anyone have any suggestions?

Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
fiber0pti
Sr. Member
 
Total Posts:  81
Joined:  2008-07-10
 

Wrong thread, sorry.

 
Magento Community Magento Community
Magento Community
Magento Community
 
BoostMyShop
Sr. Member
 
Avatar
Total Posts:  155
Joined:  2008-06-11
France
 

Hello,

we have released a new extension to generate and print UPS shipping labels from Magento : it uses UPS webservices and you dont need UPS world ship

You can find more information here : http://www.boostmyshop.com/english/magento/ups-labels-for-magento.html

Best regards

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 2 of 2