devain Posted April 2, 2008 Share Posted April 2, 2008 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?? I get the following error on the page Fault Code:HTTP String:Could not connect to host Below is the code and the link that fedex provided to me I am not sure where to use this link in the following code as I am new to soap https links https gatewaybeta.fedex.com:443/web-services development url https gateway.fedex.com:443/web-services production url all files were downloaded from the fedex.com/developer eyeglasses123.com/track.php require_once('fedex-common.php5'); error_reporting(E_ALL); $newline = "<br />"; $path_to_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 ->track($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); } included fedex-common.php5 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())); } wsdl file is located at eyeglasses123.com/TrackService_v2.wsdl log file is located eyeglasses123.com/fedextransaction.log If anyone can get this working or any help on this would be appericated I tried to attach a zip of all the files but I cannot Quote Link to comment https://forums.phpfreaks.com/topic/99276-solved-fedex-new-web-services-wsdl-and-soap-help/ Share on other sites More sharing options...
devain Posted April 15, 2008 Author Share Posted April 15, 2008 By the way thanks everyone for the help with this After removing the generic error codes I came up with this error Fatal error: Uncaught SoapFault exception: [HTTP] Could not connect to host in /home/eye123/public_html/track.php:44 Stack trace: #0 [internal function]: SoapClient->__doRequest(’<?xml version=”...’, ‘https://gateway...’, ‘track’, 1, 0) #1 [internal function]: SoapClient->__call(’track’, Array) #2 /home/eye123/public_html/track.php(44): SoapClient->track(Array) #3 {main} thrown in /home/eye123/public_html/track.php on line 44 Then after a couple of days of trying to figure out what this error was and trying different soap call constructs I decided that it was not the code and turned to my soap install After recompiling soap with the following below I got everything to work So thanks everyone for the help and input --enable-soap' '--enable-sockets' '--enable-wddx' '-- soap Soap Client enabled Soap Server enabled Directive Local Value Master Value soap.wsdl_cache 1 1 soap.wsdl_cache_dir /tmp /tmp soap.wsdl_cache_enabled 1 1 soap.wsdl_cache_limit 5 5 soap.wsdl_cache_ttl 86400 86400 Quote Link to comment https://forums.phpfreaks.com/topic/99276-solved-fedex-new-web-services-wsdl-and-soap-help/#findComment-517821 Share on other sites More sharing options...
angle222 Posted June 6, 2010 Share Posted June 6, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/99276-solved-fedex-new-web-services-wsdl-and-soap-help/#findComment-1068756 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.