Connecting Tech Pros Worldwide Help | Site Map

FedEx Web Services

Newbie
 
Join Date: Aug 2007
Posts: 15
#1: Aug 31 '07
I'm having a problem during consuming the FedEx webservice...

Error Detail:
Warning: SoapClient::SoapClient() [function.SoapClient-SoapClient]: I/O warning : failed to load external entity "wsdl/RateService.wsdl" in D:\Test\FDX\rate.php on line 12

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'wsdl/RateService.wsdl' in D:\Test\FDX\rate.php:12 Stack trace: #0 D:\Test\FDX\rate.php(12): SoapClient->SoapClient('wsdl/RateServic...') #1 {main} thrown in D:\Test\FDX\rate.php on line 12


Please help me out
Im also posting the source code...
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. // Copyright 2007, FedEx Corporation. All rights reserved.
  4.  
  5. chdir('..'); 
  6.  
  7. require_once('library/fedex-common.php5');
  8.  
  9. $newline = "<br />";
  10. ini_set("soap.wsdl_cache_enabled", "1");
  11.  
  12. $client = new SoapClient("wsdl/RateService.wsdl"); // replace with valid path to WSDL
  13.  
  14. $request['AuthenticationDetail'] = array('UserCredential' => '2I7km2NKzbb83tpB'); // Replace 'XXX' with FedEx provided user credential
  15. $request['ClientDetail'] = array('AccountNumber' => '510087461', 'MeterNumber' => '1193980');// Replace 'XXX' with your account and meter number
  16. $request['TransactionDetail'] = array('CustomerTransactionId' => '1193980');
  17. $request['Version'] = array('Major' => '1', 'Intermediate' => '1', 'Minor' => '0');
  18. $request['Origin'] = array('StreetLines' => array('Sender Address Line 1'), // Origin details
  19.                                           'City' => 'Sender City',
  20.                                           'StateOrProvinceCode' => 'TN',
  21.                                           'PostalCode' => '38115',
  22.                                           'CountryCode' => 'US');
  23. $request['Destination'] = array('StreetLines' => array('Destination Address Line 1'), // Destination details
  24.                                                'City' => 'Recipient City',
  25.                                                'StateOrProvinceCode' => 'PQ',
  26.                                                'PostalCode' => 'H1E1A1',
  27.                                                'CountryCode' => 'CA');
  28. $request['Payment'] = array('PaymentType' => 'SENDER'); // valid codes RECIPIENT, SENDER and THIRD_PARTY
  29. $request['DropoffType'] = 'REGULAR_PICKUP'; // valid codes BUSINESS_SERVICE_CENTER, DROP_BOX, REGULAR_PICKUP, REQUEST_COURIER and STATION
  30. $request['ServiceType'] = 'INTERNATIONAL_PRIORITY'; // valid codes STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
  31. $request['PackagingType'] = 'YOUR_PACKAGING'; // valid codes FEDEX_BOK, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
  32. $request['ShipDate'] = date('Y-m-d');
  33. $request['RateRequestTypes'] = 'ACCOUNT'; // valid codes ACCOUNT, LIST
  34.  
  35. $PassRateRequestPackageSummary = true;
  36.  
  37. if ($PassRateRequestPackageSummary)
  38. {
  39.    // Passing multi piece shipment rate request (by setting PieceCount > 1)
  40.    $request['RateRequestPackageSummary'] = array('TotalWeight' => array('Value' => 20.0, 'Units' => 'LB'), // valid codes LB and KG
  41.                                                                 'TotalInsuredValue' => array('Amount' => 100, 'Currency' => 'USD'),
  42.                                                                 'PieceCount' => 2,
  43.                                                                 'SpecialServicesRequested' => array('SpecialServiceTypes' => 'COD', // valid codes COD, HOLD_AT_LOCATION, ...
  44.                                                                                                     'CodDetail' => 
  45.                                                                                                      array ('CollectionAmount' => array( 'Currency' => 'USD', 'Amount' => '25.98'),
  46.                                                                                                     'CollectionType' => 'CASH')));
  47. }
  48. else
  49. {
  50.     // Passing single piece shipment rate request 
  51.     $request['PackageCount'] = 1; // currently only one occurrence of RequestedPackage is supported
  52.     $request['Packages'] = array(0 => array('Weight' => array('Value' => 10.0, 'Units' => 'LB'), // valid code LB and KG
  53.                                                            'InsuredValue' => array('Amount' => 100, 'Currency' => 'USD'),
  54.                                                            'Dimensions' => array('Length' => '1', 'Width' => '1', 'Height' => '1', 'Units' => 'IN'), // valid code IN and CM
  55.                                                            'SpecialServicesRequested' => array('SpecialServiceTypes' => 'COD', // valid codes COD, HOLD_AT_LOCATION, ...
  56.                                                                                                    'CodDetail' => 
  57.                                                                                                     array ('CollectionAmount' => array( 'Currency' => 'USD', 'Amount' => '25.98'),
  58.                                                                                                     'CollectionType' => 'CASH'))));
  59. }
  60.  
  61. try 
  62. {
  63.     $response = $client ->__soapCall("getRate", array('parameters' => $request));
  64.  
  65.     if ($response -> HighestSeverity != 'FAILURE' && $response -> HighestSeverity != 'ERROR')
  66.     {
  67.         printRequestResponse($client);
  68.     }
  69.     else
  70.     {
  71.         echo 'Error in processing transaction.'. $newline. $newline; 
  72.         foreach ($response -> Notifications as $notification)
  73.         {
  74.             echo $notification . $newline;
  75.         }
  76.     } 
  77.  
  78.     writeToLog($client);    // Write to log file   
  79.  
  80. } catch (SoapFault $exception) {
  81.    printFault($exception, $client);        
  82. }
  83.  
  84. ?>
  85.  
ak1dnar's Avatar
Moderator
 
Join Date: Jan 2007
Location: Colombo
Posts: 1,439
#2: Aug 31 '07

re: FedEx Web Services


Hey welcome to TheScripts.com.

Please note that you are not allowed to post any web site links that contains commercial based contents. Sorry its the forum rule. If you want to post the source codes, you have to use this thread or if you want attach the codes to the thread, by pressing the edit button after you post you can find the attachment section. but I am strongly recommending posting the source codes to the threads in line. with the code tags.

Please read the here for more details.


ak1dnar's Avatar
Moderator
 
Join Date: Jan 2007
Location: Colombo
Posts: 1,439
#3: Aug 31 '07

re: FedEx Web Services


Expand|Select|Wrap|Line Numbers
  1. new SoapClient("wsdl/RateService.wsdl");
How about checking your directory structure again.

FXD/rate.php
FXD/wsdl/RateService.wsdl

Is It like this?
Newbie
 
Join Date: Aug 2007
Posts: 15
#4: Aug 31 '07

re: FedEx Web Services


Quote:

Originally Posted by ajaxrand

Expand|Select|Wrap|Line Numbers
  1. new SoapClient("wsdl/RateService.wsdl");
How about checking your directory structure again.

FXD/rate.php
FXD/wsdl/RateService.wsdl

Is It like this?


yes....


i can also send you the whole thing...
tell me you email or main me at [REMOVED-for your own safety]
ak1dnar's Avatar
Moderator
 
Join Date: Jan 2007
Location: Colombo
Posts: 1,439
#5: Aug 31 '07

re: FedEx Web Services


With the specified error details, what I can understand is, its not creating the instant of the soapclient from the specified path of the wsdl file. Try to use the absolute path of the WSDL (http URL) instead of relative path.
Newbie
 
Join Date: Sep 2007
Posts: 1
#6: Sep 10 '07

re: FedEx Web Services


I am getting the same error. If you find a resolution to this, please update us.
My guess is that a) SOAP has not been installed on my Apache Linux server,
b) Apache is not configured probably to recognize *.WSDL files, or c) I did not deploy the WSDL correctly.
I'm having trouble finding any documentation on any of the above, except for the following:
http://www.xmethods.net/gettingstarted/apache.html
Newbie
 
Join Date: Aug 2007
Posts: 15
#7: Sep 12 '07

re: FedEx Web Services


Thanks ajaxrand....

It works now...i 've specified the whole url of wsdl file with...
and its working...
ak1dnar's Avatar
Moderator
 
Join Date: Jan 2007
Location: Colombo
Posts: 1,439
#8: Sep 12 '07

re: FedEx Web Services


Quote:

Originally Posted by daniyalnawaz

Thanks ajaxrand....

It works now...i 've specified the whole url of wsdl file with...
and its working...

Glad you got it working. post back any time when there is a issue.
Member
 
Join Date: Oct 2008
Posts: 32
#9: Oct 3 '08

re: FedEx Web Services


hai i'm having trouble regarding this coding, what do u mean by specifying the complete wsdl url? can anyone send me the complete coding? plz help me. thanks
ak1dnar's Avatar
Moderator
 
Join Date: Jan 2007
Location: Colombo
Posts: 1,439
#10: Oct 3 '08

re: FedEx Web Services


Quote:

Originally Posted by dbest5250

hai i'm having trouble regarding this coding, what do u mean by specifying the complete wsdl url? can anyone send me the complete coding? plz help me. thanks

Instead of the relative path of the wsdl file
Expand|Select|Wrap|Line Numbers
  1. $client = new SoapClient("wsdl/RateService.wsdl");
please specify the absolute path
Expand|Select|Wrap|Line Numbers
  1. $client = new SoapClient("http://domain_name/dir_path/RateService.wsdl");
Member
 
Join Date: Oct 2008
Posts: 32
#11: Oct 5 '08

re: FedEx Web Services


thanks before, i already got it working, the directory for localhost is ok, i dont need the url directory. hehehe ^^ but i have another problem, since i have gotten the result for the request, how do i get the netCharge only and not all the response? i have tried printRequestResponse($client['NetCharge']); but it seems is not working. and i tried again today (sunday) how come is not working? is it close on weekends? this is the error massage :

Error in processing transaction.

FAILURE: Rating is temporarily unavailable, please try again later.
NOTE: Deliver Weekday was assumed.

i thank u before ^^
ak1dnar's Avatar
Moderator
 
Join Date: Jan 2007
Location: Colombo
Posts: 1,439
#12: Oct 5 '08

re: FedEx Web Services


Quote:

Originally Posted by dbest5250

thanks before, i already got it working, the directory for localhost is ok, i dont need the url directory. hehehe ^^ but i have another problem, since i have gotten the result for the request, how do i get the netCharge only and not all the response? i have tried printRequestResponse($client['NetCharge']); but it seems is not working. and i tried again today (sunday) how come is not working? is it close on weekends? this is the error massage :

Error in processing transaction.

FAILURE: Rating is temporarily unavailable, please try again later.
NOTE: Deliver Weekday was assumed.

i thank u before ^^

I think now your script working perfectly. that is NOT a coding error. it is a message from the service provider.
may be this will help for you.
http://www.ubercart.org/issue/5206/error_crs_7_rating_temporarily_unavailable_please_ try_again_later
give it a try. thanks.
Member
 
Join Date: Oct 2008
Posts: 32
#13: Oct 5 '08

re: FedEx Web Services


thanks ak1dnar but i still cant get the single value NetCharge from the fed ex response. Can anyone help me? i tried using response['NetCharge'] and its not working all i got was an error :(
ak1dnar's Avatar
Moderator
 
Join Date: Jan 2007
Location: Colombo
Posts: 1,439
#14: Oct 5 '08

re: FedEx Web Services


Quote:

Originally Posted by dbest5250

thanks ak1dnar but i still cant get the single value NetCharge from the fed ex response. Can anyone help me? i tried using response['NetCharge'] and its not working all i got was an error :(

I'm sorry dbest5250, you have to contact service provider's support team on this. as I said earlier your script is working. in other words your php coding is working. So now you are getting a ERROR/STATUS MESSAGE from the WEB SERVICE.

please contact service provider's support team to find out about the error message.
or read the documentation provided.
Member
 
Join Date: Oct 2008
Posts: 32
#15: Oct 6 '08

re: FedEx Web Services


no is not an error, is working fine now, i figure it out that the web service is not working on sundays, now im trying to get the value of the NetCharge that fedex has given. they give this as a response :

Response
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  3.     <soapenv:Header xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
  4.     <soapenv:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  5.         <v4:RateReply xmlns:rate="http://fedex.com/ws/rate/v5" xmlns:v4="http://fedex.com/ws/rate/v4">
  6.             <v4:HighestSeverity>NOTE</v4:HighestSeverity>
  7.             <v4:Notifications>
  8.                 <v4:Severity>NOTE</v4:Severity>
  9.                 <v4:Source>crs</v4:Source>
  10.                 <v4:Code>834</v4:Code>
  11.                 <v4:Message>Deliver Weekday was assumed. </v4:Message>
  12.                 <v4:LocalizedMessage>Deliver Weekday was assumed. </v4:LocalizedMessage>
  13.             </v4:Notifications>
  14.             <v4:Notifications>
  15.                 <v4:Severity>SUCCESS</v4:Severity>
  16.                 <v4:Source>crs</v4:Source>
  17.                 <v4:Code>0</v4:Code>
  18.                 <v4:Message>Request was successfully processed. </v4:Message>
  19.                 <v4:LocalizedMessage>Request was successfully processed. </v4:LocalizedMessage>
  20.             </v4:Notifications>
  21.             <ns1:TransactionDetail xmlns:ns1="http://fedex.com/ws/rate/v4" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  22.                 <ns1:CustomerTransactionId> *** Rate Request v4 using PHP ***</ns1:CustomerTransactionId>
  23.             </ns1:TransactionDetail>
  24.             <ns1:Version xmlns:ns1="http://fedex.com/ws/rate/v4" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  25.                 <ns1:ServiceId>crs</ns1:ServiceId>
  26.                 <ns1:Major>4</ns1:Major>
  27.                 <ns1:Intermediate>0</ns1:Intermediate>
  28.                 <ns1:Minor>0</ns1:Minor>
  29.             </ns1:Version>
  30.             <v4:RateReplyDetails>
  31.                 <v4:ServiceType>PRIORITY_OVERNIGHT</v4:ServiceType>
  32.                 <v4:PackagingType>YOUR_PACKAGING</v4:PackagingType>
  33.                 <v4:IneligibleForMoneyBackGuarantee>false</v4:IneligibleForMoneyBackGuarantee>
  34.                 <v4:OriginServiceArea>A1</v4:OriginServiceArea>
  35.                 <v4:DestinationServiceArea>A1</v4:DestinationServiceArea>
  36.                 <v4:SignatureOption>SERVICE_DEFAULT</v4:SignatureOption>
  37.                 <v4:ActualRateType>PAYOR_ACCOUNT</v4:ActualRateType>
  38.                 <v4:RatedShipmentDetails>
  39.                     <v4:EffectiveNetDiscount>
  40.                         <v4:Currency>USD</v4:Currency>
  41.                         <v4:Amount>28.02</v4:Amount>
  42.                     </v4:EffectiveNetDiscount>
  43.                     <v4:ShipmentRateDetail>
  44.                         <v4:RateType>PAYOR_ACCOUNT</v4:RateType>
  45.                         <v4:RateScale>1</v4:RateScale>
  46.                         <v4:PricingCode>PACKAGE</v4:PricingCode>
  47.                         <v4:DimDivisor>194</v4:DimDivisor>
  48.                         <v4:FuelSurchargePercent>16.5</v4:FuelSurchargePercent>
  49.                         <v4:TotalBillingWeight>
  50.                             <v4:Units>LB</v4:Units>
  51.                             <v4:Value>13.0</v4:Value>
  52.                         </v4:TotalBillingWeight>
  53.                         <v4:TotalDimWeight>
  54.                             <v4:Units>LB</v4:Units>
  55.                             <v4:Value>13.0</v4:Value>
  56.                         </v4:TotalDimWeight>
  57.                         <v4:TotalBaseCharge>
  58.                             <v4:Currency>USD</v4:Currency>
  59.                             <v4:Amount>52.25</v4:Amount>
  60.                         </v4:TotalBaseCharge>
  61.                         <v4:TotalFreightDiscounts>
  62.                             <v4:Currency>USD</v4:Currency>
  63.                             <v4:Amount>0.0</v4:Amount>
  64.                         </v4:TotalFreightDiscounts>
  65.                         <v4:TotalNetFreight>
  66.                             <v4:Currency>USD</v4:Currency>
  67.                             <v4:Amount>52.25</v4:Amount>
  68.                         </v4:TotalNetFreight>
  69.                         <v4:TotalSurcharges>
  70.                             <v4:Currency>USD</v4:Currency>
  71.                             <v4:Amount>8.62</v4:Amount>
  72.                         </v4:TotalSurcharges>
  73.                         <v4:TotalNetFedExCharge>
  74.                             <v4:Currency>USD</v4:Currency>
  75.                             <v4:Amount>60.87</v4:Amount>
  76.                         </v4:TotalNetFedExCharge>
  77.                         <v4:TotalTaxes>
  78.                             <v4:Currency>USD</v4:Currency>
  79.                             <v4:Amount>0.0</v4:Amount>
  80.                         </v4:TotalTaxes>
  81.                         <v4:TotalNetCharge>
  82.                             <v4:Currency>USD</v4:Currency>
  83.                             <v4:Amount>60.87</v4:Amount>
  84.                         </v4:TotalNetCharge>
  85.                         <v4:TotalRebates>
  86.                             <v4:Currency>USD</v4:Currency>
  87.                             <v4:Amount>0.0</v4:Amount>
  88.                         </v4:TotalRebates>
  89.                         <v4:Surcharges>
  90.                             <v4:SurchargeType>INSURED_VALUE</v4:SurchargeType>
  91.                             <v4:Description>Insured value</v4:Description>
  92.                             <v4:Amount>
  93.                                 <v4:Currency>USD</v4:Currency>
  94.                                 <v4:Amount>0.0</v4:Amount>
  95.                             </v4:Amount>
  96.                         </v4:Surcharges>
  97.                         <v4:Surcharges>
  98.                             <v4:SurchargeType>FUEL</v4:SurchargeType>
  99.                             <v4:Description>Fuel</v4:Description>
  100.                             <v4:Amount>
  101.                                 <v4:Currency>USD</v4:Currency>
  102.                                 <v4:Amount>8.62</v4:Amount>
  103.                             </v4:Amount>
  104.                         </v4:Surcharges>
  105.                     </v4:ShipmentRateDetail>
  106.                     <v4:RatedPackages>
  107.                         <v4:EffectiveNetDiscount>
  108.                             <v4:Currency>USD</v4:Currency>
  109.                             <v4:Amount>28.02</v4:Amount>
  110.                         </v4:EffectiveNetDiscount>
  111.                         <v4:PackageRateDetail>
  112.                             <v4:RateType>PAYOR_ACCOUNT</v4:RateType>
  113.                             <v4:RatedWeightMethod>DIM</v4:RatedWeightMethod>
  114.                             <v4:BillingWeight>
  115.                                 <v4:Units>LB</v4:Units>
  116.                                 <v4:Value>13.0</v4:Value>
  117.                             </v4:BillingWeight>
  118.                             <v4:DimWeight>
  119.                                 <v4:Units>LB</v4:Units>
  120.                                 <v4:Value>13.0</v4:Value>
  121.                             </v4:DimWeight>
  122.                             <v4:BaseCharge>
  123.                                 <v4:Currency>USD</v4:Currency>
  124.                                 <v4:Amount>52.25</v4:Amount>
  125.                             </v4:BaseCharge>
  126.                             <v4:TotalFreightDiscounts>
  127.                                 <v4:Currency>USD</v4:Currency>
  128.                                 <v4:Amount>0.0</v4:Amount>
  129.                             </v4:TotalFreightDiscounts>
  130.                             <v4:NetFreight>
  131.                                 <v4:Currency>USD</v4:Currency>
  132.                                 <v4:Amount>52.25</v4:Amount>
  133.                             </v4:NetFreight>
  134.                             <v4:TotalSurcharges>
  135.                                 <v4:Currency>USD</v4:Currency>
  136.                                 <v4:Amount>8.62</v4:Amount>
  137.                             </v4:TotalSurcharges>
  138.                             <v4:NetFedExCharge>
  139.                                 <v4:Currency>USD</v4:Currency>
  140.                                 <v4:Amount>60.87</v4:Amount>
  141.                             </v4:NetFedExCharge>
  142.                             <v4:TotalTaxes>
  143.                                 <v4:Currency>USD</v4:Currency>
  144.                                 <v4:Amount>0.0</v4:Amount>
  145.                             </v4:TotalTaxes>
  146.                             <v4:NetCharge>
  147.                                 <v4:Currency>USD</v4:Currency>
  148.                                 <v4:Amount>60.87</v4:Amount>
  149.                             </v4:NetCharge>
  150.                             <v4:TotalRebates>
  151.                                 <v4:Currency>USD</v4:Currency>
  152.                                 <v4:Amount>0.0</v4:Amount>
  153.                             </v4:TotalRebates>
  154.                             <v4:Surcharges>
  155.                                 <v4:SurchargeType>INSURED_VALUE</v4:SurchargeType>
  156.                                 <v4:Description>Insured value</v4:Description>
  157.                                 <v4:Amount>
  158.                                     <v4:Currency>USD</v4:Currency>
  159.                                     <v4:Amount>0.0</v4:Amount>
  160.                                 </v4:Amount>
  161.                             </v4:Surcharges>
  162.                             <v4:Surcharges>
  163.                                 <v4:SurchargeType>FUEL</v4:SurchargeType>
  164.                                 <v4:Description>Fuel</v4:Description>
  165.                                 <v4:Amount>
  166.                                     <v4:Currency>USD</v4:Currency>
  167.                                     <v4:Amount>8.62</v4:Amount>
  168.                                 </v4:Amount>
  169.                             </v4:Surcharges>
  170.                         </v4:PackageRateDetail>
  171.                     </v4:RatedPackages>
  172.                 </v4:RatedShipmentDetails>
  173.                 <v4:RatedShipmentDetails>
  174.                     <v4:EffectiveNetDiscount>
  175.                         <v4:Currency>USD</v4:Currency>
  176.                         <v4:Amount>28.02</v4:Amount>
  177.                     </v4:EffectiveNetDiscount>
  178.                     <v4:ShipmentRateDetail>
  179.                         <v4:RateType>RATED_ACCOUNT</v4:RateType>
  180.                         <v4:RateScale>1</v4:RateScale>
  181.                         <v4:PricingCode>PACKAGE</v4:PricingCode>
  182.                         <v4:DimDivisor>194</v4:DimDivisor>
  183.                         <v4:FuelSurchargePercent>16.5</v4:FuelSurchargePercent>
  184.                         <v4:TotalBillingWeight>
  185.                             <v4:Units>LB</v4:Units>
  186.                             <v4:Value>13.0</v4:Value>
  187.                         </v4:TotalBillingWeight>
  188.                         <v4:TotalDimWeight>
  189.                             <v4:Units>LB</v4:Units>
  190.                             <v4:Value>13.0</v4:Value>
  191.                         </v4:TotalDimWeight>
  192.                         <v4:TotalBaseCharge>
  193.                             <v4:Currency>USD</v4:Currency>
  194.                             <v4:Amount>52.25</v4:Amount>
  195.                         </v4:TotalBaseCharge>
  196.                         <v4:TotalFreightDiscounts>
  197.                             <v4:Currency>USD</v4:Currency>
  198.                             <v4:Amount>0.0</v4:Amount>
  199.                         </v4:TotalFreightDiscounts>
  200.                         <v4:TotalNetFreight>
  201.                             <v4:Currency>USD</v4:Currency>
  202.                             <v4:Amount>52.25</v4:Amount>
  203.                         </v4:TotalNetFreight>
  204.                         <v4:TotalSurcharges>
  205.                             <v4:Currency>USD</v4:Currency>
  206.                             <v4:Amount>8.62</v4:Amount>
  207.                         </v4:TotalSurcharges>
  208.                         <v4:TotalNetFedExCharge>
  209.                             <v4:Currency>USD</v4:Currency>
  210.                             <v4:Amount>60.87</v4:Amount>
  211.                         </v4:TotalNetFedExCharge>
  212.                         <v4:TotalTaxes>
  213.                             <v4:Currency>USD</v4:Currency>
  214.                             <v4:Amount>0.0</v4:Amount>
  215.                         </v4:TotalTaxes>
  216.                         <v4:TotalNetCharge>
  217.                             <v4:Currency>USD</v4:Currency>
  218.                             <v4:Amount>60.87</v4:Amount>
  219.                         </v4:TotalNetCharge>
  220.                         <v4:TotalRebates>
  221.                             <v4:Currency>USD</v4:Currency>
  222.                             <v4:Amount>0.0</v4:Amount>
  223.                         </v4:TotalRebates>
  224.                         <v4:Surcharges>
  225.                             <v4:SurchargeType>INSURED_VALUE</v4:SurchargeType>
  226.                             <v4:Description>Insured value</v4:Description>
  227.                             <v4:Amount>
  228.                                 <v4:Currency>USD</v4:Currency>
  229.                                 <v4:Amount>0.0</v4:Amount>
  230.                             </v4:Amount>
  231.                         </v4:Surcharges>
  232.                         <v4:Surcharges>
  233.                             <v4:SurchargeType>FUEL</v4:SurchargeType>
  234.                             <v4:Description>Fuel</v4:Description>
  235.                             <v4:Amount>
  236.                                 <v4:Currency>USD</v4:Currency>
  237.                                 <v4:Amount>8.62</v4:Amount>
  238.                             </v4:Amount>
  239.                         </v4:Surcharges>
  240.                     </v4:ShipmentRateDetail>
  241.                     <v4:RatedPackages>
  242.                         <v4:EffectiveNetDiscount>
  243.                             <v4:Currency>USD</v4:Currency>
  244.                             <v4:Amount>28.02</v4:Amount>
  245.                         </v4:EffectiveNetDiscount>
  246.                         <v4:PackageRateDetail>
  247.                             <v4:RateType>RATED_ACCOUNT</v4:RateType>
  248.                             <v4:RatedWeightMethod>DIM</v4:RatedWeightMethod>
  249.                             <v4:BillingWeight>
  250.                                 <v4:Units>LB</v4:Units>
  251.                                 <v4:Value>13.0</v4:Value>
  252.                             </v4:BillingWeight>
  253.                             <v4:DimWeight>
  254.                                 <v4:Units>LB</v4:Units>
  255.                                 <v4:Value>13.0</v4:Value>
  256.                             </v4:DimWeight>
  257.                             <v4:BaseCharge>
  258.                                 <v4:Currency>USD</v4:Currency>
  259.                                 <v4:Amount>52.25</v4:Amount>
  260.                             </v4:BaseCharge>
  261.                             <v4:TotalFreightDiscounts>
  262.                                 <v4:Currency>USD</v4:Currency>
  263.                                 <v4:Amount>0.0</v4:Amount>
  264.                             </v4:TotalFreightDiscounts>
  265.                             <v4:NetFreight>
  266.                                 <v4:Currency>USD</v4:Currency>
  267.                                 <v4:Amount>52.25</v4:Amount>
  268.                             </v4:NetFreight>
  269.                             <v4:TotalSurcharges>
  270.                                 <v4:Currency>USD</v4:Currency>
  271.                                 <v4:Amount>8.62</v4:Amount>
  272.                             </v4:TotalSurcharges>
  273.                             <v4:NetFedExCharge>
  274.                                 <v4:Currency>USD</v4:Currency>
  275.                                 <v4:Amount>60.87</v4:Amount>
  276.                             </v4:NetFedExCharge>
  277.                             <v4:TotalTaxes>
  278.                                 <v4:Currency>USD</v4:Currency>
  279.                                 <v4:Amount>0.0</v4:Amount>
  280.                             </v4:TotalTaxes>
  281.                             <v4:NetCharge>
  282.                                 <v4:Currency>USD</v4:Currency>
  283.                                 <v4:Amount>60.87</v4:Amount>
  284.                             </v4:NetCharge>
  285.                             <v4:TotalRebates>
  286.                                 <v4:Currency>USD</v4:Currency>
  287.                                 <v4:Amount>0.0</v4:Amount>
  288.                             </v4:TotalRebates>
  289.                             <v4:Surcharges>
  290.                                 <v4:SurchargeType>INSURED_VALUE</v4:SurchargeType>
  291.                                 <v4:Description>Insured value</v4:Description>
  292.                                 <v4:Amount>
  293.                                     <v4:Currency>USD</v4:Currency>
  294.                                     <v4:Amount>0.0</v4:Amount>
  295.                                 </v4:Amount>
  296.                             </v4:Surcharges>
  297.                             <v4:Surcharges>
  298.                                 <v4:SurchargeType>FUEL</v4:SurchargeType>
  299.                                 <v4:Description>Fuel</v4:Description>
  300.                                 <v4:Amount>
  301.                                     <v4:Currency>USD</v4:Currency>
  302.                                     <v4:Amount>8.62</v4:Amount>
  303.                                 </v4:Amount>
  304.                             </v4:Surcharges>
  305.                         </v4:PackageRateDetail>
  306.                     </v4:RatedPackages>
  307.                 </v4:RatedShipmentDetails>
  308.                 <v4:RatedShipmentDetails>
  309.                     <v4:ShipmentRateDetail>
  310.                         <v4:RateType>PAYOR_LIST</v4:RateType>
  311.                         <v4:RateScale>1552</v4:RateScale>
  312.                         <v4:RateZone>5</v4:RateZone>
  313.                         <v4:PricingCode>PACKAGE</v4:PricingCode>
  314.                         <v4:DimDivisor>194</v4:DimDivisor>
  315.                         <v4:FuelSurchargePercent>16.5</v4:FuelSurchargePercent>
  316.                         <v4:TotalBillingWeight>
  317.                             <v4:Units>LB</v4:Units>
  318.                             <v4:Value>13.0</v4:Value>
  319.                         </v4:TotalBillingWeight>
  320.                         <v4:TotalDimWeight>
  321.                             <v4:Units>LB</v4:Units>
  322.                             <v4:Value>13.0</v4:Value>
  323.                         </v4:TotalDimWeight>
  324.                         <v4:TotalBaseCharge>
  325.                             <v4:Currency>USD</v4:Currency>
  326.                             <v4:Amount>76.3</v4:Amount>
  327.                         </v4:TotalBaseCharge>
  328.                         <v4:TotalFreightDiscounts>
  329.                             <v4:Currency>USD</v4:Currency>
  330.                             <v4:Amount>0.0</v4:Amount>
  331.                         </v4:TotalFreightDiscounts>
  332.                         <v4:TotalNetFreight>
  333.                             <v4:Currency>USD</v4:Currency>
  334.                             <v4:Amount>76.3</v4:Amount>
  335.                         </v4:TotalNetFreight>
  336.                         <v4:TotalSurcharges>
  337.                             <v4:Currency>USD</v4:Currency>
  338.                             <v4:Amount>12.59</v4:Amount>
  339.                         </v4:TotalSurcharges>
  340.                         <v4:TotalNetFedExCharge>
  341.                             <v4:Currency>USD</v4:Currency>
  342.                             <v4:Amount>88.89</v4:Amount>
  343.                         </v4:TotalNetFedExCharge>
  344.                         <v4:TotalTaxes>
  345.                             <v4:Currency>USD</v4:Currency>
  346.                             <v4:Amount>0.0</v4:Amount>
  347.                         </v4:TotalTaxes>
  348.                         <v4:TotalNetCharge>
  349.                             <v4:Currency>USD</v4:Currency>
  350.                             <v4:Amount>88.89</v4:Amount>
  351.                         </v4:TotalNetCharge>
  352.                         <v4:TotalRebates>
  353.                             <v4:Currency>USD</v4:Currency>
  354.                             <v4:Amount>0.0</v4:Amount>
  355.                         </v4:TotalRebates>
  356.                         <v4:Surcharges>
  357.                             <v4:SurchargeType>INSURED_VALUE</v4:SurchargeType>
  358.                             <v4:Description>Insured value</v4:Description>
  359.                             <v4:Amount>
  360.                                 <v4:Currency>USD</v4:Currency>
  361.                                 <v4:Amount>0.0</v4:Amount>
  362.                             </v4:Amount>
  363.                         </v4:Surcharges>
  364.                         <v4:Surcharges>
  365.                             <v4:SurchargeType>FUEL</v4:SurchargeType>
  366.                             <v4:Description>Fuel</v4:Description>
  367.                             <v4:Amount>
  368.                                 <v4:Currency>USD</v4:Currency>
  369.                                 <v4:Amount>12.59</v4:Amount>
  370.                             </v4:Amount>
  371.                         </v4:Surcharges>
  372.                     </v4:ShipmentRateDetail>
  373.                     <v4:RatedPackages>
  374.                         <v4:PackageRateDetail>
  375.                             <v4:RateType>PAYOR_LIST</v4:RateType>
  376.                             <v4:RatedWeightMethod>DIM</v4:RatedWeightMethod>
  377.                             <v4:BillingWeight>
  378.                                 <v4:Units>LB</v4:Units>
  379.                                 <v4:Value>13.0</v4:Value>
  380.                             </v4:BillingWeight>
  381.                             <v4:DimWeight>
  382.                                 <v4:Units>LB</v4:Units>
  383.                                 <v4:Value>13.0</v4:Value>
  384.                             </v4:DimWeight>
  385.                             <v4:BaseCharge>
  386.                                 <v4:Currency>USD</v4:Currency>
  387.                                 <v4:Amount>76.3</v4:Amount>
  388.                             </v4:BaseCharge>
  389.                             <v4:TotalFreightDiscounts>
  390.                                 <v4:Currency>USD</v4:Currency>
  391.                                 <v4:Amount>0.0</v4:Amount>
  392.                             </v4:TotalFreightDiscounts>
  393.                             <v4:NetFreight>
  394.                                 <v4:Currency>USD</v4:Currency>
  395.                                 <v4:Amount>76.3</v4:Amount>
  396.                             </v4:NetFreight>
  397.                             <v4:TotalSurcharges>
  398.                                 <v4:Currency>USD</v4:Currency>
  399.                                 <v4:Amount>12.59</v4:Amount>
  400.                             </v4:TotalSurcharges>
  401.                             <v4:NetFedExCharge>
  402.                                 <v4:Currency>USD</v4:Currency>
  403.                                 <v4:Amount>88.89</v4:Amount>
  404.                             </v4:NetFedExCharge>
  405.                             <v4:TotalTaxes>
  406.                                 <v4:Currency>USD</v4:Currency>
  407.                                 <v4:Amount>0.0</v4:Amount>
  408.                             </v4:TotalTaxes>
  409.                             <v4:NetCharge>
  410.                                 <v4:Currency>USD</v4:Currency>
  411.                                 <v4:Amount>88.89</v4:Amount>
  412.                             </v4:NetCharge>
  413.                             <v4:TotalRebates>
  414.                                 <v4:Currency>USD</v4:Currency>
  415.                                 <v4:Amount>0.0</v4:Amount>
  416.                             </v4:TotalRebates>
  417.                             <v4:Surcharges>
  418.                                 <v4:SurchargeType>INSURED_VALUE</v4:SurchargeType>
  419.                                 <v4:Description>Insured value</v4:Description>
  420.                                 <v4:Amount>
  421.                                     <v4:Currency>USD</v4:Currency>
  422.                                     <v4:Amount>0.0</v4:Amount>
  423.                                 </v4:Amount>
  424.                             </v4:Surcharges>
  425.                             <v4:Surcharges>
  426.                                 <v4:SurchargeType>FUEL</v4:SurchargeType>
  427.                                 <v4:Description>Fuel</v4:Description>
  428.                                 <v4:Amount>
  429.                                     <v4:Currency>USD</v4:Currency>
  430.                                     <v4:Amount>12.59</v4:Amount>
  431.                                 </v4:Amount>
  432.                             </v4:Surcharges>
  433.                         </v4:PackageRateDetail>
  434.                     </v4:RatedPackages>
  435.                 </v4:RatedShipmentDetails>
  436.                 <v4:RatedShipmentDetails>
  437.                     <v4:ShipmentRateDetail>
  438.                         <v4:RateType>RATED_LIST</v4:RateType>
  439.                         <v4:RateScale>1552</v4:RateScale>
  440.                         <v4:RateZone>5</v4:RateZone>
  441.                         <v4:PricingCode>PACKAGE</v4:PricingCode>
  442.                         <v4:DimDivisor>194</v4:DimDivisor>
  443.                         <v4:FuelSurchargePercent>16.5</v4:FuelSurchargePercent>
  444.                         <v4:TotalBillingWeight>
  445.                             <v4:Units>LB</v4:Units>
  446.                             <v4:Value>13.0</v4:Value>
  447.                         </v4:TotalBillingWeight>
  448.                         <v4:TotalDimWeight>
  449.                             <v4:Units>LB</v4:Units>
  450.                             <v4:Value>13.0</v4:Value>
  451.                         </v4:TotalDimWeight>
  452.                         <v4:TotalBaseCharge>
  453.                             <v4:Currency>USD</v4:Currency>
  454.                             <v4:Amount>76.3</v4:Amount>
  455.                         </v4:TotalBaseCharge>
  456.                         <v4:TotalFreightDiscounts>
  457.                             <v4:Currency>USD</v4:Currency>
  458.                             <v4:Amount>0.0</v4:Amount>
  459.                         </v4:TotalFreightDiscounts>
  460.                         <v4:TotalNetFreight>
  461.                             <v4:Currency>USD</v4:Currency>
  462.                             <v4:Amount>76.3</v4:Amount>
  463.                         </v4:TotalNetFreight>
  464.                         <v4:TotalSurcharges>
  465.                             <v4:Currency>USD</v4:Currency>
  466.                             <v4:Amount>12.59</v4:Amount>
  467.                         </v4:TotalSurcharges>
  468.                         <v4:TotalNetFedExCharge>
  469.                             <v4:Currency>USD</v4:Currency>
  470.                             <v4:Amount>88.89</v4:Amount>
  471.                         </v4:TotalNetFedExCharge>
  472.                         <v4:TotalTaxes>
  473.                             <v4:Currency>USD</v4:Currency>
  474.                             <v4:Amount>0.0</v4:Amount>
  475.                         </v4:TotalTaxes>
  476.                         <v4:TotalNetCharge>
  477.                             <v4:Currency>USD</v4:Currency>
  478.                             <v4:Amount>88.89</v4:Amount>
  479.                         </v4:TotalNetCharge>
  480.                         <v4:TotalRebates>
  481.                             <v4:Currency>USD</v4:Currency>
  482.                             <v4:Amount>0.0</v4:Amount>
  483.                         </v4:TotalRebates>
  484.                         <v4:Surcharges>
  485.                             <v4:SurchargeType>INSURED_VALUE</v4:SurchargeType>
  486.                             <v4:Description>Insured value</v4:Description>
  487.                             <v4:Amount>
  488.                                 <v4:Currency>USD</v4:Currency>
  489.                                 <v4:Amount>0.0</v4:Amount>
  490.                             </v4:Amount>
  491.                         </v4:Surcharges>
  492.                         <v4:Surcharges>
  493.                             <v4:SurchargeType>FUEL</v4:SurchargeType>
  494.                             <v4:Description>Fuel</v4:Description>
  495.                             <v4:Amount>
  496.                                 <v4:Currency>USD</v4:Currency>
  497.                                 <v4:Amount>12.59</v4:Amount>
  498.                             </v4:Amount>
  499.                         </v4:Surcharges>
  500.                     </v4:ShipmentRateDetail>
  501.                     <v4:RatedPackages>
  502.                         <v4:PackageRateDetail>
  503.                             <v4:RateType>RATED_LIST</v4:RateType>
  504.                             <v4:RatedWeightMethod>DIM</v4:RatedWeightMethod>
  505.                             <v4:BillingWeight>
  506.                                 <v4:Units>LB</v4:Units>
  507.                                 <v4:Value>13.0</v4:Value>
  508.                             </v4:BillingWeight>
  509.                             <v4:DimWeight>
  510.                                 <v4:Units>LB</v4:Units>
  511.                                 <v4:Value>13.0</v4:Value>
  512.                             </v4:DimWeight>
  513.                             <v4:BaseCharge>
  514.                                 <v4:Currency>USD</v4:Currency>
  515.                                 <v4:Amount>76.3</v4:Amount>
  516.                             </v4:BaseCharge>
  517.                             <v4:TotalFreightDiscounts>
  518.                                 <v4:Currency>USD</v4:Currency>
  519.                                 <v4:Amount>0.0</v4:Amount>
  520.                             </v4:TotalFreightDiscounts>
  521.                             <v4:NetFreight>
  522.                                 <v4:Currency>USD</v4:Currency>
  523.                                 <v4:Amount>76.3</v4:Amount>
  524.                             </v4:NetFreight>
  525.                             <v4:TotalSurcharges>
  526.                                 <v4:Currency>USD</v4:Currency>
  527.                                 <v4:Amount>12.59</v4:Amount>
  528.                             </v4:TotalSurcharges>
  529.                             <v4:NetFedExCharge>
  530.                                 <v4:Currency>USD</v4:Currency>
  531.                                 <v4:Amount>88.89</v4:Amount>
  532.                             </v4:NetFedExCharge>
  533.                             <v4:TotalTaxes>
  534.                                 <v4:Currency>USD</v4:Currency>
  535.                                 <v4:Amount>0.0</v4:Amount>
  536.                             </v4:TotalTaxes>
  537.                             <v4:NetCharge>
  538.                                 <v4:Currency>USD</v4:Currency>
  539.                                 <v4:Amount>88.89</v4:Amount>
  540.                             </v4:NetCharge>
  541.                             <v4:TotalRebates>
  542.                                 <v4:Currency>USD</v4:Currency>
  543.                                 <v4:Amount>0.0</v4:Amount>
  544.                             </v4:TotalRebates>
  545.                             <v4:Surcharges>
  546.                                 <v4:SurchargeType>INSURED_VALUE</v4:SurchargeType>
  547.                                 <v4:Description>Insured value</v4:Description>
  548.                                 <v4:Amount>
  549.                                     <v4:Currency>USD</v4:Currency>
  550.                                     <v4:Amount>0.0</v4:Amount>
  551.                                 </v4:Amount>
  552.                             </v4:Surcharges>
  553.                             <v4:Surcharges>
  554.                                 <v4:SurchargeType>FUEL</v4:SurchargeType>
  555.                                 <v4:Description>Fuel</v4:Description>
  556.                                 <v4:Amount>
  557.                                     <v4:Currency>USD</v4:Currency>
  558.                                     <v4:Amount>12.59</v4:Amount>
  559.                                 </v4:Amount>
  560.                             </v4:Surcharges>
  561.                         </v4:PackageRateDetail>
  562.                     </v4:RatedPackages>
  563.                 </v4:RatedShipmentDetails>
  564.             </v4:RateReplyDetails>
  565.         </v4:RateReply>
  566.     </soapenv:Body>
  567. </soapenv:Envelope>
  568.  
but all i want is only the NetCharge value, can u help me on this problem? thanks before
ak1dnar's Avatar
Moderator
 
Join Date: Jan 2007
Location: Colombo
Posts: 1,439
#16: Oct 6 '08

re: FedEx Web Services


Expand|Select|Wrap|Line Numbers
  1. print $response->RatedShipmentDetails->ShipmentRateDetail->TotalNetCharge->Amount;
  2.  
Does it work for you?
Member
 
Join Date: Oct 2008
Posts: 32
#17: Oct 6 '08

re: FedEx Web Services


im sorry ak1dinar it doesnt work, it did not print anything.. is there any other way? thanks for ur help
ak1dnar's Avatar
Moderator
 
Join Date: Jan 2007
Location: Colombo
Posts: 1,439
#18: Oct 6 '08

re: FedEx Web Services


can you please post the code here. make sure to wrap them with code tags too.
[CODE] ...[/CODE]
Member
 
Join Date: Oct 2008
Posts: 32
#19: Oct 6 '08

re: FedEx Web Services


Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. // Copyright 2008, FedEx Corporation. All rights reserved.
  4. // Version 4.0.0
  5.  
  6. require_once('library/fedex-common.php5');
  7.  
  8. $newline = "<br />";
  9. //The WSDL is not included with the sample code.
  10. //Please include and reference in $path_to_wsdl variable.
  11. $path_to_wsdl = "wsdl/RateService_v4.wsdl";
  12.  
  13. ini_set("soap.wsdl_cache_enabled", "0");
  14.  
  15. $client = new SoapClient($path_to_wsdl, array('trace' => 1)); // Refer to http://us3.php.net/manual/en/ref.soap.php for more information
  16.  
  17. $request['WebAuthenticationDetail'] = array('UserCredential' =>
  18.                                       array('Key' => 'jhA1kN6eagkmU9Gc', 'Password' => 'xdjbss94sMPoj2s0f5XDINkvT')); // Replace 'XXX' and 'YYY' with FedEx provided credentials 
  19. $request['ClientDetail'] = array('AccountNumber' => '510087763', 'MeterNumber' => '7001942');// Replace 'XXX' with your account and meter number
  20. $request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Rate Request v4 using PHP ***');
  21. $request['Version'] = array('ServiceId' => 'crs', 'Major' => '4', 'Intermediate' => '0', Minor => '0');
  22. $request['RequestedShipment']['DropoffType'] = 'REGULAR_PICKUP'; // valid values REGULAR_PICKUP, REQUEST_COURIER, ...
  23. $request['RequestedShipment']['ShipTimestamp'] = date('c');
  24. $request['RequestedShipment']['ServiceType'] = 'PRIORITY_OVERNIGHT'; // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
  25. $request['RequestedShipment']['PackagingType'] = 'YOUR_PACKAGING'; // valid values FEDEX_BOK, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
  26. $request['RequestedShipment']['Shipper'] = array('Address' => array(
  27.                                           'StreetLines' => array('10 Fed Ex Pkwy'), // Origin details
  28.                                           'City' => 'Memphis',
  29.                                           'StateOrProvinceCode' => 'TN',
  30.                                           'PostalCode' => '38115',
  31.                                           'CountryCode' => 'US'));
  32. $request['RequestedShipment']['Recipient'] = array('Address' => array (
  33.                                                'StreetLines' => array('13450 Farmcrest Ct'), // Destination details
  34.                                                'City' => 'Herndon',
  35.                                                'StateOrProvinceCode' => 'VA',
  36.                                                'PostalCode' => '20171',
  37.                                                'CountryCode' => 'US'));
  38. $request['RequestedShipment']['ShippingChargesPayment'] = array('PaymentType' => 'SENDER',
  39.                                                         'Payor' => array('AccountNumber' => '510087763', // Replace "XXX" with payor's account number
  40.                                                                      'CountryCode' => 'US'));
  41. $request['RequestedShipment']['RateRequestTypes'] = 'ACCOUNT'; 
  42. $request['RequestedShipment']['RateRequestTypes'] = 'LIST'; 
  43. $request['RequestedShipment']['PackageCount'] = '1';
  44. $request['RequestedShipment']['PackageDetail'] = 'INDIVIDUAL_PACKAGES';
  45. $request['RequestedShipment']['RequestedPackages'] = array('0' => array('SequenceNumber' => '1',
  46.                                                                   'InsuredValue' => array('Amount' => 20.0,
  47.                                                                                           'Currency' => 'USD'),
  48.                                                                   'ItemDescription' => 'College Transcripts',
  49.                                                                   'Weight' => array('Value' => 2.0,
  50.                                                                                     'Units' => 'LB'),
  51.                                                                   'Dimensions' => array('Length' => 25,
  52.                                                                                         'Width' => 10,
  53.                                                                                         'Height' => 10,
  54.                                                                                         'Units' => 'IN'),
  55.                                                                   'CustomerReferences' => array('CustomerReferenceType' => 'CUSTOMER_REFERENCE',
  56.                                                                                                  'Value' => 'Undergraduate application')));
  57.  
  58. try 
  59. {
  60.     $response = $client ->getRates($request);   
  61.     if ($response -> HighestSeverity != 'FAILURE' && $response -> HighestSeverity != 'ERROR')
  62.     {    
  63.         print $response->RatedShipmentDetails->ShipmentRateDetail->TotalNetCharge->Amount;
  64.         printRequestResponse($client);
  65.     }
  66.     else
  67.     {
  68.         echo 'Error in processing transaction.'. $newline. $newline; 
  69.         foreach ($response -> Notifications as $notification)
  70.         {           
  71.             if(is_array($response -> Notifications))
  72.             {              
  73.                echo $notification -> Severity;
  74.                echo ': ';           
  75.                echo $notification -> Message . $newline;
  76.             }
  77.             else
  78.             {
  79.                 echo $notification . $newline;
  80.             }
  81.         } 
  82.     } 
  83.  
  84.     writeToLog($client);    // Write to log file   
  85.  
  86. } catch (SoapFault $exception) {
  87.    printFault($exception, $client);        
  88. }
  89.  
  90. ?>
  91.  
ak1dnar's Avatar
Moderator
 
Join Date: Jan 2007
Location: Colombo
Posts: 1,439
#20: Oct 6 '08

re: FedEx Web Services


Expand|Select|Wrap|Line Numbers
  1. printRequestResponse($client);
are you sure about this line? is there any function available already?

first of we will check whether script executes this block. try this lines.

Expand|Select|Wrap|Line Numbers
  1.   if ($response -> HighestSeverity != 'FAILURE' && $response -> HighestSeverity != 'ERROR')
  2.     {
  3.      //  print $response->RatedShipmentDetails->ShipmentRateDetail->TotalNetCharge->Amount;
  4.       //  printRequestResponse($client);
  5.  
  6. print "process successful";
  7.     }
Can you see "process successful" after executing the script?

if its working tell me are you using php 4 or php 5? because there is try catch block in your code.

and what is the LOG FILE says about the errors?
Member
 
Join Date: Oct 2008
Posts: 32
#21: Oct 6 '08

re: FedEx Web Services


there is no error.

Expand|Select|Wrap|Line Numbers
  1. printRequestResponse($client);
  2.  
the code above works, and i added what u told me to add and is successful also.
im using php5. u have any other solution? thanks for ur help.
pbmods's Avatar
Site Moderator
 
Join Date: Apr 2007
Location: Texas
Posts: 5,435
#22: Oct 6 '08

re: FedEx Web Services


Heya, DBest.

I haven't worked with SOAP in awhile (keep the jokes to a minimum, please), but it looks like the path should be:

Expand|Select|Wrap|Line Numbers
  1. echo $response->RateReply->RateReplyDetails->RatedShipmentDetails->TotalNetCharge->Amount;
  2.  
You can incrementally test this by using var_dump():
Expand|Select|Wrap|Line Numbers
  1. var_dump($response->RateReply); // If you get output, continue to the next level.
  2. var_dump($response->RateReply->RateReplyDetails); // And so on.  If you get a NULL, then you know where you need to fix your path.
  3.  
Member
 
Join Date: Oct 2008
Posts: 32
#23: Oct 7 '08

re: FedEx Web Services


thanks pbmod, but i have tried all the possibilties but it seems the result is always null. i tried your path and it is not printing anything. wow this fedex webservice is hard :( i cant get the right path. can anyone help me?
Member
 
Join Date: Oct 2008
Posts: 32
#24: Oct 7 '08

re: FedEx Web Services


i figure it out guys, thanks so much for your help. u all been great. thanks
pbmods's Avatar
Site Moderator
 
Join Date: Apr 2007
Location: Texas
Posts: 5,435
#25: Oct 9 '08

re: FedEx Web Services


Glad to hear you got it working! What ended up doing the trick?
Member
 
Join Date: Oct 2008
Posts: 32
#26: Oct 9 '08

re: FedEx Web Services


Expand|Select|Wrap|Line Numbers
  1. $rsd = end($response->RateReplyDetails->RatedShipmentDetails);
  2.         printf("%.2d %s<br>\n", $rsd->ShipmentRateDetail->TotalNetFedExCharge->Amount, $rsd->ShipmentRateDetail->TotalNetFedExCharge->Currency);
  3.  
that magic code above, thanks for everyone that help me, :)
Member
 
Join Date: Oct 2008
Posts: 32
#27: Nov 5 '08

re: FedEx Web Services


hai guys, i have another problem, u see iam in Indonesia, and i have to shipped in indonesia, when i change the city or the country it seems to not working. Does fedex only support USA shipping? or am i the one that is wrong?
here is the code :

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. // Copyright 2008, FedEx Corporation. All rights reserved.
  4. // Version 4.0.0
  5.  
  6. require_once('library/fedex-common.php5');
  7.  
  8. $newline = "<br />";
  9. //The WSDL is not included with the sample code.
  10. //Please include and reference in $path_to_wsdl variable.
  11. $path_to_wsdl = "wsdl/RateService_v4.wsdl";
  12.  
  13. ini_set("soap.wsdl_cache_enabled", "0");
  14.  
  15. $client = new SoapClient($path_to_wsdl, array('trace' => 1)); // Refer to http://us3.php.net/manual/en/ref.soap.php for more information
  16.  
  17. $request['WebAuthenticationDetail'] = array('UserCredential' =>
  18.                                       array('Key' => 'jhA1kN6eagkmU9Gc', 'Password' => 'xdjbss94sMPoj2s0f5XDINkvT')); // Replace 'XXX' and 'YYY' with FedEx provided credentials 
  19. $request['ClientDetail'] = array('AccountNumber' => '510087763', 'MeterNumber' => '7001942');// Replace 'XXX' with your account and meter number
  20. $request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Rate Request v4 using PHP ***');
  21. $request['Version'] = array('ServiceId' => 'crs', 'Major' => '4', 'Intermediate' => '0', Minor => '0');
  22. $request['RequestedShipment']['DropoffType'] = 'REGULAR_PICKUP'; // valid values REGULAR_PICKUP, REQUEST_COURIER, ...
  23. $request['RequestedShipment']['ShipTimestamp'] = date('c');
  24. $request['RequestedShipment']['ServiceType'] = 'PRIORITY_OVERNIGHT'; // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
  25. $request['RequestedShipment']['PackagingType'] = 'YOUR_PACKAGING'; // valid values FEDEX_BOK, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
  26. $request['RequestedShipment']['Shipper'] = array('Address' => array(
  27.                                           'StreetLines' => array('10 Fed Ex Pkwy'), // Origin details
  28.                                           'City' => 'Memphis',
  29.                                           'StateOrProvinceCode' => 'TN',
  30.                                           'PostalCode' => '38115',
  31.                                           'CountryCode' => 'US'));
  32. $request['RequestedShipment']['Recipient'] = array('Address' => array (
  33.                                                'StreetLines' => array('13450 Farmcrest Ct'), // Destination details
  34.                                                'City' => 'Herndon',
  35.                                                'StateOrProvinceCode' => 'VA',
  36.                                                'PostalCode' => '20171',
  37.                                                'CountryCode' => 'US'));
  38. $request['RequestedShipment']['ShippingChargesPayment'] = array('PaymentType' => 'SENDER',
  39.                                                         'Payor' => array('AccountNumber' => '510087763', // Replace "XXX" with payor's account number
  40.                                                                      'CountryCode' => 'US'));
  41. $request['RequestedShipment']['RateRequestTypes'] = 'ACCOUNT'; 
  42. $request['RequestedShipment']['RateRequestTypes'] = 'LIST'; 
  43. $request['RequestedShipment']['PackageCount'] = '1';
  44. $request['RequestedShipment']['PackageDetail'] = 'INDIVIDUAL_PACKAGES';
  45. $request['RequestedShipment']['RequestedPackages'] = array('0' => array('SequenceNumber' => '1',
  46.                                                                   'InsuredValue' => array('Amount' => 20.0,
  47.                                                                                           'Currency' => 'USD'),
  48.                                                                   'ItemDescription' => 'DVD or VCD',
  49.                                                                   'Weight' => array('Value' => 2.0,
  50.                                                                                     'Units' => 'LB'),
  51.                                                                   'Dimensions' => array('Length' => 25,
  52.                                                                                         'Width' => 10,
  53.                                                                                         'Height' => 10,
  54.                                                                                         'Units' => 'IN'),
  55.                                                                   'CustomerReferences' => array('CustomerReferenceType' => 'CUSTOMER_REFERENCE',
  56.                                                                                                  'Value' => 'Buying DVD or VCD')));
  57.  
  58. try 
  59. {
  60.     $response = $client ->getRates($request);   
  61.     if ($response -> HighestSeverity != 'FAILURE' && $response -> HighestSeverity != 'ERROR')
  62.     {    
  63.         //print $response->RatedShipmentDetails->ShipmentRateDetail->TotalNetCharge->Amount;
  64.         printRequestResponse($client);
  65.         //print "succesfull";
  66.         //echo $response->RateReply->RateReplyDetails->RatedShipmentDetails->TotalNetCharge->Amount;
  67.         //var_dump($response->RateReplyDetails->RatedShipmentDetails);
  68.         //echo 'break';
  69.         //var_dump($response); // If you get output, continue to the next level.
  70.         /*foreach ($response->RateReplyDetails->RatedShipmentDetails as $n => $rsd) {
  71.         $tnfec = $rsd->ShipmentRateDetail->TotalNetFedExCharge;
  72.         printf("%d: %.2d %s<br>\n", $n + 1, $tnfec->Currency, $tnfec->Amount);
  73.     }*/
  74.     $rsd = end($response->RateReplyDetails->RatedShipmentDetails);
  75.         printf("%.2d %s<br>\n", $rsd->ShipmentRateDetail->TotalNetFedExCharge->Amount, $rsd->ShipmentRateDetail->TotalNetFedExCharge->Currency);
  76.     }
  77.     else
  78.     {
  79.         echo 'Error in processing transaction.'. $newline. $newline; 
  80.         foreach ($response -> Notifications as $notification)
  81.         {           
  82.             if(is_array($response -> Notifications))
  83.             {              
  84.                echo $notification -> Severity;
  85.                echo ': ';           
  86.                echo $notification -> Message . $newline;
  87.             }
  88.             else
  89.             {
  90.                 echo $notification . $newline;
  91.             }
  92.         } 
  93.     } 
  94.  
  95.     writeToLog($client);    // Write to log file   
  96.  
  97. } catch (SoapFault $exception) {
  98.    printFault($exception, $client);        
  99. }
  100.  
  101. ?>
  102.  
Newbie
 
Join Date: Nov 2008
Posts: 1
#28: Nov 5 '08

re: FedEx Web Services


FedEx does not support Intra-Country Shipping outside of US, Canada and Mexico. You can only ship from Indonesia to somewhere outside of Indonesia.

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

Quote:

Originally Posted by dbest5250

hai guys, i have another problem, u see iam in Indonesia, and i have to shipped in indonesia, when i change the city or the country it seems to not working. Does fedex only support USA shipping? or am i the one that is wrong?
here is the code :

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. // Copyright 2008, FedEx Corporation. All rights reserved.
  4. // Version 4.0.0
  5.  
  6. require_once('library/fedex-common.php5');
  7.  
  8. $newline = "<br />";
  9. //The WSDL is not included with the sample code.
  10. //Please include and reference in $path_to_wsdl variable.
  11. $path_to_wsdl = "wsdl/RateService_v4.wsdl";
  12.  
  13. ini_set("soap.wsdl_cache_enabled", "0");
  14.  
  15. $client = new SoapClient($path_to_wsdl, array('trace' => 1)); // Refer to http://us3.php.net/manual/en/ref.soap.php for more information
  16.  
  17. $request['WebAuthenticationDetail'] = array('UserCredential' =>
  18.                                       array('Key' => 'jhA1kN6eagkmU9Gc', 'Password' => 'xdjbss94sMPoj2s0f5XDINkvT')); // Replace 'XXX' and 'YYY' with FedEx provided credentials 
  19. $request['ClientDetail'] = array('AccountNumber' => '510087763', 'MeterNumber' => '7001942');// Replace 'XXX' with your account and meter number
  20. $request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Rate Request v4 using PHP ***');
  21. $request['Version'] = array('ServiceId' => 'crs', 'Major' => '4', 'Intermediate' => '0', Minor => '0');
  22. $request['RequestedShipment']['DropoffType'] = 'REGULAR_PICKUP'; // valid values REGULAR_PICKUP, REQUEST_COURIER, ...
  23. $request['RequestedShipment']['ShipTimestamp'] = date('c');
  24. $request['RequestedShipment']['ServiceType'] = 'PRIORITY_OVERNIGHT'; // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
  25. $request['RequestedShipment']['PackagingType'] = 'YOUR_PACKAGING'; // valid values FEDEX_BOK, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
  26. $request['RequestedShipment']['Shipper'] = array('Address' => array(
  27.                                           'StreetLines' => array('10 Fed Ex Pkwy'), // Origin details
  28.                                           'City' => 'Memphis',
  29.                                           'StateOrProvinceCode' => 'TN',
  30.                                           'PostalCode' => '38115',
  31.                                           'CountryCode' => 'US'));
  32. $request['RequestedShipment']['Recipient'] = array('Address' => array (
  33.                                                'StreetLines' => array('13450 Farmcrest Ct'), // Destination details
  34.                                                'City' => 'Herndon',
  35.                                                'StateOrProvinceCode' => 'VA',
  36.                                                'PostalCode' => '20171',
  37.                                                'CountryCode' => 'US'));
  38. $request['RequestedShipment']['ShippingChargesPayment'] = array('PaymentType' => 'SENDER',
  39.                                                         'Payor' => array('AccountNumber' => '510087763', // Replace "XXX" with payor's account number
  40.                                                                      'CountryCode' => 'US'));
  41. $request['RequestedShipment']['RateRequestTypes'] = 'ACCOUNT'; 
  42. $request['RequestedShipment']['RateRequestTypes'] = 'LIST'; 
  43. $request['RequestedShipment']['PackageCount'] = '1';
  44. $request['RequestedShipment']['PackageDetail'] = 'INDIVIDUAL_PACKAGES';
  45. $request['RequestedShipment']['RequestedPackages'] = array('0' => array('SequenceNumber' => '1',
  46.                                                                   'InsuredValue' => array('Amount' => 20.0,
  47.                                                                                           'Currency' => 'USD'),
  48.                                                                   'ItemDescription' => 'DVD or VCD',
  49.                                                                   'Weight' => array('Value' => 2.0,
  50.                                                                                     'Units' => 'LB'),
  51.                                                                   'Dimensions' => array('Length' => 25,
  52.                                                                                         'Width' => 10,
  53.                                                                                         'Height' => 10,
  54.                                                                                         'Units' => 'IN'),
  55.                                                                   'CustomerReferences' => array('CustomerReferenceType' => 'CUSTOMER_REFERENCE',
  56.                                                                                                  'Value' => 'Buying DVD or VCD')));
  57.  
  58. try 
  59. {
  60.     $response = $client ->getRates($request);   
  61.     if ($response -> HighestSeverity != 'FAILURE' && $response -> HighestSeverity != 'ERROR')
  62.     {    
  63.         //print $response->RatedShipmentDetails->ShipmentRateDetail->TotalNetCharge->Amount;
  64.         printRequestResponse($client);
  65.         //print "succesfull";
  66.         //echo $response->RateReply->RateReplyDetails->RatedShipmentDetails->TotalNetCharge->Amount;
  67.         //var_dump($response->RateReplyDetails->RatedShipmentDetails);
  68.         //echo 'break';
  69.         //var_dump($response); // If you get output, continue to the next level.
  70.         /*foreach ($response->RateReplyDetails->RatedShipmentDetails as $n => $rsd) {
  71.         $tnfec = $rsd->ShipmentRateDetail->TotalNetFedExCharge;
  72.         printf("%d: %.2d %s<br>\n", $n + 1, $tnfec->Currency, $tnfec->Amount);
  73.     }*/
  74.     $rsd = end($response->RateReplyDetails->RatedShipmentDetails);
  75.         printf("%.2d %s<br>\n", $rsd->ShipmentRateDetail->TotalNetFedExCharge->Amount, $rsd->ShipmentRateDetail->TotalNetFedExCharge->Currency);
  76.     }
  77.     else
  78.     {
  79.         echo 'Error in processing transaction.'. $newline. $newline; 
  80.         foreach ($response -> Notifications as $notification)
  81.         {           
  82.             if(is_array($response -> Notifications))
  83.             {              
  84.                echo $notification -> Severity;
  85.                echo ': ';           
  86.                echo $notification -> Message . $newline;
  87.             }
  88.             else
  89.             {
  90.                 echo $notification . $newline;
  91.             }
  92.         } 
  93.     } 
  94.  
  95.     writeToLog($client);    // Write to log file   
  96.  
  97. } catch (SoapFault $exception) {
  98.    printFault($exception, $client);        
  99. }
  100.  
  101. ?>
  102.  

Member
 
Join Date: Oct 2008
Posts: 32
#29: Nov 7 '08

re: FedEx Web Services


really? so that means i can't use this web service in indonesia? :( is there any soap web service that i can use in indonesia?
Newbie
 
Join Date: Jul 2009
Posts: 2
#30: Jul 11 '09

re: FedEx Web Services


Hi,
I tried above solution but I am getting this errors.
Warning: end() [function.end]: Passed variable is not an array or object.
Any help will be appreciated.
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,639
#31: Jul 12 '09

re: FedEx Web Services


you could do a var_dump() on the variable and see what data type it is. though you still need to feed a variable of an array or object data type to the function/method.
Newbie
 
Join Date: Jul 2009
Posts: 2
#32: Jul 12 '09

re: FedEx Web Services


Found the problem.
Dormilich you are a gem.
Thanks for pointing me in right direction.
Reply