Page 1 of 1

Fedex New Web Services WSDL and SOAP

Posted: Thu Mar 06, 2008 3:47 pm
by devain
Hello Everyone
I am having issues with fexex's new soap and WSDL web services. I am trying to get tracking results with their new service was wondering if I can get some help on this. I am attaching the code, and the wsdl What am I doing wrong??
Here are two of the links that fedex gave me two are in the wsdl file and one I dont know what to do with and fedex was no help they did provide the following code which I am posting below it consists of three files the wsdl, a functions file for error and tracking and the track.php code which is suppose to be loaded via http
Track.php file

I get the following error on the page



Fault
Code:HTTP
String:Could not connect to host

Code: Select all

 
 
 
// Copyright 2008, FedEx Corporation. All rights reserved.
// Version 2.0.0
 
chdir('..'); 
 
require_once('library/fedex-common.php5');
 
$newline = "<br />"; 
$path_to_wsdl = "http://www.eyeglasses123.com/track/wsdl/TrackService_v2.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' => 'Nu7mKVoi6CruG3BH', 'Password' => '2WTI0OChPx1U7yprVqjosFpM7')); // Replace 'XXX' and 'YYY' with FedEx provided credentials 
$request['ClientDetail'] = array('AccountNumber' => '510087542', 'MeterNumber' => '1220784');// Replace 'XXX' with your account and meter number
$request['TransactionDetail'] = array('CustomerTransactionId' => '*** Track Request v2 using PHP ***');
$request['Version'] = array('ServiceId' => 'trck', 'Major' => '2', 'Intermediate' => '0', 'Minor' => '0');
$request['PackageIdentifier'] = array('Value' => '791135731525', // Replace with a valid tracking identifier
                                      'Type' => 'TRACKING_NUMBER_OR_DOORTAG');
$request['IncludeDetailedScans'] = 1;
 
try 
{
    $response = $client->__soapCall("track", array('parameters' => $request));
 
    if ($response -> HighestSeverity != 'FAILURE' && $response -> HighestSeverity != 'ERROR')
    {
        foreach ($response -> TrackDetails -> Events as $event)
        {
            if(is_array($response -> TrackDetails -> Events))
            {              
               echo $event -> Timestamp . ':  ';
               echo $event -> EventDescription . ' - ';
               echo $event -> Address -> City . ' ';
               echo $event -> Address -> StateOrProvinceCode . $newline;
            }
            else
            {
                echo $location . $newline;
            }
        }
        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);
}
    
     
 

library/fedex-common.php5

Code: Select all

 
 
// Copyright 2008, FedEx Corporation. All rights reserved.
 
define('TRANSACTIONS_LOG_FILE', 'fedextransactions.log');  // Transactions log file
 
/**
 *  Print SOAP request and response
 */
function printRequestResponse($client) {
  echo '<h2>Transaction processed successfully.</h2>'. "\n"; 
  echo '<h2>Request</h2>' . "\n";
  echo '<pre>' . htmlspecialchars($client->__getLastRequest()). '</pre>';  
  echo "\n";
   
  echo '<h2>Response</h2>'. "\n";
  echo '<pre>' . htmlspecialchars($client->__getLastResponse()). '</pre>';
  echo "\n";
}
 
/**
 *  Print SOAP Fault
 */  
function printFault($exception, $client) {
    echo '<h2>Fault</h2>' . "\n";                        
    echo "<b>Code:</b>{$exception->faultcode}<br>\n";
    echo "<b>String:</b>{$exception->faultstring}<br>\n";
    writeToLog($client);
}
 
/**
 * SOAP request/response logging to a file
 */                                  
function writeToLog($client){  
if (!$logfile = fopen(TRANSACTIONS_LOG_FILE, "a"))
{
   error_func("Cannot open " . TRANSACTIONS_LOG_FILE . " file.\n", 0);
   exit(1);
}
 
fwrite($logfile, sprintf("\r%s:- %s",date("D M j G:i:s T Y"), $client->__getLastRequest(). "\n\n" . $client->__getLastResponse()));
}
 
 

Here is the location of the test Track.php that is suppose to load the wsdl and connect using soap to get information

eyeglasses123.com/track/Track/Track.php

Here is the location of the wsdl file that is used

eyeglasses123.com/track/wsdl/TrackService_v2.wsdl

Here is the location of the log file
eyeglasses123.com/track/fedextransactions.log


I cant for the life of me figure out what I am doing wrong any help would be appericated

I also called fedex to get the url to do the actual call to their site and that is as follows https://gatewaybeta.fedex.com:443/web-services I am not exactly sure how or where to use this url

Any help would be greatly appericated

Re: Fedex New Web Services WSDL and SOAP

Posted: Thu Mar 06, 2008 8:25 pm
by devain
Anyone ?

Re: Fedex New Web Services WSDL and SOAP

Posted: Tue Apr 01, 2008 3:29 pm
by devain
Some help if anyone has tried getting fedex web-services working would be greatly appericated

Re: Fedex New Web Services WSDL and SOAP

Posted: Wed Apr 09, 2008 2:14 pm
by devain
I have modified the script to remove its internal error_logging and made a actual soap call Now I can see the full extent of the soap error if anyone knows what this is or how to fix it would be appericated

Fatal error: Uncaught SoapFault exception: [HTTP] Could not connect to host in /home/eye123/public_html/track.php:19 Stack trace: #0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'https://gateway...', 'track', 1, 0) #1 /home/eye123/public_html/track.php(19): SoapClient->__soapCall('track', Array) #2 {main} thrown in /home/eye123/public_html/track.php on line 19

Re: Fedex New Web Services WSDL and SOAP

Posted: Fri Aug 08, 2008 12:48 pm
by msnyder909
I am hosted on G*Daddy and I was having this same problem. Adding the proxy_host and proxy_port allowed me to connect.

Added:
$client = new SoapClient($path_to_wsdl, array('trace' => 1,'proxy_host' => 'proxy.shr.secureserver.net', 'proxy_port' => 3128));

What's odd is that now, using the same script that authenticates on one server, I am getting:

ERROR
prof
1000
Authentication Failed

Any help would be appreciated.

Re: Fedex New Web Services WSDL and SOAP

Posted: Sun Jun 06, 2010 5:35 pm
by angle222
Well, according to the WSDL, the service is located at http://www.coogiclothingmall.com/news/Term-of-use.html. Unfortunately, there is no web service available at this location (This is why you get the "Could not connect to host" message

. I have also tried http://www.coogiclothingmall.com/news/About-Us.html but this gives me a "Method Not Allowed" error.

It seems that Fedex has moved their web service. You will need to contact them to find out where it has moved.

Re: Fedex New Web Services WSDL and SOAP

Posted: Mon Jun 14, 2010 11:20 am
by johnhao
I cant for the life of me figure out what I am doing wrong any help would be appericated

I also called fedex to get the url to do the actual call to their site and that is as follows http://www.cheapretrojordan.com/wholesa ... 75_p1.html I am not exactly sure how or where to use this url