Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2007
    Posts
    474
    Plugin Contributions
    2

    Default Fedex Error Log SOAP-ERROR: Encoding: Element 'Major' has fixed value '2' (value '4'

    Getting the following error logs: [18-Oct-2017 22:48:33 UTC] PHP Fatal error: SOAP-ERROR: Encoding: Element 'Major' has fixed value '2' (value '4' is not allowed) in /includes/modules/shipping/fedexwebservices.php on line 200

    In includes/modules/shipping/fedexwebservices.php line 165-242 is below. Line 200 starts at '$av_response = $av_client->addressValidation($av_request);'



    Code:
     
     // Address Validation
        $residential_address = true;
        $address_validation = false;
        if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_VALIDATION == 'true') {
          $path_to_address_validation_wsdl = DIR_WS_MODULES . 'shipping/fedexwebservices/wsdl/AddressValidationService_v2.wsdl';
          $av_client = new SoapClient($path_to_address_validation_wsdl, array('trace' => 1)); // Refer to http://us3.php.net/manual/en/ref.soap.php for more information
          $av_request['WebAuthenticationDetail'] = array('UserCredential' =>
                                                array('Key' => $this->fedex_key, 'Password' => $this->fedex_pwd));
          $av_request['ClientDetail'] = array('AccountNumber' => $this->fedex_act_num, 'MeterNumber' => $this->fedex_meter_num);
          $av_request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Address Validation Request v2 using PHP ***');
          $av_request['Version'] = array('ServiceId' => 'aval', 'Major' => '2', 'Intermediate' => '0', 'Minor' => '0');
          $av_request['RequestTimestamp'] = date('c');
          $av_request['Options'] = array('CheckResidentialStatus' => 1,
                                                                       'VerifyAddress' => 1,    
                                         'MaximumNumberOfMatches' => 10,
                                         'StreetAccuracy' => 'MEDIUM',
                                         'DirectionalAccuracy' => 'MEDIUM',
                                         'CompanyNameAccuracy' => 'MEDIUM',
                                         'ConvertToUpperCase' => 1,
                                         'RecognizeAlternateCityNames' => 1,
                                         'ReturnParsedElements' => 1);
          $av_request['AddressesToValidate'] = array(
            0 => array(
              'AddressId' => 'Customer Address',                                                                                                      
              'Address' => array(
                'StreetLines' => array(utf8_encode($street_address), utf8_encode($street_address2)),
                'PostalCode' => $postcode,
                'City' => $city,
                'StateOrProvinceCode' => $state,
                'CompanyName' => $order->delivery['company'],
                'CountryCode' => $country_id
              )
            )
          );
          try {
            $av_response = $av_client->addressValidation($av_request);
            /*
            //echo '<!--';
            echo '<pre>';
            print_r($av_response); 
            echo '</pre>';
            //echo '-->';
            die();
            */
            if ($av_response->HighestSeverity == 'SUCCESS') {
              $address_validation = true;
              if ($av_response->AddressResults->ProposedAddressDetails->ResidentialStatus == 'BUSINESS') {
                $residential_address = false;
              } // already set to true so no need for else statement
            }
          } catch (Exception $e) {
          }
        }
        if ($address_validation == false) {
          if ($order->delivery['company'] != '') {
            $residential_address = false;
          } else {
            $residential_address = true;
          }
        }
        $request['RequestedShipment']['Shipper'] = array('Address' => array(
                                                         'StreetLines' => array(MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_1, MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_2), // Origin details
                                                         'City' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_CITY,
                                                         'StateOrProvinceCode' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATE,
                                                         'PostalCode' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_POSTAL,
                                                         'CountryCode' => $this->country));          
        $request['RequestedShipment']['Recipient'] = array('Address' => array (
                                                           'StreetLines' => array(utf8_encode($street_address), utf8_encode($street_address2)), // customer street address
                                                           'City' => utf8_encode($city), //customer city
                                                           //'StateOrProvinceCode' => $state, //customer state
                                                           'PostalCode' => $postcode, //customer postcode
                                                           'CountryCode' => $country_id,
                                                           'Residential' => $residential_address)); //customer county code
        if (in_array($country_id, array('US', 'CA'))) {
          $request['RequestedShipment']['Recipient']['StateOrProvinceCode'] = $state;
        }
        //print_r($request['RequestedShipment']['Recipient'])  ;
        //exit;

  2. #2
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,683
    Plugin Contributions
    9

    Default Re: Fedex Error Log SOAP-ERROR: Encoding: Element 'Major' has fixed value '2' (value

    linda,
    i had problems with v2 of the avs.

    here is my suggestion. you need to download v4, AddressValidationService_v4.wsdl. i found an easily downloaded version here:

    https://raw.githubusercontent.com/py...ervice_v4.wsdl

    save the file to this location as:

    DIR_WS_MODULES . 'shipping/fedexwebservices/wsdl/AddressValidationService_v4.wsdl

    (it should be where AddressValidationService_v2.wsdl is...)

    then change these two lines of code:

    PHP Code:
    //from
    $path_to_address_validation_wsdl DIR_WS_MODULES 'shipping/fedexwebservices/wsdl/AddressValidationService_v2.wsdl';

    //to
    $path_to_address_validation_wsdl DIR_WS_MODULES 'shipping/fedexwebservices/wsdl/AddressValidationService_v4.wsdl';

    //and from
    $av_request['Version'] = array('ServiceId' => 'aval''Major' => '2''Intermediate' => '0''Minor' => '0');

    //to
    $av_request['Version'] = array('ServiceId' => 'aval''Major' => '4''Intermediate' => '0''Minor' => '0'); 
    good luck! let us know how is goes...
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  3. #3
    Join Date
    Jun 2007
    Posts
    474
    Plugin Contributions
    2

    Default Re: Fedex Error Log SOAP-ERROR: Encoding: Element 'Major' has fixed value '2' (value

    Seems to have done the trick. Thanks.

  4. #4
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,672
    Plugin Contributions
    123

    Default Re: Fedex Error Log SOAP-ERROR: Encoding: Element 'Major' has fixed value '2' (value

    Weird - I had this problem but it was transient and seems to have gone away.
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  5. #5
    Join Date
    Oct 2005
    Location
    Chicago, IL USA
    Posts
    1,556
    Plugin Contributions
    28

    Default Re: Fedex Error Log SOAP-ERROR: Encoding: Element 'Major' has fixed value '2' (value

    A new client had this same error. I've applied the fix and seems to be working here.

  6. #6
    Join Date
    Apr 2019
    Posts
    244
    Plugin Contributions
    0

    Default Re: Fedex Error Log SOAP-ERROR: Encoding: Element 'Major' has fixed value '2' (value

    My testing site had the same error as well...Not sure if it is related to PHP version or not. My site is 157 and PHP 7.2.

    The fix above works for my site.

  7. #7
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,683
    Plugin Contributions
    9

    Default Re: Fedex Error Log SOAP-ERROR: Encoding: Element 'Major' has fixed value '2' (value

    Quote Originally Posted by jeking View Post
    A new client had this same error. I've applied the fix and seems to be working here.
    Quote Originally Posted by njcyx View Post
    My testing site had the same error as well...Not sure if it is related to PHP version or not. My site is 157 and PHP 7.2.

    The fix above works for my site.
    boo yeah!!

    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

 

 

Similar Threads

  1. v151 Option Value Error
    By dfp111 in forum Setting Up Categories, Products, Attributes
    Replies: 10
    Last Post: 4 Jul 2014, 07:46 PM
  2. Option Value Error
    By Digi Deborah in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 24 Oct 2011, 10:30 PM
  3. Replies: 2
    Last Post: 2 Aug 2011, 03:57 PM
  4. Options Value Error
    By hollymccaig in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 18 Mar 2011, 10:05 PM
  5. coupon value error 1.3.6 (including tax)
    By paulm in forum Bug Reports
    Replies: 4
    Last Post: 5 Jan 2007, 11:36 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR