FedEx Web Services | Newbie | | Join Date: Aug 2007
Posts: 15
| |
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);
-
}
-
-
?>
-
|  | Moderator | | Join Date: Jan 2007 Location: Colombo
Posts: 1,439
| | | re: FedEx Web Services
Hey welcome to TheScripts.com. Please note that you are not allowed to post any web site links that contains commercial based contents. Sorry its the forum rule. If you want to post the source codes, you have to use this thread or if you want attach the codes to the thread, by pressing the edit button after you post you can find the attachment section. but I am strongly recommending posting the source codes to the threads in line. with the code tags. Please read the here for more details. |  | Moderator | | Join Date: Jan 2007 Location: Colombo
Posts: 1,439
| | | re: FedEx Web Services - new SoapClient("wsdl/RateService.wsdl");
How about checking your directory structure again.
FXD/rate.php
FXD/wsdl/RateService.wsdl
Is It like this?
| | Newbie | | Join Date: Aug 2007
Posts: 15
| | | re: FedEx Web Services Quote:
Originally Posted by ajaxrand - 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]
|  | Moderator | | Join Date: Jan 2007 Location: Colombo
Posts: 1,439
| | | re: FedEx Web Services
With the specified error details, what I can understand is, its not creating the instant of the soapclient from the specified path of the wsdl file. Try to use the absolute path of the WSDL (http URL) instead of relative path.
| | Newbie | | Join Date: Sep 2007
Posts: 1
| | | re: FedEx Web Services
I am getting the same error. If you find a resolution to this, please update us.
My guess is that a) SOAP has not been installed on my Apache Linux server,
b) Apache is not configured probably to recognize *.WSDL files, or c) I did not deploy the WSDL correctly.
I'm having trouble finding any documentation on any of the above, except for the following:
http://www.xmethods.net/gettingstarted/apache.html
| | Newbie | | Join Date: Aug 2007
Posts: 15
| | | re: FedEx Web Services
Thanks ajaxrand....
It works now...i 've specified the whole url of wsdl file with...
and its working...
|  | Moderator | | Join Date: Jan 2007 Location: Colombo
Posts: 1,439
| | | re: FedEx Web Services Quote:
Originally Posted by daniyalnawaz Thanks ajaxrand....
It works now...i 've specified the whole url of wsdl file with...
and its working... Glad you got it working. post back any time when there is a issue.
| | Member | | Join Date: Oct 2008
Posts: 32
| | | re: FedEx Web Services
hai i'm having trouble regarding this coding, what do u mean by specifying the complete wsdl url? can anyone send me the complete coding? plz help me. thanks
|  | Moderator | | Join Date: Jan 2007 Location: Colombo
Posts: 1,439
| | | re: FedEx Web Services Quote:
Originally Posted by dbest5250 hai i'm having trouble regarding this coding, what do u mean by specifying the complete wsdl url? can anyone send me the complete coding? plz help me. thanks Instead of the relative path of the wsdl file - $client = new SoapClient("wsdl/RateService.wsdl");
please specify the absolute path - $client = new SoapClient("http://domain_name/dir_path/RateService.wsdl");
| | Member | | Join Date: Oct 2008
Posts: 32
| | | re: FedEx Web Services
thanks before, i already got it working, the directory for localhost is ok, i dont need the url directory. hehehe ^^ but i have another problem, since i have gotten the result for the request, how do i get the netCharge only and not all the response? i have tried printRequestResponse($client['NetCharge']); but it seems is not working. and i tried again today (sunday) how come is not working? is it close on weekends? this is the error massage :
Error in processing transaction.
FAILURE: Rating is temporarily unavailable, please try again later.
NOTE: Deliver Weekday was assumed.
i thank u before ^^
|  | Moderator | | Join Date: Jan 2007 Location: Colombo
Posts: 1,439
| | | re: FedEx Web Services Quote:
Originally Posted by dbest5250 thanks before, i already got it working, the directory for localhost is ok, i dont need the url directory. hehehe ^^ but i have another problem, since i have gotten the result for the request, how do i get the netCharge only and not all the response? i have tried printRequestResponse($client['NetCharge']); but it seems is not working. and i tried again today (sunday) how come is not working? is it close on weekends? this is the error massage :
Error in processing transaction.
FAILURE: Rating is temporarily unavailable, please try again later.
NOTE: Deliver Weekday was assumed.
i thank u before ^^ I think now your script working perfectly. that is NOT a coding error. it is a message from the service provider.
may be this will help for you.
http://www.ubercart.org/issue/5206/error_crs_7_rating_temporarily_unavailable_please_ try_again_later
give it a try. thanks.
| | Member | | Join Date: Oct 2008
Posts: 32
| | | re: FedEx Web Services
thanks ak1dnar but i still cant get the single value NetCharge from the fed ex response. Can anyone help me? i tried using response['NetCharge'] and its not working all i got was an error :(
|  | Moderator | | Join Date: Jan 2007 Location: Colombo
Posts: 1,439
| | | re: FedEx Web Services Quote:
Originally Posted by dbest5250 thanks ak1dnar but i still cant get the single value NetCharge from the fed ex response. Can anyone help me? i tried using response['NetCharge'] and its not working all i got was an error :( I'm sorry dbest5250, you have to contact service provider's support team on this. as I said earlier your script is working. in other words your php coding is working. So now you are getting a ERROR/STATUS MESSAGE from the WEB SERVICE.
please contact service provider's support team to find out about the error message.
or read the documentation provided.
| | Member | | Join Date: Oct 2008
Posts: 32
| | | re: FedEx Web Services
no is not an error, is working fine now, i figure it out that the web service is not working on sundays, now im trying to get the value of the NetCharge that fedex has given. they give this as a response :
Response
but all i want is only the NetCharge value, can u help me on this problem? thanks before
|  | Moderator | | Join Date: Jan 2007 Location: Colombo
Posts: 1,439
| | | re: FedEx Web Services - print $response->RatedShipmentDetails->ShipmentRateDetail->TotalNetCharge->Amount;
-
Does it work for you?
| | Member | | Join Date: Oct 2008
Posts: 32
| | | re: FedEx Web Services
im sorry ak1dinar it doesnt work, it did not print anything.. is there any other way? thanks for ur help
|  | Moderator | | Join Date: Jan 2007 Location: Colombo
Posts: 1,439
| | | re: FedEx Web Services
can you please post the code here. make sure to wrap them with code tags too.
[CODE] ...[/CODE]
| | Member | | Join Date: Oct 2008
Posts: 32
| | | re: FedEx Web Services - <?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);
-
}
-
-
?>
-
|  | Moderator | | Join Date: Jan 2007 Location: Colombo
Posts: 1,439
| | | re: FedEx Web Services - 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?
| | Member | | Join Date: Oct 2008
Posts: 32
| | | re: FedEx Web Services
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.
|  | Site Moderator | | Join Date: Apr 2007 Location: Texas
Posts: 5,435
| | | re: FedEx Web Services
Heya, DBest.
I haven't worked with SOAP in awhile (keep the jokes to a minimum, please), but it looks like the path should be: -
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.
-
| | Member | | Join Date: Oct 2008
Posts: 32
| | | re: FedEx Web Services
thanks pbmod, but i have tried all the possibilties but it seems the result is always null. i tried your path and it is not printing anything. wow this fedex webservice is hard :( i cant get the right path. can anyone help me?
| | Member | | Join Date: Oct 2008
Posts: 32
| | | re: FedEx Web Services
i figure it out guys, thanks so much for your help. u all been great. thanks
|  | Site Moderator | | Join Date: Apr 2007 Location: Texas
Posts: 5,435
| | | re: FedEx Web Services
Glad to hear you got it working! What ended up doing the trick?
| | Member | | Join Date: Oct 2008
Posts: 32
| | | re: FedEx Web Services -
$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, :)
| | Member | | Join Date: Oct 2008
Posts: 32
| | | re: FedEx Web Services
hai guys, i have another problem, u see iam in Indonesia, and i have to shipped in indonesia, when i change the city or the country it seems to not working. Does fedex only support USA shipping? or am i the one that is wrong?
here is the code : -
<?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);
-
}
-
-
?>
-
| | Newbie | | Join Date: Nov 2008
Posts: 1
| | | re: FedEx Web Services
FedEx does not support Intra-Country Shipping outside of US, Canada and Mexico. You can only ship from Indonesia to somewhere outside of Indonesia.
---------------------------------------- Quote:
Originally Posted by dbest5250 hai guys, i have another problem, u see iam in Indonesia, and i have to shipped in indonesia, when i change the city or the country it seems to not working. Does fedex only support USA shipping? or am i the one that is wrong?
here is the code : -
<?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);
-
}
-
-
?>
-
| | Member | | Join Date: Oct 2008
Posts: 32
| | | re: FedEx Web Services
really? so that means i can't use this web service in indonesia? :( is there any soap web service that i can use in indonesia?
| | Newbie | | Join Date: Jul 2009
Posts: 2
| | | re: FedEx Web Services
Hi,
I tried above solution but I am getting this errors.
Warning: end() [function.end]: Passed variable is not an array or object.
Any help will be appreciated.
|  | Moderator | | Join Date: Aug 2008 Location: Leipzig, Germany
Posts: 3,639
| | | re: FedEx Web Services
you could do a var_dump() on the variable and see what data type it is. though you still need to feed a variable of an array or object data type to the function/method.
| | Newbie | | Join Date: Jul 2009
Posts: 2
| | | re: FedEx Web Services
Found the problem.
Dormilich you are a gem.
Thanks for pointing me in right direction.
|  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,327 network members.
|