473,378 Members | 1,319 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

FedEx Web Services

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.  
Aug 31 '07 #1
31 15305
ak1dnar
1,584 Expert 1GB
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.


Aug 31 '07 #2
ak1dnar
1,584 Expert 1GB
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?
Aug 31 '07 #3
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]
Aug 31 '07 #4
ak1dnar
1,584 Expert 1GB
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.
Aug 31 '07 #5
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
Sep 10 '07 #6
Thanks ajaxrand....

It works now...i 've specified the whole url of wsdl file with...
and its working...
Sep 12 '07 #7
ak1dnar
1,584 Expert 1GB
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.
Sep 12 '07 #8
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
Oct 3 '08 #9
ak1dnar
1,584 Expert 1GB
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");
Oct 3 '08 #10
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 ^^
Oct 5 '08 #11
ak1dnar
1,584 Expert 1GB
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.
Oct 5 '08 #12
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 :(
Oct 5 '08 #13
ak1dnar
1,584 Expert 1GB
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.
Oct 5 '08 #14
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
Oct 6 '08 #15
ak1dnar
1,584 Expert 1GB
Expand|Select|Wrap|Line Numbers
  1. print $response->RatedShipmentDetails->ShipmentRateDetail->TotalNetCharge->Amount;
  2.  
Does it work for you?
Oct 6 '08 #16
im sorry ak1dinar it doesnt work, it did not print anything.. is there any other way? thanks for ur help
Oct 6 '08 #17
ak1dnar
1,584 Expert 1GB
can you please post the code here. make sure to wrap them with code tags too.
[CODE] ...[/CODE]
Oct 6 '08 #18
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.  
Oct 6 '08 #19
ak1dnar
1,584 Expert 1GB
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?
Oct 6 '08 #20
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.
Oct 6 '08 #21
pbmods
5,821 Expert 4TB
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.  
Oct 6 '08 #22
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?
Oct 7 '08 #23
i figure it out guys, thanks so much for your help. u all been great. thanks
Oct 7 '08 #24
pbmods
5,821 Expert 4TB
Glad to hear you got it working! What ended up doing the trick?
Oct 9 '08 #25
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, :)
Oct 9 '08 #26
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.  
Nov 5 '08 #27
tgk4
2
FedEx does not support Intra-Country Shipping outside of US, Canada and Mexico. You can only ship from Indonesia to somewhere outside of Indonesia.

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

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.  
Nov 5 '08 #28
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?
Nov 7 '08 #29
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.
Jul 11 '09 #30
Dormilich
8,658 Expert Mod 8TB
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.
Jul 12 '09 #31
Found the problem.
Dormilich you are a gem.
Thanks for pointing me in right direction.
Jul 12 '09 #32

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Gabriel Cooper | last post by:
I've made UPS and FedEx shipping rate request modules in python using XML. Is there an interest in putting this on the web?
1
by: someone | last post by:
Does anyone have any experience integrating with FedEx via C# and ASP.NET? I am really frustrated with the lack of help from FedEx. Their example ASP.NET code consists of an empty form and a C#...
1
by: Logan | last post by:
I am trying to implement talk directly to the fedex servers so i can use there online services. I need to first establish an SSL connection then send some information to the fedex servers and wait...
1
by: DeanL | last post by:
Hi all, This is probably not the group for this but I'm not sure quite where else to go. Does anyone know where to find the barcode standards for FedEx shipments of all types of shipping they...
3
by: injanib via AccessMonster.com | last post by:
Does anyone know what kind of codes Fedex uses for its barcodes and how it is translated into the tracking number. I have a database to I use to log incoming packages. I am able to scan any other...
13
by: Jennysaur | last post by:
Hi Everyone, I'm new to PHP, and completely new to this website. I'm having a problem getting the PHP FedEx Web services software to work, and it seems overly complicated. I just need a simple...
2
by: ddieckmann | last post by:
I am writing an application that will use the FedEx Web Services to validate addresses and determine what services are available for an address. I have downloaded the sample code and WSDL files...
3
by: massrex | last post by:
Sorry if I write here...... Do You know if and eventually where can I find a Visual Basic 6.0 sample about how to interact with Fedex web-services via SOAP? Thanks you very much in advance.
3
by: supperham | last post by:
hi: can sone one tell me how to use fedex web service in php to calculate shipping fee? i already have fedex account and 4 keys used to test application Test...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.