Connecting Tech Pros Worldwide Forums | Help | Site Map

CustomerReferences entry not included in FedEx web service request generated via PHP

Newbie
 
Join Date: Sep 2009
Posts: 3
#1: Sep 12 '09
I am working on this FedEx web service integration project for some time. I am using PHP to make calls to the FedEx server. Everything seems to be working properly.

But I am having problems with CustomerReferences fields appearing in the original fedex request that is sent to the server. I am using the ShipService_v7.wsdl. I asked FedEx tech support saying that would not be able to help with PHP code. But my problem is even the sample code provided by fedex is not able to generate the customerreferences fields in the request sent to the server.

Would you guys happen to know whats the deals with this?

TheServant's Avatar
Expert
 
Join Date: Feb 2008
Location: Australia
Posts: 914
#2: Sep 14 '09

re: CustomerReferences entry not included in FedEx web service request generated via PHP


I am not sure if anyone has experience in the "ShipService_v7.wsdl", however there are a lot of PHP experts here, so how about you give what PHP you are having trouble with, or think where the problem lies, and we can have a look. I am a little confused with your probelm description too: who is making the request, and how does that affect you? Do you want the CustomerReference fields for processing?
Newbie
 
Join Date: Sep 2009
Posts: 3
#3: Sep 14 '09

re: CustomerReferences entry not included in FedEx web service request generated via PHP


@TheServant thanks for replying.
1. My application is making the fedex "Create Shipment" request to the fedex web server via SOAP.
2. Well the request obejct that is being created at my end does not have the entry for "CustomerReferences" in it - even though I explicitly mention that in my PHP code.
3. I need to CustomerReferences field to be displayed on the final output - which is possible only if they are present in the request object.


PHP CODE

Expand|Select|Wrap|Line Numbers
  1.  
  2. $client = new SoapClient($path_to_wsdl, array('trace' => 1)); // Refer to http://us3.php.net/manual/en/ref.soap.php for more information
  3.  
  4. $request['WebAuthenticationDetail'] = array('UserCredential' =>
  5.                                       array('Key' => $DEVELOPER_KEY, 'Password' => $DEVELOPER_PASSWORD)); // Replace 'XXX' and 'YYY' with FedEx provided credentials 
  6. $request['ClientDetail'] = array('AccountNumber' => $FEDEX_ACCOUNT_NUMBER, 'MeterNumber' => $FEDEX_METER_NUMBER);// Replace 'XXX' with your account and meter number
  7. $request['TransactionDetail'] = array('CustomerTransactionId' => '*** Ground International Shipping Request v7 using PHP ***');
  8. $request['Version'] = array('ServiceId' => 'ship', 'Major' => '7', 'Intermediate' => '0', 'Minor' => '0');
  9. $request['RequestedShipment'] = array('ShipTimestamp' => date('c'),
  10.                                     'DropoffType' => 'REGULAR_PICKUP', // valid values REGULAR_PICKUP, REQUEST_COURIER, DROP_BOX, BUSINESS_SERVICE_CENTER and STATION
  11.                                     'ServiceType' => 'FEDEX_GROUND', // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
  12.                                     'PackagingType' => 'YOUR_PACKAGING', // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
  13.                                     'Shipper' => array('Contact' => array('PersonName' => 'Sender Name',
  14.                                                                           'CompanyName' => 'Company Name',
  15.                                                                           'PhoneNumber' => '0805522713'),
  16.                                                        'Address' => array('StreetLines' => array('Address Line 1'),
  17.                                                                           'City' => 'Memphis',
  18.                                                                           'StateOrProvinceCode' => 'TN',
  19.                                                                           'PostalCode' => '38110',
  20.                                                                           'CountryCode' => 'US')),
  21.                                     'Recipient' => array('Contact' => array('PersonName' => 'Recipient Name',
  22.                                                                             'CompanyName' => 'Company Name',
  23.                                                                             'PhoneNumber' => '9012637906'),
  24.                                                          'Address' => array('StreetLines' => array('Address Line 1'),
  25.                                                                             'City' => 'Richmond',
  26.                                                                             'StateOrProvinceCode' => 'BC',
  27.                                                                             'PostalCode' => 'V7C4V4',
  28.                                                                             'CountryCode' => 'CA',
  29.                                                                             'Residential' => false)),
  30.                                     'ShippingChargesPayment' => array('PaymentType' => 'SENDER', // valid values RECIPIENT, SENDER and THIRD_PARTY
  31.                                                                       'Payor' => array('AccountNumber' => $FEDEX_ACCOUNT_NUMBER, // Replace 'XXX' with payors account number
  32.                                                                                        'CountryCode' => 'US')),
  33.                                     'InternationalDetail' => array('DutiesPayment' => array('PaymentType' => 'SENDER', // valid values RECIPIENT, SENDER and THIRD_PARTY
  34.                                                                                             'Payor' => array('AccountNumber' => $FEDEX_ACCOUNT_NUMBER, // Replace 'XXX' with payor's account number
  35.                                                                                             'CountryCode' => 'CA')),
  36.                                                                    'DocumentContent' => 'DOCUMENTS_ONLY',                                                                                            
  37.                                                                    'CustomsValue' => array('Amount' => 100.0, 'Currency' => 'USD'),
  38.                                                                    'Commodities' => array('0' => array('NumberOfPieces' => 1,
  39.                                                                                                        'Description' => 'Books',
  40.                                                                                                        'CountryOfManufacture' => 'US',
  41.                                                                                                        'Weight' => array('Value' => 1.0, 'Units' => 'LB'),
  42.                                                                                                        'Quantity' => 1,
  43.                                                                                                        'QuantityUnits' => 'EA',
  44.                                                                                                        'UnitPrice' => array('Amount' => 1.000000, 'Currency' => 'USD'),
  45.                                                                                                        'CustomsValue' => array('Amount' => 100.000000, 'Currency' => 'USD'))),
  46.                                                                    'ExportDetail' => array('B13AFilingOption' => 'FILED_ELECTRONICALLY')),                                                                                                       
  47.                                     'LabelSpecification' => array('LabelFormatType' => 'COMMON2D', // valid values COMMON2D, LABEL_DATA_ONLY
  48.                                                                   'ImageType' => 'PNG',  // valid values DPL, EPL2, PDF, ZPLII and PNG
  49.                                                                   'LabelStockType' => 'PAPER_7X4.75'), 
  50.                                     'RateRequestTypes' => array('ACCOUNT'), // valid values ACCOUNT and LIST
  51.                                     'PackageCount' => 1,
  52.                                     'PackageDetail' => 'INDIVIDUAL_PACKAGES',                                        
  53.                                     'RequestedPackageLineItems' => array('SequenceNumber' => 1,
  54.                                                                  'Weight' => array('Value' => 20.0, 'Units' => 'LB')), // valid values LB and KG
  55.                                                                  'CustomerReferences' => array('0' => array('CustomerReferenceType' => 'CUSTOMER_REFERENCE', 'Value' => 'TC007_07_PT1_ST01_PK01_SNDUS_RCPCA_POS')));
  56.  
  57. $response = $client->processShipment($request); // FedEx web service invocation
  58.  
  59.  
Expected XML Output

Expand|Select|Wrap|Line Numbers
  1. ... XML Stuff ...
  2. <ns1:RequestedPackageLineItems>
  3.                                 <ns1:SequenceNumber>1</ns1:SequenceNumber>
  4.                                 <ns1:Weight>
  5.                                         <ns1:Units>LB</ns1:Units>
  6.                                         <ns1:Value>20</ns1:Value>
  7.                                 </ns1:Weight>
  8.                                 <ns1:CustomerReferences>
  9.                                         <ns1:CustomerReferenceType>CUSTOMER_REFERENCE</ns1:CustomerReferenceType>
  10.                                         <ns1:Value>I am a customer reference</ns1:Value>
  11.                                 </ns1:CustomerReferences>
  12.                         </ns1:RequestedPackageLineItems>
  13. ... XML Stuff ...
  14.  
Current XML Output

Expand|Select|Wrap|Line Numbers
  1. ... XML Stuff ...
  2.                       <ns1:RequestedPackageLineItems>
  3.                                 <ns1:SequenceNumber>1</ns1:SequenceNumber>
  4.                                 <ns1:Weight>
  5.                                         <ns1:Units>LB</ns1:Units>
  6.                                         <ns1:Value>20</ns1:Value>
  7.                                 </ns1:Weight>           
  8.                         </ns1:RequestedPackageLineItems>
  9. ... XML Stuff ...
  10.  
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,664
#4: Sep 14 '09

re: CustomerReferences entry not included in FedEx web service request generated via PHP


what if you try
Expand|Select|Wrap|Line Numbers
  1. 'CustomerReferences' => array('CustomerReferenceType' => 'CUSTOMER_REFERENCE', 'Value' => 'TC007_07_PT1_ST01_PK01_SNDUS_RCPCA_POS'));
instead of
Expand|Select|Wrap|Line Numbers
  1. 'CustomerReferences' => array('0' => array('CustomerReferenceType' => 'CUSTOMER_REFERENCE', 'Value' => 'TC007_07_PT1_ST01_PK01_SNDUS_RCPCA_POS')));
(line #55)?
Newbie
 
Join Date: Sep 2009
Posts: 3
#5: Sep 14 '09

re: CustomerReferences entry not included in FedEx web service request generated via PHP


@Dormilich It didnt make any difference.
Reply

Tags
fedex, php, web service