物理包装类型缺失或无效
Physical packaging type is missing or invalid
我可以通过 PHP 图书馆收到 FedEx API 的费率。但这是唯一的常规要求。当我尝试请求 Freight LTL Rate API 时,它一个一个地向我显示错误。我几乎修复了大部分问题,但 Physical packaging type is missing or invalid
.
仍然有问题
我试图找出 WSDL 文件的问题所在,但没有成功。里面什么都没有。
如果您有货运零担的任何工作示例,请回答我。谢谢
这是我的代码:
<?php
// Copyright 2009, FedEx Corporation. All rights reserved.
// Version 12.0.0
require_once('../../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_v31.wsdl";
ini_set("soap.wsdl_cache_enabled", "1");
$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(
'ParentCredential' => array(
'Key' => getProperty('parentkey'),
'Password' => getProperty('parentpassword')
),
'UserCredential' => array(
'Key' => getProperty('key'),
'Password' => getProperty('password')
)
);
$request['ClientDetail'] = array(
'AccountNumber' => getProperty('shipaccount'),
'MeterNumber' => getProperty('meter')
);
$request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Rate Request using PHP ***');
$request['Version'] = array(
'ServiceId' => 'crs',
'Major' => '31',
'Intermediate' => '0',
'Minor' => '0'
);
$request['ReturnTransitAndCommit'] = true;
$request['RequestedShipment']['DropoffType'] = 'REGULAR_PICKUP'; // valid values REGULAR_PICKUP, REQUEST_COURIER, ...
$request['RequestedShipment']['ShipTimestamp'] = date('c');
$request['RequestedShipment']['ServiceType'] = 'FEDEX_FREIGHT_ECONOMY'; // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
$request['RequestedShipment']['PackagingType'] = 'YOUR_PACKAGING'; // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
$request['RequestedShipment']['Shipper'] = getProperty('shipper');
$request['RequestedShipment']['Recipient'] = addRecipient();
$request['RequestedShipment']['ShippingChargesPayment'] = addShippingChargesPayment();
$request['RequestedShipment']['FreightShipmentDetail'] = array(
'FedExFreightAccountNumber' => getProperty('freightaccount'),
'FedExFreightBillingContactAndAddress' => getProperty('freightbilling'),
'PrintedReferences' => array(
'Type' => 'SHIPPER_ID_NUMBER',
'Value' => 'RBB1057'
),
'Role' => 'SHIPPER',
'PaymentType' => 'PREPAID',
'CollectTermsType' => 'STANDARD',
'DeclaredValuePerUnit' => array(
'Currency' => 'USD',
'Amount' => 50
),
'LiabilityCoverageDetail' => array(
'CoverageType' => 'NEW',
'CoverageAmount' => array(
'Currency' => 'USD',
'Amount' => '50'
)
),
'TotalHandlingUnits' => 15,
'ClientDiscountPercent' => 0,
'PalletWeight' => array(
'Units' => 'LB',
'Value' => 20
),
'ShipmentDimensions' => array(
'Length' => 90,
'Width' => 30,
'Height' => 50,
'Units' => 'IN'
),
'LineItems' => array(
'Id' => '111',
'FreightClass' => 'CLASS_085',
'ClassProvidedByCustomer' => false,
'HandlingUnits' => 15,
'Packaging' => 'PALLET',
'BillOfLaddingNumber' => 'BOL_12345',
'PurchaseOrderNumber' => 'PO_12345',
'Description' => 'Heavy Stuff',
'Weight' => array(
'Value' => 50.0,
'Units' => 'LB'
),
'Dimensions' => array(
'Length' => 90,
'Width' => 30,
'Height' => 50,
'Units' => 'IN'
),
'Volume' => array(
'Units' => 'CUBIC_FT',
'Value' => 30
)
)
);
$request['RequestedShipment']['RateRequestTypes'] = 'ACCOUNT';
$request['RequestedShipment']['RateRequestTypes'] = 'LIST';
$request['RequestedShipment']['PackageCount'] = '1';
$request['RequestedShipment']['CarrierCodes'] = 'FXFR';
$request['RequestedShipment']['RequestedPackageLineItems'] = addPackageLineItem1();
try {
error_log('i am at try');
if (setEndpoint('changeEndpoint')) {
$newLocation = $client->__setLocation(setEndpoint('endpoint'));
error_log('i am at changeEndpoint');
}
$response = $client->getRates($request);
error_log('i am at response okay');
if ($response->HighestSeverity != 'FAILURE' && $response->HighestSeverity != 'ERROR') {
$rateReply = $response->RateReplyDetails;
echo '<table border="1">';
echo '<tr><th>Rate Details</th><th> </th></tr>';
trackDetails($rateReply, '');
echo '</table>';
printSuccess($client, $response);
} else {
printError($client, $response);
}
writeToLog($client); // Write to log file
} catch (SoapFault $exception) {
printFault($exception, $client);
}
function addRecipient()
{
$recipient = array(
'Contact' => array(
'PersonName' => 'Sender Name',
'CompanyName' => 'Sender Company Name',
'PhoneNumber' => '1234567890'
),
'Address' => array(
'StreetLines' => array('12148 Jollyville Rd'),
'City' => 'Austin',
'StateOrProvinceCode' => 'TX',
'PostalCode' => '78759',
'CountryCode' => 'US'
)
);
return $recipient;
}
function addShippingChargesPayment()
{
$shippingChargesPayment = array(
'PaymentType' => 'SENDER', // valid values RECIPIENT, SENDER and THIRD_PARTY
'Payor' => array(
'ResponsibleParty' => array(
'AccountNumber' => getProperty('freightaccount'),
'CountryCode' => 'US')
)
);
return $shippingChargesPayment;
}
function addShipper()
{
$shipper = array
(
'Contact' => array
(
'PersonName' => 'Rubaiet M',
'CompanyName' => 'ELS',
'PhoneNumber' => '019130191355'
),
'Address' => array(
'StreetLines' => array('1100 E Howard Ln'),
'City' => 'Austin',
'StateOrProvinceCode' => 'TX',
'PostalCode' => '78753',
'CountryCode' => 'US'
)
);
return $shipper;
} // end of function addShipper
function addPackageLineItem1()
{
error_log('i am in 152');
$packageLineItem = array(
'SequenceNumber' => 1,
'GroupNumber' => 1,
'GroupPackageCount' => 1,
'Weight' => array(
'Value' => 450.0,
'Units' => 'LB'
),
'InsuredValue' => array(
'Amount' => 695.0,
'Currency' => "USD"
),
'setGroupPackageCount' => 1
);
return $packageLineItem;
}
?>
FedEx 的回复是:
The transaction returned an Error.
Severity: ERROR
Source: crs
Code: 2101
Message: Package 1 - Physical packaging type is missing or invalid
LocalizedMessage: Package 1 - Physical packaging type is missing or invalid
Id: PACKAGE_INDEX
Value: 1
我正在使用 RateService_v31.wsdl,但仍然有问题。但是当我切换到 RateService_v16.wsdl BOOOM 时,我的代码工作正常。
这是我的零担货运请求代码。我希望有同样问题的人可以解决问题。
<?php
// Copyright 2009, FedEx Corporation. All rights reserved.
// Version 12.0.0
require_once('../../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_v16.wsdl";
ini_set("soap.wsdl_cache_enabled", "1");
$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(
'ParentCredential' => array(
'Key' => getProperty('parentkey'),
'Password' => getProperty('parentpassword')
),
'UserCredential' => array(
'Key' => getProperty('key'),
'Password' => getProperty('password')
)
);
$request['ClientDetail'] = array(
'AccountNumber' => getProperty('shipaccount'),
'MeterNumber' => getProperty('meter')
);
$request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Rate Request using PHP ***');
$request['Version'] = array(
'ServiceId' => 'crs',
'Major' => '16',
'Intermediate' => '0',
'Minor' => '0'
);
$request['ReturnTransitAndCommit'] = true;
$request['RequestedShipment']['DropoffType'] = 'REGULAR_PICKUP'; // valid values REGULAR_PICKUP, REQUEST_COURIER, ...
$request['RequestedShipment']['ShipTimestamp'] = date('c');
$request['RequestedShipment']['ServiceType'] = 'FEDEX_FREIGHT_ECONOMY'; // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
$request['RequestedShipment']['PackagingType'] = 'YOUR_PACKAGING'; // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
$request['RequestedShipment']['Shipper'] = getProperty('shipper');
$request['RequestedShipment']['Recipient'] = addRecipient();
$request['RequestedShipment']['ShippingChargesPayment'] = addShippingChargesPayment();
$request['RequestedShipment']['FreightShipmentDetail'] = array(
'FedExFreightAccountNumber' => getProperty('freightaccount'),
'FedExFreightBillingContactAndAddress' => getProperty('freightbilling'),
'PrintedReferences' => array(
'Type' => 'SHIPPER_ID_NUMBER',
'Value' => 'RBB1057'
),
'Role' => 'SHIPPER',
'PaymentType' => 'PREPAID',
'CollectTermsType' => 'STANDARD',
'DeclaredValuePerUnit' => array(
'Currency' => 'USD',
'Amount' => 50
),
'LiabilityCoverageDetail' => array(
'CoverageType' => 'NEW',
'CoverageAmount' => array(
'Currency' => 'USD',
'Amount' => '50'
)
),
'TotalHandlingUnits' => 1,
'ClientDiscountPercent' => 0,
'PalletWeight' => array(
'Units' => 'LB',
'Value' => 20
),
'ShipmentDimensions' => array(
'Length' => 90,
'Width' => 30,
'Height' => 50,
'Units' => 'IN'
),
'LineItems' => array(
'FreightClass' => 'CLASS_085',
'Packaging' => 'SKID',
'Weight' => array(
'Value' => 50.0,
'Units' => 'LB'
)
)
);
$request['RequestedShipment']['RateRequestTypes'] = 'NONE';
$request['RequestedShipment']['PackageCount'] = '1';
$request['RequestedShipment']['CarrierCodes'] = 'FXFR';
$request['RequestedShipment']['RequestedPackageLineItems'] = addPackageLineItem1();
try {
error_log('i am at try');
if (setEndpoint('changeEndpoint')) {
$newLocation = $client->__setLocation(setEndpoint('endpoint'));
error_log('i am at changeEndpoint');
}
$response = $client->getRates($request);
error_log('i am at response okay');
if ($response->HighestSeverity != 'FAILURE' && $response->HighestSeverity != 'ERROR') {
$rateReply = $response->RateReplyDetails;
echo '<table border="1">';
echo '<tr><th>Rate Details</th><th> </th></tr>';
trackDetails($rateReply, '');
echo '</table>';
printSuccess($client, $response);
} else {
printError($client, $response);
}
writeToLog($client); // Write to log file
} catch (SoapFault $exception) {
printFault($exception, $client);
}
function addRecipient()
{
$recipient = array(
'Contact' => array(
'PersonName' => 'Sender Name',
'CompanyName' => 'Sender Company Name',
'PhoneNumber' => '1234567890'
),
'Address' => array(
'StreetLines' => array('12148 Jollyville Rd'),
'City' => 'Austin',
'StateOrProvinceCode' => 'TX',
'PostalCode' => '78759',
'CountryCode' => 'US'
)
);
return $recipient;
}
function addShippingChargesPayment()
{
$shippingChargesPayment = array(
'PaymentType' => 'SENDER', // valid values RECIPIENT, SENDER and THIRD_PARTY
'Payor' => array(
'ResponsibleParty' => array(
'AccountNumber' => getProperty('freightaccount'),
'CountryCode' => 'US')
)
);
return $shippingChargesPayment;
}
function addShipper()
{
$shipper = array
(
'Contact' => array
(
'PersonName' => 'Rubaiet M',
'CompanyName' => 'ELS',
'PhoneNumber' => '019130191355'
),
'Address' => array(
'StreetLines' => array('12148 Jollyville Rd'),
'City' => 'Austin',
'StateOrProvinceCode' => 'TX',
'PostalCode' => '78759',
'CountryCode' => 'US'
)
);
return $shipper;
} // end of function addShipper
function addPackageLineItem1()
{
$packageLineItem = array(
'SequenceNumber' => 1,
'GroupNumber' => 1,
'GroupPackageCount' => 1,
'Weight' => array(
'Value' => 55.0,
'Units' => 'LB'
),
'InsuredValue' => array(
'Amount' => 695.0,
'Currency' => "USD"
),
'setGroupPackageCount' => 1
);
return $packageLineItem;
}
?>
我可以通过 PHP 图书馆收到 FedEx API 的费率。但这是唯一的常规要求。当我尝试请求 Freight LTL Rate API 时,它一个一个地向我显示错误。我几乎修复了大部分问题,但 Physical packaging type is missing or invalid
.
我试图找出 WSDL 文件的问题所在,但没有成功。里面什么都没有。
如果您有货运零担的任何工作示例,请回答我。谢谢
这是我的代码:
<?php
// Copyright 2009, FedEx Corporation. All rights reserved.
// Version 12.0.0
require_once('../../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_v31.wsdl";
ini_set("soap.wsdl_cache_enabled", "1");
$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(
'ParentCredential' => array(
'Key' => getProperty('parentkey'),
'Password' => getProperty('parentpassword')
),
'UserCredential' => array(
'Key' => getProperty('key'),
'Password' => getProperty('password')
)
);
$request['ClientDetail'] = array(
'AccountNumber' => getProperty('shipaccount'),
'MeterNumber' => getProperty('meter')
);
$request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Rate Request using PHP ***');
$request['Version'] = array(
'ServiceId' => 'crs',
'Major' => '31',
'Intermediate' => '0',
'Minor' => '0'
);
$request['ReturnTransitAndCommit'] = true;
$request['RequestedShipment']['DropoffType'] = 'REGULAR_PICKUP'; // valid values REGULAR_PICKUP, REQUEST_COURIER, ...
$request['RequestedShipment']['ShipTimestamp'] = date('c');
$request['RequestedShipment']['ServiceType'] = 'FEDEX_FREIGHT_ECONOMY'; // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
$request['RequestedShipment']['PackagingType'] = 'YOUR_PACKAGING'; // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
$request['RequestedShipment']['Shipper'] = getProperty('shipper');
$request['RequestedShipment']['Recipient'] = addRecipient();
$request['RequestedShipment']['ShippingChargesPayment'] = addShippingChargesPayment();
$request['RequestedShipment']['FreightShipmentDetail'] = array(
'FedExFreightAccountNumber' => getProperty('freightaccount'),
'FedExFreightBillingContactAndAddress' => getProperty('freightbilling'),
'PrintedReferences' => array(
'Type' => 'SHIPPER_ID_NUMBER',
'Value' => 'RBB1057'
),
'Role' => 'SHIPPER',
'PaymentType' => 'PREPAID',
'CollectTermsType' => 'STANDARD',
'DeclaredValuePerUnit' => array(
'Currency' => 'USD',
'Amount' => 50
),
'LiabilityCoverageDetail' => array(
'CoverageType' => 'NEW',
'CoverageAmount' => array(
'Currency' => 'USD',
'Amount' => '50'
)
),
'TotalHandlingUnits' => 15,
'ClientDiscountPercent' => 0,
'PalletWeight' => array(
'Units' => 'LB',
'Value' => 20
),
'ShipmentDimensions' => array(
'Length' => 90,
'Width' => 30,
'Height' => 50,
'Units' => 'IN'
),
'LineItems' => array(
'Id' => '111',
'FreightClass' => 'CLASS_085',
'ClassProvidedByCustomer' => false,
'HandlingUnits' => 15,
'Packaging' => 'PALLET',
'BillOfLaddingNumber' => 'BOL_12345',
'PurchaseOrderNumber' => 'PO_12345',
'Description' => 'Heavy Stuff',
'Weight' => array(
'Value' => 50.0,
'Units' => 'LB'
),
'Dimensions' => array(
'Length' => 90,
'Width' => 30,
'Height' => 50,
'Units' => 'IN'
),
'Volume' => array(
'Units' => 'CUBIC_FT',
'Value' => 30
)
)
);
$request['RequestedShipment']['RateRequestTypes'] = 'ACCOUNT';
$request['RequestedShipment']['RateRequestTypes'] = 'LIST';
$request['RequestedShipment']['PackageCount'] = '1';
$request['RequestedShipment']['CarrierCodes'] = 'FXFR';
$request['RequestedShipment']['RequestedPackageLineItems'] = addPackageLineItem1();
try {
error_log('i am at try');
if (setEndpoint('changeEndpoint')) {
$newLocation = $client->__setLocation(setEndpoint('endpoint'));
error_log('i am at changeEndpoint');
}
$response = $client->getRates($request);
error_log('i am at response okay');
if ($response->HighestSeverity != 'FAILURE' && $response->HighestSeverity != 'ERROR') {
$rateReply = $response->RateReplyDetails;
echo '<table border="1">';
echo '<tr><th>Rate Details</th><th> </th></tr>';
trackDetails($rateReply, '');
echo '</table>';
printSuccess($client, $response);
} else {
printError($client, $response);
}
writeToLog($client); // Write to log file
} catch (SoapFault $exception) {
printFault($exception, $client);
}
function addRecipient()
{
$recipient = array(
'Contact' => array(
'PersonName' => 'Sender Name',
'CompanyName' => 'Sender Company Name',
'PhoneNumber' => '1234567890'
),
'Address' => array(
'StreetLines' => array('12148 Jollyville Rd'),
'City' => 'Austin',
'StateOrProvinceCode' => 'TX',
'PostalCode' => '78759',
'CountryCode' => 'US'
)
);
return $recipient;
}
function addShippingChargesPayment()
{
$shippingChargesPayment = array(
'PaymentType' => 'SENDER', // valid values RECIPIENT, SENDER and THIRD_PARTY
'Payor' => array(
'ResponsibleParty' => array(
'AccountNumber' => getProperty('freightaccount'),
'CountryCode' => 'US')
)
);
return $shippingChargesPayment;
}
function addShipper()
{
$shipper = array
(
'Contact' => array
(
'PersonName' => 'Rubaiet M',
'CompanyName' => 'ELS',
'PhoneNumber' => '019130191355'
),
'Address' => array(
'StreetLines' => array('1100 E Howard Ln'),
'City' => 'Austin',
'StateOrProvinceCode' => 'TX',
'PostalCode' => '78753',
'CountryCode' => 'US'
)
);
return $shipper;
} // end of function addShipper
function addPackageLineItem1()
{
error_log('i am in 152');
$packageLineItem = array(
'SequenceNumber' => 1,
'GroupNumber' => 1,
'GroupPackageCount' => 1,
'Weight' => array(
'Value' => 450.0,
'Units' => 'LB'
),
'InsuredValue' => array(
'Amount' => 695.0,
'Currency' => "USD"
),
'setGroupPackageCount' => 1
);
return $packageLineItem;
}
?>
FedEx 的回复是:
The transaction returned an Error.
Severity: ERROR
Source: crs
Code: 2101
Message: Package 1 - Physical packaging type is missing or invalid
LocalizedMessage: Package 1 - Physical packaging type is missing or invalid
Id: PACKAGE_INDEX
Value: 1
我正在使用 RateService_v31.wsdl,但仍然有问题。但是当我切换到 RateService_v16.wsdl BOOOM 时,我的代码工作正常。
这是我的零担货运请求代码。我希望有同样问题的人可以解决问题。
<?php
// Copyright 2009, FedEx Corporation. All rights reserved.
// Version 12.0.0
require_once('../../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_v16.wsdl";
ini_set("soap.wsdl_cache_enabled", "1");
$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(
'ParentCredential' => array(
'Key' => getProperty('parentkey'),
'Password' => getProperty('parentpassword')
),
'UserCredential' => array(
'Key' => getProperty('key'),
'Password' => getProperty('password')
)
);
$request['ClientDetail'] = array(
'AccountNumber' => getProperty('shipaccount'),
'MeterNumber' => getProperty('meter')
);
$request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Rate Request using PHP ***');
$request['Version'] = array(
'ServiceId' => 'crs',
'Major' => '16',
'Intermediate' => '0',
'Minor' => '0'
);
$request['ReturnTransitAndCommit'] = true;
$request['RequestedShipment']['DropoffType'] = 'REGULAR_PICKUP'; // valid values REGULAR_PICKUP, REQUEST_COURIER, ...
$request['RequestedShipment']['ShipTimestamp'] = date('c');
$request['RequestedShipment']['ServiceType'] = 'FEDEX_FREIGHT_ECONOMY'; // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
$request['RequestedShipment']['PackagingType'] = 'YOUR_PACKAGING'; // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
$request['RequestedShipment']['Shipper'] = getProperty('shipper');
$request['RequestedShipment']['Recipient'] = addRecipient();
$request['RequestedShipment']['ShippingChargesPayment'] = addShippingChargesPayment();
$request['RequestedShipment']['FreightShipmentDetail'] = array(
'FedExFreightAccountNumber' => getProperty('freightaccount'),
'FedExFreightBillingContactAndAddress' => getProperty('freightbilling'),
'PrintedReferences' => array(
'Type' => 'SHIPPER_ID_NUMBER',
'Value' => 'RBB1057'
),
'Role' => 'SHIPPER',
'PaymentType' => 'PREPAID',
'CollectTermsType' => 'STANDARD',
'DeclaredValuePerUnit' => array(
'Currency' => 'USD',
'Amount' => 50
),
'LiabilityCoverageDetail' => array(
'CoverageType' => 'NEW',
'CoverageAmount' => array(
'Currency' => 'USD',
'Amount' => '50'
)
),
'TotalHandlingUnits' => 1,
'ClientDiscountPercent' => 0,
'PalletWeight' => array(
'Units' => 'LB',
'Value' => 20
),
'ShipmentDimensions' => array(
'Length' => 90,
'Width' => 30,
'Height' => 50,
'Units' => 'IN'
),
'LineItems' => array(
'FreightClass' => 'CLASS_085',
'Packaging' => 'SKID',
'Weight' => array(
'Value' => 50.0,
'Units' => 'LB'
)
)
);
$request['RequestedShipment']['RateRequestTypes'] = 'NONE';
$request['RequestedShipment']['PackageCount'] = '1';
$request['RequestedShipment']['CarrierCodes'] = 'FXFR';
$request['RequestedShipment']['RequestedPackageLineItems'] = addPackageLineItem1();
try {
error_log('i am at try');
if (setEndpoint('changeEndpoint')) {
$newLocation = $client->__setLocation(setEndpoint('endpoint'));
error_log('i am at changeEndpoint');
}
$response = $client->getRates($request);
error_log('i am at response okay');
if ($response->HighestSeverity != 'FAILURE' && $response->HighestSeverity != 'ERROR') {
$rateReply = $response->RateReplyDetails;
echo '<table border="1">';
echo '<tr><th>Rate Details</th><th> </th></tr>';
trackDetails($rateReply, '');
echo '</table>';
printSuccess($client, $response);
} else {
printError($client, $response);
}
writeToLog($client); // Write to log file
} catch (SoapFault $exception) {
printFault($exception, $client);
}
function addRecipient()
{
$recipient = array(
'Contact' => array(
'PersonName' => 'Sender Name',
'CompanyName' => 'Sender Company Name',
'PhoneNumber' => '1234567890'
),
'Address' => array(
'StreetLines' => array('12148 Jollyville Rd'),
'City' => 'Austin',
'StateOrProvinceCode' => 'TX',
'PostalCode' => '78759',
'CountryCode' => 'US'
)
);
return $recipient;
}
function addShippingChargesPayment()
{
$shippingChargesPayment = array(
'PaymentType' => 'SENDER', // valid values RECIPIENT, SENDER and THIRD_PARTY
'Payor' => array(
'ResponsibleParty' => array(
'AccountNumber' => getProperty('freightaccount'),
'CountryCode' => 'US')
)
);
return $shippingChargesPayment;
}
function addShipper()
{
$shipper = array
(
'Contact' => array
(
'PersonName' => 'Rubaiet M',
'CompanyName' => 'ELS',
'PhoneNumber' => '019130191355'
),
'Address' => array(
'StreetLines' => array('12148 Jollyville Rd'),
'City' => 'Austin',
'StateOrProvinceCode' => 'TX',
'PostalCode' => '78759',
'CountryCode' => 'US'
)
);
return $shipper;
} // end of function addShipper
function addPackageLineItem1()
{
$packageLineItem = array(
'SequenceNumber' => 1,
'GroupNumber' => 1,
'GroupPackageCount' => 1,
'Weight' => array(
'Value' => 55.0,
'Units' => 'LB'
),
'InsuredValue' => array(
'Amount' => 695.0,
'Currency' => "USD"
),
'setGroupPackageCount' => 1
);
return $packageLineItem;
}
?>