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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tankchintan
    New Member
    • Sep 2009
    • 3

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

    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 CustomerReferen ces 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 customerreferen ces fields in the request sent to the server.

    Would you guys happen to know whats the deals with this?
  • TheServant
    Recognized Expert Top Contributor
    • Feb 2008
    • 1168

    #2
    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 CustomerReferen ce fields for processing?

    Comment

    • tankchintan
      New Member
      • Sep 2009
      • 3

      #3
      @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 "CustomerRefere nces" in it - even though I explicitly mention that in my PHP code.
      3. I need to CustomerReferen ces field to be displayed on the final output - which is possible only if they are present in the request object.


      PHP CODE

      Code:
      $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' => $DEVELOPER_KEY, 'Password' => $DEVELOPER_PASSWORD)); // Replace 'XXX' and 'YYY' with FedEx provided credentials 
      $request['ClientDetail'] = array('AccountNumber' => $FEDEX_ACCOUNT_NUMBER, 'MeterNumber' => $FEDEX_METER_NUMBER);// Replace 'XXX' with your account and meter number
      $request['TransactionDetail'] = array('CustomerTransactionId' => '*** Ground International Shipping Request v7 using PHP ***');
      $request['Version'] = array('ServiceId' => 'ship', 'Major' => '7', 'Intermediate' => '0', 'Minor' => '0');
      $request['RequestedShipment'] = array('ShipTimestamp' => date('c'),
                                          'DropoffType' => 'REGULAR_PICKUP', // valid values REGULAR_PICKUP, REQUEST_COURIER, DROP_BOX, BUSINESS_SERVICE_CENTER and STATION
                                          'ServiceType' => 'FEDEX_GROUND', // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
                                          'PackagingType' => 'YOUR_PACKAGING', // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
                                          'Shipper' => array('Contact' => array('PersonName' => 'Sender Name',
                                                                                'CompanyName' => 'Company Name',
                                                                                'PhoneNumber' => '0805522713'),
                                                             'Address' => array('StreetLines' => array('Address Line 1'),
                                                                                'City' => 'Memphis',
                                                                                'StateOrProvinceCode' => 'TN',
                                                                                'PostalCode' => '38110',
                                                                                'CountryCode' => 'US')),
                                          'Recipient' => array('Contact' => array('PersonName' => 'Recipient Name',
                                                                                  'CompanyName' => 'Company Name',
                                                                                  'PhoneNumber' => '9012637906'),
                                                               'Address' => array('StreetLines' => array('Address Line 1'),
                                                                                  'City' => 'Richmond',
                                                                                  'StateOrProvinceCode' => 'BC',
                                                                                  'PostalCode' => 'V7C4V4',
                                                                                  'CountryCode' => 'CA',
                                                                                  'Residential' => false)),
                                          'ShippingChargesPayment' => array('PaymentType' => 'SENDER', // valid values RECIPIENT, SENDER and THIRD_PARTY
                                                                            'Payor' => array('AccountNumber' => $FEDEX_ACCOUNT_NUMBER, // Replace 'XXX' with payors account number
                                                                                             'CountryCode' => 'US')),
                                          'InternationalDetail' => array('DutiesPayment' => array('PaymentType' => 'SENDER', // valid values RECIPIENT, SENDER and THIRD_PARTY
                                                                                                  'Payor' => array('AccountNumber' => $FEDEX_ACCOUNT_NUMBER, // Replace 'XXX' with payor's account number
                                                                                                  'CountryCode' => 'CA')),
                                                                         'DocumentContent' => 'DOCUMENTS_ONLY',                                                                                            
                                                                         'CustomsValue' => array('Amount' => 100.0, 'Currency' => 'USD'),
                                                                         'Commodities' => array('0' => array('NumberOfPieces' => 1,
                                                                                                             'Description' => 'Books',
                                                                                                             'CountryOfManufacture' => 'US',
                                                                                                             'Weight' => array('Value' => 1.0, 'Units' => 'LB'),
                                                                                                             'Quantity' => 1,
                                                                                                             'QuantityUnits' => 'EA',
                                                                                                             'UnitPrice' => array('Amount' => 1.000000, 'Currency' => 'USD'),
                                                                                                             'CustomsValue' => array('Amount' => 100.000000, 'Currency' => 'USD'))),
                                                                         'ExportDetail' => array('B13AFilingOption' => 'FILED_ELECTRONICALLY')),                                                                                                       
                                          'LabelSpecification' => array('LabelFormatType' => 'COMMON2D', // valid values COMMON2D, LABEL_DATA_ONLY
                                                                        'ImageType' => 'PNG',  // valid values DPL, EPL2, PDF, ZPLII and PNG
                                                                        'LabelStockType' => 'PAPER_7X4.75'), 
                                          'RateRequestTypes' => array('ACCOUNT'), // valid values ACCOUNT and LIST
                                          'PackageCount' => 1,
                                          'PackageDetail' => 'INDIVIDUAL_PACKAGES',                                        
                                          'RequestedPackageLineItems' => array('SequenceNumber' => 1,
                                                                       'Weight' => array('Value' => 20.0, 'Units' => 'LB')), // valid values LB and KG
                                                                       'CustomerReferences' => array('0' => array('CustomerReferenceType' => 'CUSTOMER_REFERENCE', 'Value' => 'TC007_07_PT1_ST01_PK01_SNDUS_RCPCA_POS')));
      
      $response = $client->processShipment($request); // FedEx web service invocation
      Expected XML Output

      Code:
      ... XML Stuff ...
      <ns1:RequestedPackageLineItems>
                                      <ns1:SequenceNumber>1</ns1:SequenceNumber>
                                      <ns1:Weight>
                                              <ns1:Units>LB</ns1:Units>
                                              <ns1:Value>20</ns1:Value>
                                      </ns1:Weight>
                                      <ns1:CustomerReferences>
                                              <ns1:CustomerReferenceType>CUSTOMER_REFERENCE</ns1:CustomerReferenceType>
                                              <ns1:Value>I am a customer reference</ns1:Value>
                                      </ns1:CustomerReferences>
                              </ns1:RequestedPackageLineItems>
      ... XML Stuff ...
      Current XML Output

      Code:
      ... XML Stuff ...
                            <ns1:RequestedPackageLineItems>
                                      <ns1:SequenceNumber>1</ns1:SequenceNumber>
                                      <ns1:Weight>
                                              <ns1:Units>LB</ns1:Units>
                                              <ns1:Value>20</ns1:Value>
                                      </ns1:Weight>           
                              </ns1:RequestedPackageLineItems>
      ... XML Stuff ...

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        what if you try
        Code:
        'CustomerReferences' => array('CustomerReferenceType' => 'CUSTOMER_REFERENCE', 'Value' => 'TC007_07_PT1_ST01_PK01_SNDUS_RCPCA_POS'));
        instead of
        Code:
        'CustomerReferences' => array('0' => array('CustomerReferenceType' => 'CUSTOMER_REFERENCE', 'Value' => 'TC007_07_PT1_ST01_PK01_SNDUS_RCPCA_POS')));
        (line #55)?

        Comment

        • tankchintan
          New Member
          • Sep 2009
          • 3

          #5
          @Dormilich It didnt make any difference.

          Comment

          • tgk4
            New Member
            • Nov 2008
            • 2

            #6
            Originally posted by tankchintan
            @Dormilich It didnt make any difference.
            tankchintan,

            I know this is an old post, but did you ever get it working?

            Comment

            • delickate
              New Member
              • Feb 2007
              • 2

              #7
              I've solved that issue.
              Put your customer reference number under RequestedPackag eLineItems

              like this:

              Code:
              'Dimensions' => array(
              			'Length' => 20,
              			'Width' => 20,
              			'Height' => 10,
              			'Units' => 'IN'),
              			'CustomerReferences' => array(
              											'0' => array(
              												'CustomerReferenceType' => 'CUSTOMER_REFERENCE', 
              												'Value' => '123456'
              										))
              Hope it'll work for you.

              Comment

              Working...