title: Fedex API Rate request issues, php
body: <p>I can't figure out what I'm doing wrong I've set the authentication and version number but I just can get authenticated.</p>
  
  <p>I get the following error when I try the sample code.</p>
  
  <pre><code>Severity: ERROR
  Source: prof
  Code: 1000
  Message: Authentication Failed
  </code></pre>
  
  <p>Can anyone advise me on this please?! This is the first part of code, which is a barely modified copy of the example. </p>
  
  <pre><code>$path_to_wsdl = "./RateService_v18.wsdl";
  
  ini_set("soap.wsdl_cache_enabled", "0");
  
  $client = new SoapClient($path_to_wsdl, array('trace' =&gt; 1)); // Refer to http://us3.php.net/manual/en/ref.soap.php for more information
  
  $request['WebAuthenticationDetail'] = array(
      'UserCredential' =&gt;array(
          'Key' =&gt; 'PmzmlFAKEKEYVha', 
          'Password' =&gt; 'myfedex-website-password'
      )
  ); 
  $request['ClientDetail'] = array(
      'AccountNumber' =&gt; '123456789', 
      'MeterNumber' =&gt; '123456789'
  );
  $request['TransactionDetail'] = array('CustomerTransactionId' =&gt; 'testing');
  $request['Version'] = array(
      'ServiceId' =&gt; 'crs', 
      'Major' =&gt; '18', 
      'Intermediate' =&gt; '0', 
      'Minor' =&gt; '0'
  );
  
  
  $request['ReturnTransitAndCommit'] = true;
  $request['RequestedShipment']['DropoffType'] = 'REGULAR_PICKUP'; // valid values REGULAR_PICKUP, REQUEST_COURIER, ...
  $request['RequestedShipment']['ShipTimestamp'] = date('c');
  $request['RequestedShipment']['ServiceType'] = 'INTERNATIONAL_PRIORITY'; // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
  $request['RequestedShipment']['PackagingType'] = 'YOUR_PACKAGING'; // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
  $request['RequestedShipment']['TotalInsuredValue']=array('Ammount'=&gt;100,'Currency'=&gt;'USD');
  $request['RequestedShipment']['Shipper'] = addShipper();
  $request['RequestedShipment']['Recipient'] = addRecipient();
  $request['RequestedShipment']['ShippingChargesPayment'] = addShippingChargesPayment();
  $request['RequestedShipment']['RateRequestTypes'] = 'ACCOUNT'; 
  $request['RequestedShipment']['RateRequestTypes'] = 'LIST'; 
  $request['RequestedShipment']['PackageCount'] = '1';
  $request['RequestedShipment']['RequestedPackageLineItems'] = addPackageLineItem1();
  try 
  {
      if(setEndpoint('changeEndpoint'))
      {
          $newLocation = $client-&gt;__setLocation(setEndpoint('endpoint'));
      }
  
      $response = $client -&gt;getRates($request);
  
      if ($response -&gt; HighestSeverity != 'FAILURE' &amp;&amp; $response -&gt; HighestSeverity != 'ERROR')
      {   
          $rateReply = $response -&gt; RateReplyDetails;
          echo '&lt;table border="1"&gt;';
          echo '&lt;tr&gt;&lt;td&gt;Service Type&lt;/td&gt;&lt;td&gt;Amount&lt;/td&gt;&lt;td&gt;Delivery Date&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;';
          $serviceType = '&lt;td&gt;'.$rateReply -&gt; ServiceType . '&lt;/td&gt;';
          $amount = '&lt;td&gt;$' . number_format($rateReply-&gt;RatedShipmentDetails[0]-&gt;ShipmentRateDetail-&gt;TotalNetCharge-&gt;Amount,2,".",",") . '&lt;/td&gt;';
          if(array_key_exists('DeliveryTimestamp',$rateReply)){
              $deliveryDate= '&lt;td&gt;' . $rateReply-&gt;DeliveryTimestamp . '&lt;/td&gt;';
          }else if(array_key_exists('TransitTime',$rateReply)){
              $deliveryDate= '&lt;td&gt;' . $rateReply-&gt;TransitTime . '&lt;/td&gt;';
          }else {
              $deliveryDate='&lt;td&gt;&amp;nbsp;&lt;/td&gt;';
          }
          echo $serviceType . $amount. $deliveryDate;
          echo '&lt;/tr&gt;';
          echo '&lt;/table&gt;';
  
          printSuccess($client, $response);
      }
      else
      {
          printError($client, $response);
      } 
  
      writeToLog($client);    // Write to log file   
  
  } catch (SoapFault $exception) {
     printFault($exception, $client);        
  }
  
  function addShipper(){
      $shipper = array(
          'Contact' =&gt; array(
              'PersonName' =&gt; 'Sender Name',
              'CompanyName' =&gt; 'Sender Company Name',
              'PhoneNumber' =&gt; '9012638716'),
          'Address' =&gt; array(
              'StreetLines' =&gt; array('Address Line 1'),
              'City' =&gt; 'Collierville',
              'StateOrProvinceCode' =&gt; 'TN',
              'PostalCode' =&gt; '38017',
              'CountryCode' =&gt; 'US')
      );
      return $shipper;
  }
  function addRecipient(){
      $recipient = array(
          'Contact' =&gt; array(
              'PersonName' =&gt; 'Recipient Name',
              'CompanyName' =&gt; 'Company Name',
              'PhoneNumber' =&gt; '9012637906'
          ),
          'Address' =&gt; array(
              'StreetLines' =&gt; array('Address Line 1'),
              'City' =&gt; 'Richmond',
              'StateOrProvinceCode' =&gt; 'BC',
              'PostalCode' =&gt; 'V7C4V4',
              'CountryCode' =&gt; 'CA',
              'Residential' =&gt; false)
      );
      return $recipient;                                      
  }
  function addShippingChargesPayment(){
      $shippingChargesPayment = array(
          'PaymentType' =&gt; 'SENDER', // valid values RECIPIENT, SENDER and THIRD_PARTY
          'Payor' =&gt; array(
              'ResponsibleParty' =&gt; array(
              'AccountNumber' =&gt; getProperty('billaccount'),
              'CountryCode' =&gt; 'US')
          )
      );
      return $shippingChargesPayment;
  }
  function addLabelSpecification(){
      $labelSpecification = array(
          'LabelFormatType' =&gt; 'COMMON2D', // valid values COMMON2D, LABEL_DATA_ONLY
          'ImageType' =&gt; 'PDF',  // valid values DPL, EPL2, PDF, ZPLII and PNG
          'LabelStockType' =&gt; 'PAPER_7X4.75');
      return $labelSpecification;
  }
  function addSpecialServices(){
      $specialServices = array(
          'SpecialServiceTypes' =&gt; array('COD'),
          'CodDetail' =&gt; array(
              'CodCollectionAmount' =&gt; array('Currency' =&gt; 'USD', 'Amount' =&gt; 150),
              'CollectionType' =&gt; 'ANY')// ANY, GUARANTEED_FUNDS
      );
      return $specialServices; 
  }
  function addPackageLineItem1(){
      $packageLineItem = array(
          'SequenceNumber'=&gt;1,
          'GroupPackageCount'=&gt;1,
          'Weight' =&gt; array(
              'Value' =&gt; 50.0,
              'Units' =&gt; 'LB'
          ),
          'Dimensions' =&gt; array(
              'Length' =&gt; 108,
              'Width' =&gt; 5,
              'Height' =&gt; 5,
              'Units' =&gt; 'IN'
          )
      );
      return $packageLineItem;
  }
  </code></pre>
  
  <p>Thank you in advance for ANY help! :)</p>