Home ยป Php ยป FedEx Web Services – PHP

FedEx Web Services – PHP

Posted by: admin February 22, 2020 Leave a comment

Q(Question):

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…


<?php
// Copyright 2007, FedEx Corporation. All rights reserved.
chdir('..');
require_once('library/fedex-common.php5');
$newline = "<br />";
ini_set("soap.wsdl_cache_enabled", "1");
$client = new SoapClient("wsdl/RateService.wsdl"); // replace with valid path to WSDL
$request['AuthenticationDetail'] = array('UserCredential' => '2I7km2NKzbb83tpB'); // Replace 'XXX' with FedEx provided user credential
$request['ClientDetail'] = array('AccountNumber' => '510087461', 'MeterNumber' => '1193980');// Replace 'XXX' with your account and meter number
$request['TransactionDetail'] = array('CustomerTransactionId' => '1193980');
$request['Version'] = array('Major' => '1', 'Intermediate' => '1', 'Minor' => '0');
$request['Origin'] = array('StreetLines' => array('Sender Address Line 1'), // Origin details
'City' => 'Sender City',
'StateOrProvinceCode' => 'TN',
'PostalCode' => '38115',
'CountryCode' => 'US');
$request['Destination'] = array('StreetLines' => array('Destination Address Line 1'), // Destination details
'City' => 'Recipient City',
'StateOrProvinceCode' => 'PQ',
'PostalCode' => 'H1E1A1',
'CountryCode' => 'CA');
$request['Payment'] = array('PaymentType' => 'SENDER'); // valid codes RECIPIENT, SENDER and THIRD_PARTY
$request['DropoffType'] = 'REGULAR_PICKUP'; // valid codes BUSINESS_SERVICE_CENTER, DROP_BOX, REGULAR_PICKUP, REQUEST_COURIER and STATION
$request['ServiceType'] = 'INTERNATIONAL_PRIORITY'; // valid codes STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
$request['PackagingType'] = 'YOUR_PACKAGING'; // valid codes FEDEX_BOK, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
$request['ShipDate'] = date('Y-m-d');
$request['RateRequestTypes'] = 'ACCOUNT'; // valid codes ACCOUNT, LIST
$PassRateRequestPackageSummary = true;
if ($PassRateRequestPackageSummary)
{
// Passing multi piece shipment rate request (by setting PieceCount > 1)
$request['RateRequestPackageSummary'] = array('TotalWeight' => array('Value' => 20.0, 'Units' => 'LB'), // valid codes LB and KG
'TotalInsuredValue' => array('Amount' => 100, 'Currency' => 'USD'),
'PieceCount' => 2,
'SpecialServicesRequested' => array('SpecialServiceTypes' => 'COD', // valid codes COD, HOLD_AT_LOCATION, ...
'CodDetail' =>
array ('CollectionAmount' => array( 'Currency' => 'USD', 'Amount' => '25.98'),
'CollectionType' => 'CASH')));
}
else
{
// Passing single piece shipment rate request
$request['PackageCount'] = 1; // currently only one occurrence of RequestedPackage is supported
$request['Packages'] = array(0 => array('Weight' => array('Value' => 10.0, 'Units' => 'LB'), // valid code LB and KG
'InsuredValue' => array('Amount' => 100, 'Currency' => 'USD'),
'Dimensions' => array('Length' => '1', 'Width' => '1', 'Height' => '1', 'Units' => 'IN'), // valid code IN and CM
'SpecialServicesRequested' => array('SpecialServiceTypes' => 'COD', // valid codes COD, HOLD_AT_LOCATION, ...
'CodDetail' =>
array ('CollectionAmount' => array( 'Currency' => 'USD', 'Amount' => '25.98'),
'CollectionType' => 'CASH'))));
}
try
{
$response = $client ->__soapCall("getRate", array('parameters' => $request));
if ($response -> HighestSeverity != 'FAILURE' && $response -> HighestSeverity != 'ERROR')
{
printRequestResponse($client);
}
else
{
echo 'Error in processing transaction.'. $newline. $newline;
foreach ($response -> Notifications as $notification)
{
echo $notification . $newline;
}
}
writeToLog($client); // Write to log file
} catch (SoapFault $exception) {
printFault($exception, $client);
}
?>

A(Answer):

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.

A(Answer):

new SoapClient("wsdl/RateService.wsdl");

How about checking your directory structure again.

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

Is It like this?

A(Answer):

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]

A(Answer):

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.

A(Answer):

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

A(Answer):

Thanks ajaxrand….

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

A(Answer):

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.

A(Answer):

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

A(Answer):

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

$client = new SoapClient("wsdl/RateService.wsdl");

please specify the absolute path

$client = new SoapClient("http://domain_name/dir_path/RateService.wsdl");

A(Answer):

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 ^^

A(Answer):

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.

A(Answer):

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 ๐Ÿ™

A(Answer):

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.

A(Answer):

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


<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<soapenv:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<v4:RateReply xmlns:rate="http://fedex.com/ws/rate/v5" xmlns:v4="http://fedex.com/ws/rate/v4">
<v4:HighestSeverity>NOTE</v4:HighestSeverity>
<v4:Notifications>
<v4:Severity>NOTE</v4:Severity>
<v4:Source>crs</v4:Source>
<v4:Code>834</v4:Code>
<v4:Message>Deliver Weekday was assumed. </v4:Message>
<v4:LocalizedMessage>Deliver Weekday was assumed. </v4:LocalizedMessage>
</v4:Notifications>
<v4:Notifications>
<v4:Severity>SUCCESS</v4:Severity>
<v4:Source>crs</v4:Source>
<v4:Code>0</v4:Code>
<v4:Message>Request was successfully processed. </v4:Message>
<v4:LocalizedMessage>Request was successfully processed. </v4:LocalizedMessage>
</v4:Notifications>
<ns1:TransactionDetail xmlns:ns1="http://fedex.com/ws/rate/v4" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<ns1:CustomerTransactionId> *** Rate Request v4 using PHP ***</ns1:CustomerTransactionId>
</ns1:TransactionDetail>
<ns1:Version xmlns:ns1="http://fedex.com/ws/rate/v4" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<ns1:ServiceId>crs</ns1:ServiceId>
<ns1:Major>4</ns1:Major>
<ns1:Intermediate>0</ns1:Intermediate>
<ns1:Minor>0</ns1:Minor>
</ns1:Version>
<v4:RateReplyDetails>
<v4:ServiceType>PRIORITY_OVERNIGHT</v4:ServiceType>
<v4:PackagingType>YOUR_PACKAGING</v4:PackagingType>
<v4:IneligibleForMoneyBackGuarantee>false</v4:IneligibleForMoneyBackGuarantee>
<v4:OriginServiceArea>A1</v4:OriginServiceArea>
<v4:DestinationServiceArea>A1</v4:DestinationServiceArea>
<v4:SignatureOption>SERVICE_DEFAULT</v4:SignatureOption>
<v4:ActualRateType>PAYOR_ACCOUNT</v4:ActualRateType>
<v4:RatedShipmentDetails>
<v4:EffectiveNetDiscount>
<v4:Currency>USD</v4:Currency>
<v4:Amount>28.02</v4:Amount>
</v4:EffectiveNetDiscount>
<v4:ShipmentRateDetail>
<v4:RateType>PAYOR_ACCOUNT</v4:RateType>
<v4:RateScale>1</v4:RateScale>
<v4:PricingCode>PACKAGE</v4:PricingCode>
<v4:DimDivisor>194</v4:DimDivisor>
<v4:FuelSurchargePercent>16.5</v4:FuelSurchargePercent>
<v4:TotalBillingWeight>
<v4:Units>LB</v4:Units>
<v4:Value>13.0</v4:Value>
</v4:TotalBillingWeight>
<v4:TotalDimWeight>
<v4:Units>LB</v4:Units>
<v4:Value>13.0</v4:Value>
</v4:TotalDimWeight>
<v4:TotalBaseCharge>
<v4:Currency>USD</v4:Currency>
<v4:Amount>52.25</v4:Amount>
</v4:TotalBaseCharge>
<v4:TotalFreightDiscounts>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:TotalFreightDiscounts>
<v4:TotalNetFreight>
<v4:Currency>USD</v4:Currency>
<v4:Amount>52.25</v4:Amount>
</v4:TotalNetFreight>
<v4:TotalSurcharges>
<v4:Currency>USD</v4:Currency>
<v4:Amount>8.62</v4:Amount>
</v4:TotalSurcharges>
<v4:TotalNetFedExCharge>
<v4:Currency>USD</v4:Currency>
<v4:Amount>60.87</v4:Amount>
</v4:TotalNetFedExCharge>
<v4:TotalTaxes>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:TotalTaxes>
<v4:TotalNetCharge>
<v4:Currency>USD</v4:Currency>
<v4:Amount>60.87</v4:Amount>
</v4:TotalNetCharge>
<v4:TotalRebates>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:TotalRebates>
<v4:Surcharges>
<v4:SurchargeType>INSURED_VALUE</v4:SurchargeType>
<v4:Description>Insured value</v4:Description>
<v4:Amount>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:Amount>
</v4:Surcharges>
<v4:Surcharges>
<v4:SurchargeType>FUEL</v4:SurchargeType>
<v4:Description>Fuel</v4:Description>
<v4:Amount>
<v4:Currency>USD</v4:Currency>
<v4:Amount>8.62</v4:Amount>
</v4:Amount>
</v4:Surcharges>
</v4:ShipmentRateDetail>
<v4:RatedPackages>
<v4:EffectiveNetDiscount>
<v4:Currency>USD</v4:Currency>
<v4:Amount>28.02</v4:Amount>
</v4:EffectiveNetDiscount>
<v4:PackageRateDetail>
<v4:RateType>PAYOR_ACCOUNT</v4:RateType>
<v4:RatedWeightMethod>DIM</v4:RatedWeightMethod>
<v4:BillingWeight>
<v4:Units>LB</v4:Units>
<v4:Value>13.0</v4:Value>
</v4:BillingWeight>
<v4:DimWeight>
<v4:Units>LB</v4:Units>
<v4:Value>13.0</v4:Value>
</v4:DimWeight>
<v4:BaseCharge>
<v4:Currency>USD</v4:Currency>
<v4:Amount>52.25</v4:Amount>
</v4:BaseCharge>
<v4:TotalFreightDiscounts>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:TotalFreightDiscounts>
<v4:NetFreight>
<v4:Currency>USD</v4:Currency>
<v4:Amount>52.25</v4:Amount>
</v4:NetFreight>
<v4:TotalSurcharges>
<v4:Currency>USD</v4:Currency>
<v4:Amount>8.62</v4:Amount>
</v4:TotalSurcharges>
<v4:NetFedExCharge>
<v4:Currency>USD</v4:Currency>
<v4:Amount>60.87</v4:Amount>
</v4:NetFedExCharge>
<v4:TotalTaxes>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:TotalTaxes>
<v4:NetCharge>
<v4:Currency>USD</v4:Currency>
<v4:Amount>60.87</v4:Amount>
</v4:NetCharge>
<v4:TotalRebates>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:TotalRebates>
<v4:Surcharges>
<v4:SurchargeType>INSURED_VALUE</v4:SurchargeType>
<v4:Description>Insured value</v4:Description>
<v4:Amount>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:Amount>
</v4:Surcharges>
<v4:Surcharges>
<v4:SurchargeType>FUEL</v4:SurchargeType>
<v4:Description>Fuel</v4:Description>
<v4:Amount>
<v4:Currency>USD</v4:Currency>
<v4:Amount>8.62</v4:Amount>
</v4:Amount>
</v4:Surcharges>
</v4:PackageRateDetail>
</v4:RatedPackages>
</v4:RatedShipmentDetails>
<v4:RatedShipmentDetails>
<v4:EffectiveNetDiscount>
<v4:Currency>USD</v4:Currency>
<v4:Amount>28.02</v4:Amount>
</v4:EffectiveNetDiscount>
<v4:ShipmentRateDetail>
<v4:RateType>RATED_ACCOUNT</v4:RateType>
<v4:RateScale>1</v4:RateScale>
<v4:PricingCode>PACKAGE</v4:PricingCode>
<v4:DimDivisor>194</v4:DimDivisor>
<v4:FuelSurchargePercent>16.5</v4:FuelSurchargePercent>
<v4:TotalBillingWeight>
<v4:Units>LB</v4:Units>
<v4:Value>13.0</v4:Value>
</v4:TotalBillingWeight>
<v4:TotalDimWeight>
<v4:Units>LB</v4:Units>
<v4:Value>13.0</v4:Value>
</v4:TotalDimWeight>
<v4:TotalBaseCharge>
<v4:Currency>USD</v4:Currency>
<v4:Amount>52.25</v4:Amount>
</v4:TotalBaseCharge>
<v4:TotalFreightDiscounts>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:TotalFreightDiscounts>
<v4:TotalNetFreight>
<v4:Currency>USD</v4:Currency>
<v4:Amount>52.25</v4:Amount>
</v4:TotalNetFreight>
<v4:TotalSurcharges>
<v4:Currency>USD</v4:Currency>
<v4:Amount>8.62</v4:Amount>
</v4:TotalSurcharges>
<v4:TotalNetFedExCharge>
<v4:Currency>USD</v4:Currency>
<v4:Amount>60.87</v4:Amount>
</v4:TotalNetFedExCharge>
<v4:TotalTaxes>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:TotalTaxes>
<v4:TotalNetCharge>
<v4:Currency>USD</v4:Currency>
<v4:Amount>60.87</v4:Amount>
</v4:TotalNetCharge>
<v4:TotalRebates>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:TotalRebates>
<v4:Surcharges>
<v4:SurchargeType>INSURED_VALUE</v4:SurchargeType>
<v4:Description>Insured value</v4:Description>
<v4:Amount>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:Amount>
</v4:Surcharges>
<v4:Surcharges>
<v4:SurchargeType>FUEL</v4:SurchargeType>
<v4:Description>Fuel</v4:Description>
<v4:Amount>
<v4:Currency>USD</v4:Currency>
<v4:Amount>8.62</v4:Amount>
</v4:Amount>
</v4:Surcharges>
</v4:ShipmentRateDetail>
<v4:RatedPackages>
<v4:EffectiveNetDiscount>
<v4:Currency>USD</v4:Currency>
<v4:Amount>28.02</v4:Amount>
</v4:EffectiveNetDiscount>
<v4:PackageRateDetail>
<v4:RateType>RATED_ACCOUNT</v4:RateType>
<v4:RatedWeightMethod>DIM</v4:RatedWeightMethod>
<v4:BillingWeight>
<v4:Units>LB</v4:Units>
<v4:Value>13.0</v4:Value>
</v4:BillingWeight>
<v4:DimWeight>
<v4:Units>LB</v4:Units>
<v4:Value>13.0</v4:Value>
</v4:DimWeight>
<v4:BaseCharge>
<v4:Currency>USD</v4:Currency>
<v4:Amount>52.25</v4:Amount>
</v4:BaseCharge>
<v4:TotalFreightDiscounts>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:TotalFreightDiscounts>
<v4:NetFreight>
<v4:Currency>USD</v4:Currency>
<v4:Amount>52.25</v4:Amount>
</v4:NetFreight>
<v4:TotalSurcharges>
<v4:Currency>USD</v4:Currency>
<v4:Amount>8.62</v4:Amount>
</v4:TotalSurcharges>
<v4:NetFedExCharge>
<v4:Currency>USD</v4:Currency>
<v4:Amount>60.87</v4:Amount>
</v4:NetFedExCharge>
<v4:TotalTaxes>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:TotalTaxes>
<v4:NetCharge>
<v4:Currency>USD</v4:Currency>
<v4:Amount>60.87</v4:Amount>
</v4:NetCharge>
<v4:TotalRebates>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:TotalRebates>
<v4:Surcharges>
<v4:SurchargeType>INSURED_VALUE</v4:SurchargeType>
<v4:Description>Insured value</v4:Description>
<v4:Amount>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:Amount>
</v4:Surcharges>
<v4:Surcharges>
<v4:SurchargeType>FUEL</v4:SurchargeType>
<v4:Description>Fuel</v4:Description>
<v4:Amount>
<v4:Currency>USD</v4:Currency>
<v4:Amount>8.62</v4:Amount>
</v4:Amount>
</v4:Surcharges>
</v4:PackageRateDetail>
</v4:RatedPackages>
</v4:RatedShipmentDetails>
<v4:RatedShipmentDetails>
<v4:ShipmentRateDetail>
<v4:RateType>PAYOR_LIST</v4:RateType>
<v4:RateScale>1552</v4:RateScale>
<v4:RateZone>5</v4:RateZone>
<v4:PricingCode>PACKAGE</v4:PricingCode>
<v4:DimDivisor>194</v4:DimDivisor>
<v4:FuelSurchargePercent>16.5</v4:FuelSurchargePercent>
<v4:TotalBillingWeight>
<v4:Units>LB</v4:Units>
<v4:Value>13.0</v4:Value>
</v4:TotalBillingWeight>
<v4:TotalDimWeight>
<v4:Units>LB</v4:Units>
<v4:Value>13.0</v4:Value>
</v4:TotalDimWeight>
<v4:TotalBaseCharge>
<v4:Currency>USD</v4:Currency>
<v4:Amount>76.3</v4:Amount>
</v4:TotalBaseCharge>
<v4:TotalFreightDiscounts>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:TotalFreightDiscounts>
<v4:TotalNetFreight>
<v4:Currency>USD</v4:Currency>
<v4:Amount>76.3</v4:Amount>
</v4:TotalNetFreight>
<v4:TotalSurcharges>
<v4:Currency>USD</v4:Currency>
<v4:Amount>12.59</v4:Amount>
</v4:TotalSurcharges>
<v4:TotalNetFedExCharge>
<v4:Currency>USD</v4:Currency>
<v4:Amount>88.89</v4:Amount>
</v4:TotalNetFedExCharge>
<v4:TotalTaxes>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:TotalTaxes>
<v4:TotalNetCharge>
<v4:Currency>USD</v4:Currency>
<v4:Amount>88.89</v4:Amount>
</v4:TotalNetCharge>
<v4:TotalRebates>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:TotalRebates>
<v4:Surcharges>
<v4:SurchargeType>INSURED_VALUE</v4:SurchargeType>
<v4:Description>Insured value</v4:Description>
<v4:Amount>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:Amount>
</v4:Surcharges>
<v4:Surcharges>
<v4:SurchargeType>FUEL</v4:SurchargeType>
<v4:Description>Fuel</v4:Description>
<v4:Amount>
<v4:Currency>USD</v4:Currency>
<v4:Amount>12.59</v4:Amount>
</v4:Amount>
</v4:Surcharges>
</v4:ShipmentRateDetail>
<v4:RatedPackages>
<v4:PackageRateDetail>
<v4:RateType>PAYOR_LIST</v4:RateType>
<v4:RatedWeightMethod>DIM</v4:RatedWeightMethod>
<v4:BillingWeight>
<v4:Units>LB</v4:Units>
<v4:Value>13.0</v4:Value>
</v4:BillingWeight>
<v4:DimWeight>
<v4:Units>LB</v4:Units>
<v4:Value>13.0</v4:Value>
</v4:DimWeight>
<v4:BaseCharge>
<v4:Currency>USD</v4:Currency>
<v4:Amount>76.3</v4:Amount>
</v4:BaseCharge>
<v4:TotalFreightDiscounts>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:TotalFreightDiscounts>
<v4:NetFreight>
<v4:Currency>USD</v4:Currency>
<v4:Amount>76.3</v4:Amount>
</v4:NetFreight>
<v4:TotalSurcharges>
<v4:Currency>USD</v4:Currency>
<v4:Amount>12.59</v4:Amount>
</v4:TotalSurcharges>
<v4:NetFedExCharge>
<v4:Currency>USD</v4:Currency>
<v4:Amount>88.89</v4:Amount>
</v4:NetFedExCharge>
<v4:TotalTaxes>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:TotalTaxes>
<v4:NetCharge>
<v4:Currency>USD</v4:Currency>
<v4:Amount>88.89</v4:Amount>
</v4:NetCharge>
<v4:TotalRebates>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:TotalRebates>
<v4:Surcharges>
<v4:SurchargeType>INSURED_VALUE</v4:SurchargeType>
<v4:Description>Insured value</v4:Description>
<v4:Amount>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:Amount>
</v4:Surcharges>
<v4:Surcharges>
<v4:SurchargeType>FUEL</v4:SurchargeType>
<v4:Description>Fuel</v4:Description>
<v4:Amount>
<v4:Currency>USD</v4:Currency>
<v4:Amount>12.59</v4:Amount>
</v4:Amount>
</v4:Surcharges>
</v4:PackageRateDetail>
</v4:RatedPackages>
</v4:RatedShipmentDetails>
<v4:RatedShipmentDetails>
<v4:ShipmentRateDetail>
<v4:RateType>RATED_LIST</v4:RateType>
<v4:RateScale>1552</v4:RateScale>
<v4:RateZone>5</v4:RateZone>
<v4:PricingCode>PACKAGE</v4:PricingCode>
<v4:DimDivisor>194</v4:DimDivisor>
<v4:FuelSurchargePercent>16.5</v4:FuelSurchargePercent>
<v4:TotalBillingWeight>
<v4:Units>LB</v4:Units>
<v4:Value>13.0</v4:Value>
</v4:TotalBillingWeight>
<v4:TotalDimWeight>
<v4:Units>LB</v4:Units>
<v4:Value>13.0</v4:Value>
</v4:TotalDimWeight>
<v4:TotalBaseCharge>
<v4:Currency>USD</v4:Currency>
<v4:Amount>76.3</v4:Amount>
</v4:TotalBaseCharge>
<v4:TotalFreightDiscounts>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:TotalFreightDiscounts>
<v4:TotalNetFreight>
<v4:Currency>USD</v4:Currency>
<v4:Amount>76.3</v4:Amount>
</v4:TotalNetFreight>
<v4:TotalSurcharges>
<v4:Currency>USD</v4:Currency>
<v4:Amount>12.59</v4:Amount>
</v4:TotalSurcharges>
<v4:TotalNetFedExCharge>
<v4:Currency>USD</v4:Currency>
<v4:Amount>88.89</v4:Amount>
</v4:TotalNetFedExCharge>
<v4:TotalTaxes>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:TotalTaxes>
<v4:TotalNetCharge>
<v4:Currency>USD</v4:Currency>
<v4:Amount>88.89</v4:Amount>
</v4:TotalNetCharge>
<v4:TotalRebates>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:TotalRebates>
<v4:Surcharges>
<v4:SurchargeType>INSURED_VALUE</v4:SurchargeType>
<v4:Description>Insured value</v4:Description>
<v4:Amount>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:Amount>
</v4:Surcharges>
<v4:Surcharges>
<v4:SurchargeType>FUEL</v4:SurchargeType>
<v4:Description>Fuel</v4:Description>
<v4:Amount>
<v4:Currency>USD</v4:Currency>
<v4:Amount>12.59</v4:Amount>
</v4:Amount>
</v4:Surcharges>
</v4:ShipmentRateDetail>
<v4:RatedPackages>
<v4:PackageRateDetail>
<v4:RateType>RATED_LIST</v4:RateType>
<v4:RatedWeightMethod>DIM</v4:RatedWeightMethod>
<v4:BillingWeight>
<v4:Units>LB</v4:Units>
<v4:Value>13.0</v4:Value>
</v4:BillingWeight>
<v4:DimWeight>
<v4:Units>LB</v4:Units>
<v4:Value>13.0</v4:Value>
</v4:DimWeight>
<v4:BaseCharge>
<v4:Currency>USD</v4:Currency>
<v4:Amount>76.3</v4:Amount>
</v4:BaseCharge>
<v4:TotalFreightDiscounts>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:TotalFreightDiscounts>
<v4:NetFreight>
<v4:Currency>USD</v4:Currency>
<v4:Amount>76.3</v4:Amount>
</v4:NetFreight>
<v4:TotalSurcharges>
<v4:Currency>USD</v4:Currency>
<v4:Amount>12.59</v4:Amount>
</v4:TotalSurcharges>
<v4:NetFedExCharge>
<v4:Currency>USD</v4:Currency>
<v4:Amount>88.89</v4:Amount>
</v4:NetFedExCharge>
<v4:TotalTaxes>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:TotalTaxes>
<v4:NetCharge>
<v4:Currency>USD</v4:Currency>
<v4:Amount>88.89</v4:Amount>
</v4:NetCharge>
<v4:TotalRebates>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:TotalRebates>
<v4:Surcharges>
<v4:SurchargeType>INSURED_VALUE</v4:SurchargeType>
<v4:Description>Insured value</v4:Description>
<v4:Amount>
<v4:Currency>USD</v4:Currency>
<v4:Amount>0.0</v4:Amount>
</v4:Amount>
</v4:Surcharges>
<v4:Surcharges>
<v4:SurchargeType>FUEL</v4:SurchargeType>
<v4:Description>Fuel</v4:Description>
<v4:Amount>
<v4:Currency>USD</v4:Currency>
<v4:Amount>12.59</v4:Amount>
</v4:Amount>
</v4:Surcharges>
</v4:PackageRateDetail>
</v4:RatedPackages>
</v4:RatedShipmentDetails>
</v4:RateReplyDetails>
</v4:RateReply>
</soapenv:Body>
</soapenv:Envelope>

but all i want is only the NetCharge value, can u help me on this problem? thanks before

A(Answer):

print $response->RatedShipmentDetails->ShipmentRateDetail->TotalNetCharge->Amount;

Does it work for you?

A(Answer):

im sorry ak1dinar it doesnt work, it did not print anything.. is there any other way? thanks for ur help

A(Answer):

can you please post the code here. make sure to wrap them with code tags too.
[CODE] …[/CODE]

A(Answer):

<?php
// Copyright 2008, FedEx Corporation. All rights reserved.
// Version 4.0.0
require_once('library/fedex-common.php5');
$newline = "<br />";
//The WSDL is not included with the sample code.
//Please include and reference in $path_to_wsdl variable.
$path_to_wsdl = "wsdl/RateService_v4.wsdl";
ini_set("soap.wsdl_cache_enabled", "0");
$client = new SoapClient($path_to_wsdl, array('trace' => 1)); // Refer to http://us3.php.net/manual/en/ref.soap.php for more information
$request['WebAuthenticationDetail'] = array('UserCredential' =>
array('Key' => 'jhA1kN6eagkmU9Gc', 'Password' => 'xdjbss94sMPoj2s0f5XDINkvT')); // Replace 'XXX' and 'YYY' with FedEx provided credentials
$request['ClientDetail'] = array('AccountNumber' => '510087763', 'MeterNumber' => '7001942');// Replace 'XXX' with your account and meter number
$request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Rate Request v4 using PHP ***');
$request['Version'] = array('ServiceId' => 'crs', 'Major' => '4', 'Intermediate' => '0', Minor => '0');
$request['RequestedShipment']['DropoffType'] = 'REGULAR_PICKUP'; // valid values REGULAR_PICKUP, REQUEST_COURIER, ...
$request['RequestedShipment']['ShipTimestamp'] = date('c');
$request['RequestedShipment']['ServiceType'] = 'PRIORITY_OVERNIGHT'; // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
$request['RequestedShipment']['PackagingType'] = 'YOUR_PACKAGING'; // valid values FEDEX_BOK, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
$request['RequestedShipment']['Shipper'] = array('Address' => array(
'StreetLines' => array('10 Fed Ex Pkwy'), // Origin details
'City' => 'Memphis',
'StateOrProvinceCode' => 'TN',
'PostalCode' => '38115',
'CountryCode' => 'US'));
$request['RequestedShipment']['Recipient'] = array('Address' => array (
'StreetLines' => array('13450 Farmcrest Ct'), // Destination details
'City' => 'Herndon',
'StateOrProvinceCode' => 'VA',
'PostalCode' => '20171',
'CountryCode' => 'US'));
$request['RequestedShipment']['ShippingChargesPayment'] = array('PaymentType' => 'SENDER',
'Payor' => array('AccountNumber' => '510087763', // Replace "XXX" with payor's account number
'CountryCode' => 'US'));
$request['RequestedShipment']['RateRequestTypes'] = 'ACCOUNT';
$request['RequestedShipment']['RateRequestTypes'] = 'LIST';
$request['RequestedShipment']['PackageCount'] = '1';
$request['RequestedShipment']['PackageDetail'] = 'INDIVIDUAL_PACKAGES';
$request['RequestedShipment']['RequestedPackages'] = array('0' => array('SequenceNumber' => '1',
'InsuredValue' => array('Amount' => 20.0,
'Currency' => 'USD'),
'ItemDescription' => 'College Transcripts',
'Weight' => array('Value' => 2.0,
'Units' => 'LB'),
'Dimensions' => array('Length' => 25,
'Width' => 10,
'Height' => 10,
'Units' => 'IN'),
'CustomerReferences' => array('CustomerReferenceType' => 'CUSTOMER_REFERENCE',
'Value' => 'Undergraduate application')));
try
{
$response = $client ->getRates($request);
if ($response -> HighestSeverity != 'FAILURE' && $response -> HighestSeverity != 'ERROR')
{
print $response->RatedShipmentDetails->ShipmentRateDetail->TotalNetCharge->Amount;
printRequestResponse($client);
}
else
{
echo 'Error in processing transaction.'. $newline. $newline;
foreach ($response -> Notifications as $notification)
{
if(is_array($response -> Notifications))
{
echo $notification -> Severity;
echo ': ';
echo $notification -> Message . $newline;
}
else
{
echo $notification . $newline;
}
}
}
writeToLog($client); // Write to log file
} catch (SoapFault $exception) {
printFault($exception, $client);
}
?>

A(Answer):

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.

if ($response -> HighestSeverity != 'FAILURE' && $response -> HighestSeverity != 'ERROR')
{
// print $response->RatedShipmentDetails->ShipmentRateDetail->TotalNetCharge->Amount;
// printRequestResponse($client);
print "process successful";
}

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?

A(Answer):

there is no error.


printRequestResponse($client);

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.

A(Answer):

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:


echo $response->RateReply->RateReplyDetails->RatedShipmentDetails->TotalNetCharge->Amount;

You can incrementally test this by using var_dump():


var_dump($response->RateReply); // If you get output, continue to the next level.
var_dump($response->RateReply->RateReplyDetails); // And so on. If you get a NULL, then you know where you need to fix your path.

A(Answer):

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?

A(Answer):

i figure it out guys, thanks so much for your help. u all been great. thanks

A(Answer):

Glad to hear you got it working! What ended up doing the trick?

A(Answer):


$rsd = end($response->RateReplyDetails->RatedShipmentDetails);
printf("%.2d %s<br>\n", $rsd->ShipmentRateDetail->TotalNetFedExCharge->Amount, $rsd->ShipmentRateDetail->TotalNetFedExCharge->Currency);

that magic code above, thanks for everyone that help me, ๐Ÿ™‚

A(Answer):

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 :


<?php
// Copyright 2008, FedEx Corporation. All rights reserved.
// Version 4.0.0
require_once('library/fedex-common.php5');
$newline = "<br />";
//The WSDL is not included with the sample code.
//Please include and reference in $path_to_wsdl variable.
$path_to_wsdl = "wsdl/RateService_v4.wsdl";
ini_set("soap.wsdl_cache_enabled", "0");
$client = new SoapClient($path_to_wsdl, array('trace' => 1)); // Refer to http://us3.php.net/manual/en/ref.soap.php for more information
$request['WebAuthenticationDetail'] = array('UserCredential' =>
array('Key' => 'jhA1kN6eagkmU9Gc', 'Password' => 'xdjbss94sMPoj2s0f5XDINkvT')); // Replace 'XXX' and 'YYY' with FedEx provided credentials
$request['ClientDetail'] = array('AccountNumber' => '510087763', 'MeterNumber' => '7001942');// Replace 'XXX' with your account and meter number
$request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Rate Request v4 using PHP ***');
$request['Version'] = array('ServiceId' => 'crs', 'Major' => '4', 'Intermediate' => '0', Minor => '0');
$request['RequestedShipment']['DropoffType'] = 'REGULAR_PICKUP'; // valid values REGULAR_PICKUP, REQUEST_COURIER, ...
$request['RequestedShipment']['ShipTimestamp'] = date('c');
$request['RequestedShipment']['ServiceType'] = 'PRIORITY_OVERNIGHT'; // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
$request['RequestedShipment']['PackagingType'] = 'YOUR_PACKAGING'; // valid values FEDEX_BOK, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
$request['RequestedShipment']['Shipper'] = array('Address' => array(
'StreetLines' => array('10 Fed Ex Pkwy'), // Origin details
'City' => 'Memphis',
'StateOrProvinceCode' => 'TN',
'PostalCode' => '38115',
'CountryCode' => 'US'));
$request['RequestedShipment']['Recipient'] = array('Address' => array (
'StreetLines' => array('13450 Farmcrest Ct'), // Destination details
'City' => 'Herndon',
'StateOrProvinceCode' => 'VA',
'PostalCode' => '20171',
'CountryCode' => 'US'));
$request['RequestedShipment']['ShippingChargesPayment'] = array('PaymentType' => 'SENDER',
'Payor' => array('AccountNumber' => '510087763', // Replace "XXX" with payor's account number
'CountryCode' => 'US'));
$request['RequestedShipment']['RateRequestTypes'] = 'ACCOUNT';
$request['RequestedShipment']['RateRequestTypes'] = 'LIST';
$request['RequestedShipment']['PackageCount'] = '1';
$request['RequestedShipment']['PackageDetail'] = 'INDIVIDUAL_PACKAGES';
$request['RequestedShipment']['RequestedPackages'] = array('0' => array('SequenceNumber' => '1',
'InsuredValue' => array('Amount' => 20.0,
'Currency' => 'USD'),
'ItemDescription' => 'DVD or VCD',
'Weight' => array('Value' => 2.0,
'Units' => 'LB'),
'Dimensions' => array('Length' => 25,
'Width' => 10,
'Height' => 10,
'Units' => 'IN'),
'CustomerReferences' => array('CustomerReferenceType' => 'CUSTOMER_REFERENCE',
'Value' => 'Buying DVD or VCD')));
try
{
$response = $client ->getRates($request);
if ($response -> HighestSeverity != 'FAILURE' && $response -> HighestSeverity != 'ERROR')
{
//print $response->RatedShipmentDetails->ShipmentRateDetail->TotalNetCharge->Amount;
printRequestResponse($client);
//print "succesfull";
//echo $response->RateReply->RateReplyDetails->RatedShipmentDetails->TotalNetCharge->Amount;
//var_dump($response->RateReplyDetails->RatedShipmentDetails);
//echo 'break';
//var_dump($response); // If you get output, continue to the next level.
/*foreach ($response->RateReplyDetails->RatedShipmentDetails as $n => $rsd) {
$tnfec = $rsd->ShipmentRateDetail->TotalNetFedExCharge;
printf("%d: %.2d %s<br>\n", $n + 1, $tnfec->Currency, $tnfec->Amount);
}*/
$rsd = end($response->RateReplyDetails->RatedShipmentDetails);
printf("%.2d %s<br>\n", $rsd->ShipmentRateDetail->TotalNetFedExCharge->Amount, $rsd->ShipmentRateDetail->TotalNetFedExCharge->Currency);
}
else
{
echo 'Error in processing transaction.'. $newline. $newline;
foreach ($response -> Notifications as $notification)
{
if(is_array($response -> Notifications))
{
echo $notification -> Severity;
echo ': ';
echo $notification -> Message . $newline;
}
else
{
echo $notification . $newline;
}
}
}
writeToLog($client); // Write to log file
} catch (SoapFault $exception) {
printFault($exception, $client);
}
?>

A(Answer):

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 :


<?php
// Copyright 2008, FedEx Corporation. All rights reserved.
// Version 4.0.0
require_once('library/fedex-common.php5');
$newline = "<br />";
//The WSDL is not included with the sample code.
//Please include and reference in $path_to_wsdl variable.
$path_to_wsdl = "wsdl/RateService_v4.wsdl";
ini_set("soap.wsdl_cache_enabled", "0");
$client = new SoapClient($path_to_wsdl, array('trace' => 1)); // Refer to http://us3.php.net/manual/en/ref.soap.php for more information
$request['WebAuthenticationDetail'] = array('UserCredential' =>
array('Key' => 'jhA1kN6eagkmU9Gc', 'Password' => 'xdjbss94sMPoj2s0f5XDINkvT')); // Replace 'XXX' and 'YYY' with FedEx provided credentials
$request['ClientDetail'] = array('AccountNumber' => '510087763', 'MeterNumber' => '7001942');// Replace 'XXX' with your account and meter number
$request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Rate Request v4 using PHP ***');
$request['Version'] = array('ServiceId' => 'crs', 'Major' => '4', 'Intermediate' => '0', Minor => '0');
$request['RequestedShipment']['DropoffType'] = 'REGULAR_PICKUP'; // valid values REGULAR_PICKUP, REQUEST_COURIER, ...
$request['RequestedShipment']['ShipTimestamp'] = date('c');
$request['RequestedShipment']['ServiceType'] = 'PRIORITY_OVERNIGHT'; // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
$request['RequestedShipment']['PackagingType'] = 'YOUR_PACKAGING'; // valid values FEDEX_BOK, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
$request['RequestedShipment']['Shipper'] = array('Address' => array(
'StreetLines' => array('10 Fed Ex Pkwy'), // Origin details
'City' => 'Memphis',
'StateOrProvinceCode' => 'TN',
'PostalCode' => '38115',
'CountryCode' => 'US'));
$request['RequestedShipment']['Recipient'] = array('Address' => array (
'StreetLines' => array('13450 Farmcrest Ct'), // Destination details
'City' => 'Herndon',
'StateOrProvinceCode' => 'VA',
'PostalCode' => '20171',
'CountryCode' => 'US'));
$request['RequestedShipment']['ShippingChargesPayment'] = array('PaymentType' => 'SENDER',
'Payor' => array('AccountNumber' => '510087763', // Replace "XXX" with payor's account number
'CountryCode' => 'US'));
$request['RequestedShipment']['RateRequestTypes'] = 'ACCOUNT';
$request['RequestedShipment']['RateRequestTypes'] = 'LIST';
$request['RequestedShipment']['PackageCount'] = '1';
$request['RequestedShipment']['PackageDetail'] = 'INDIVIDUAL_PACKAGES';
$request['RequestedShipment']['RequestedPackages'] = array('0' => array('SequenceNumber' => '1',
'InsuredValue' => array('Amount' => 20.0,
'Currency' => 'USD'),
'ItemDescription' => 'DVD or VCD',
'Weight' => array('Value' => 2.0,
'Units' => 'LB'),
'Dimensions' => array('Length' => 25,
'Width' => 10,
'Height' => 10,
'Units' => 'IN'),
'CustomerReferences' => array('CustomerReferenceType' => 'CUSTOMER_REFERENCE',
'Value' => 'Buying DVD or VCD')));
try
{
$response = $client ->getRates($request);
if ($response -> HighestSeverity != 'FAILURE' && $response -> HighestSeverity != 'ERROR')
{
//print $response->RatedShipmentDetails->ShipmentRateDetail->TotalNetCharge->Amount;
printRequestResponse($client);
//print "succesfull";
//echo $response->RateReply->RateReplyDetails->RatedShipmentDetails->TotalNetCharge->Amount;
//var_dump($response->RateReplyDetails->RatedShipmentDetails);
//echo 'break';
//var_dump($response); // If you get output, continue to the next level.
/*foreach ($response->RateReplyDetails->RatedShipmentDetails as $n => $rsd) {
$tnfec = $rsd->ShipmentRateDetail->TotalNetFedExCharge;
printf("%d: %.2d %s<br>\n", $n + 1, $tnfec->Currency, $tnfec->Amount);
}*/
$rsd = end($response->RateReplyDetails->RatedShipmentDetails);
printf("%.2d %s<br>\n", $rsd->ShipmentRateDetail->TotalNetFedExCharge->Amount, $rsd->ShipmentRateDetail->TotalNetFedExCharge->Currency);
}
else
{
echo 'Error in processing transaction.'. $newline. $newline;
foreach ($response -> Notifications as $notification)
{
if(is_array($response -> Notifications))
{
echo $notification -> Severity;
echo ': ';
echo $notification -> Message . $newline;
}
else
{
echo $notification . $newline;
}
}
}
writeToLog($client); // Write to log file
} catch (SoapFault $exception) {
printFault($exception, $client);
}
?>

A(Answer):

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?

A(Answer):

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.

A(Answer):

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.

A(Answer):

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