antonb Posted May 19, 2008 Share Posted May 19, 2008 When I run it I get an error saying: "Parse error: syntax error, unexpected '{' ...on line 56" Then, when I get rid of the "{" I get this: "Parse error: syntax error, unexpected T_VARIABLE" ... on line 57" Here is the code from the php file. If for some reason you need the whole thing let me know and I'll post it; "try" is line 55 and the curly bracket after it is line 56. try { $response = $client->__soapCall("rateAvailableServices", array('parameters' => $request)); if ($response->HighestSeverity != 'FAILURE' && $response->HighestSeverity != 'ERROR') { 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); } On an unrelated note, I can't seem to get the SOAP module working in my test environment. Grrrrrr. I working on my 1 and 1 space. :-\ Link to comment https://forums.phpfreaks.com/topic/106363-i-cant-figure-out-whats-wrong-with-this-code/ Share on other sites More sharing options...
wildteen88 Posted May 19, 2008 Share Posted May 19, 2008 There are no errors in that code you posted. Link to comment https://forums.phpfreaks.com/topic/106363-i-cant-figure-out-whats-wrong-with-this-code/#findComment-545197 Share on other sites More sharing options...
rhodesa Posted May 19, 2008 Share Posted May 19, 2008 agreed...most likely it's code before those lines...post more code please Link to comment https://forums.phpfreaks.com/topic/106363-i-cant-figure-out-whats-wrong-with-this-code/#findComment-545199 Share on other sites More sharing options...
antonb Posted May 19, 2008 Author Share Posted May 19, 2008 Here is the whole thing with my dev. information taken out of it. <?php // Copyright 2008, FedEx Corporation. All rights reserved. // Version 2.0.0 chdir('..'); require_once('library/fedex-common.php5'); $newline = "<br />"; $path_to_wsdl = "wsdl/RateAvailableServicesService_v2.wsdl"; ini_set("soap.wsdl_cache_enabled", "0"); $client = new SoapClient($path_to_wsdl, array('trace' => 1)); // replace with path to WSDL $request['WebAuthenticationDetail'] = array('UserCredential' => array('Key' => XXX', 'Password' => 'XXX')); // Replace 'XXX' and 'YYY' with FedEx provided credentials $request['ClientDetail'] = array('AccountNumber' => 'XXX', 'MeterNumber' => 'XXX');// Replace 'XXX' with your account and meter number $request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Rate Available Service Request v2 using PHP ***'); $request['Version'] = array('ServiceId' => 'crss', 'Major' => '2', 'Intermediate' => '0', Minor => '0'); $request['Origin'] = array('StreetLines' => array('Sender Address Line 1'), // Origin details 'City' => 'Sender City', 'StateOrProvinceCode' => 'TX', 'PostalCode' => '73301', 'CountryCode' => 'US'); $request['Destination'] = array('StreetLines' => array('Destination Address Line 1'), // Destination details 'City' => 'Recipient City', 'StateOrProvinceCode' => 'TN', 'PostalCode' => '38016', 'CountryCode' => 'US'); $request['CurrencyType'] = 'USD'; $request['DropoffType'] = 'REGULAR_PICKUP'; // valid codes BUSINESS_SERVICE_CENTER, DROP_BOX, REGULAR_PICKUP, REQUEST_COURIER and STATION $request['CarrierCode'] = 'FDXE'; // valid codes FDXE-Express, FDXG-Ground, FDXC-Cargo, FXCC-Custom Critical and FXFR-Freight $request['ServiceType'] = 'PRIORITY_OVERNIGHT'; // valid codes FIRST_OVERNIGHT, PRIORITY_OVERNIGHT, ... $request['PackagingType'] = 'YOUR_PACKAGING'; // valid codes YOUR_PACKAGING, FEDEX_ENVELOPE, FEDEX_BOX, ... $request['ShipDate'] = date('Y-m-d'); $request['RateRequestTypes'] = 'ACCOUNT'; // valid codes ACCOUNT and LIST $request['RateRequestTypes'] = 'LIST'; // valid codes ACCOUNT and LIST $request['RateRequestPackageSummary'] = array('PieceCount' => 1, 'TotalWeight' => array('Value' => 20, 'Units' => 'LB'), // valid codes LB and KG 'PerPieceDimensions' => array('Length' => 20, 'Width' => 20, 'Height' => 20, 'Units' => 'IN'), // valid code CM and IN 'SpecialServicesRequested' => array('SpecialServiceTypes' => 'DANGEROUS_GOODS', // valid codes DANGEROUS_GOODS, APPOINTMENT_DELIVERY, ... 'DangerousGoodsDetail' => array('Accessibility' => 'ACCESSIBLE'))); // valid codes ACCESSIBLE and INACCESSIBLE try { $response = $client->__soapCall("rateAvailableServices", array('parameters' => $request)); if ($response->HighestSeverity != 'FAILURE' && $response->HighestSeverity != 'ERROR') { 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); } ?> Link to comment https://forums.phpfreaks.com/topic/106363-i-cant-figure-out-whats-wrong-with-this-code/#findComment-545210 Share on other sites More sharing options...
wildteen88 Posted May 19, 2008 Share Posted May 19, 2008 No errors in that either! Are you sure the error is comming from that file? Can you post the full error message here. Link to comment https://forums.phpfreaks.com/topic/106363-i-cant-figure-out-whats-wrong-with-this-code/#findComment-545212 Share on other sites More sharing options...
antonb Posted May 19, 2008 Author Share Posted May 19, 2008 Parse error: syntax error, unexpected '{' in /homepages/37/d113983920/htdocs/ambpcs/egt/Rate/calcwsdl.php on line 56 Link to comment https://forums.phpfreaks.com/topic/106363-i-cant-figure-out-whats-wrong-with-this-code/#findComment-545215 Share on other sites More sharing options...
jonsjava Posted May 19, 2008 Share Posted May 19, 2008 found your error: <?php // Copyright 2008, FedEx Corporation. All rights reserved. // Version 2.0.0 chdir('..'); require_once('library/fedex-common.php5'); $newline = "<br />"; $path_to_wsdl = "wsdl/RateAvailableServicesService_v2.wsdl"; ini_set("soap.wsdl_cache_enabled", "0"); $client = new SoapClient($path_to_wsdl, array('trace' => 1)); // replace with path to WSDL $request['WebAuthenticationDetail'] = array('UserCredential' => array('Key' => 'XXX', 'Password' => 'XXX')); // Replace 'XXX' and 'YYY' with FedEx provided credentials $request['ClientDetail'] = array('AccountNumber' => 'XXX', 'MeterNumber' => 'XXX');// Replace 'XXX' with your account and meter number $request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Rate Available Service Request v2 using PHP ***'); $request['Version'] = array('ServiceId' => 'crss', 'Major' => '2', 'Intermediate' => '0', Minor => '0'); $request['Origin'] = array('StreetLines' => array('Sender Address Line 1'), // Origin details 'City' => 'Sender City', 'StateOrProvinceCode' => 'TX', 'PostalCode' => '73301', 'CountryCode' => 'US'); $request['Destination'] = array('StreetLines' => array('Destination Address Line 1'), // Destination details 'City' => 'Recipient City', 'StateOrProvinceCode' => 'TN', 'PostalCode' => '38016', 'CountryCode' => 'US'); $request['CurrencyType'] = 'USD'; $request['DropoffType'] = 'REGULAR_PICKUP'; // valid codes BUSINESS_SERVICE_CENTER, DROP_BOX, REGULAR_PICKUP, REQUEST_COURIER and STATION $request['CarrierCode'] = 'FDXE'; // valid codes FDXE-Express, FDXG-Ground, FDXC-Cargo, FXCC-Custom Critical and FXFR-Freight $request['ServiceType'] = 'PRIORITY_OVERNIGHT'; // valid codes FIRST_OVERNIGHT, PRIORITY_OVERNIGHT, ... $request['PackagingType'] = 'YOUR_PACKAGING'; // valid codes YOUR_PACKAGING, FEDEX_ENVELOPE, FEDEX_BOX, ... $request['ShipDate'] = date('Y-m-d'); $request['RateRequestTypes'] = 'ACCOUNT'; // valid codes ACCOUNT and LIST $request['RateRequestTypes'] = 'LIST'; // valid codes ACCOUNT and LIST $request['RateRequestPackageSummary'] = array('PieceCount' => 1, 'TotalWeight' => array('Value' => 20, 'Units' => 'LB'), // valid codes LB and KG 'PerPieceDimensions' => array('Length' => 20, 'Width' => 20, 'Height' => 20, 'Units' => 'IN'), // valid code CM and IN 'SpecialServicesRequested' => array('SpecialServiceTypes' => 'DANGEROUS_GOODS', // valid codes DANGEROUS_GOODS, APPOINTMENT_DELIVERY, ... 'DangerousGoodsDetail' => array('Accessibility' => 'ACCESSIBLE'))); // valid codes ACCESSIBLE and INACCESSIBLE try { $response = $client->__soapCall("rateAvailableServices", array('parameters' => $request)); if ($response->HighestSeverity != 'FAILURE' && $response->HighestSeverity != 'ERROR') { 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); } ?> it was in one of your arrays. Link to comment https://forums.phpfreaks.com/topic/106363-i-cant-figure-out-whats-wrong-with-this-code/#findComment-545217 Share on other sites More sharing options...
rhodesa Posted May 19, 2008 Share Posted May 19, 2008 No, I am guessing he just accidentally removed that quote when putting in the XXXs. Are you using PHP4? try/catch wasn't implemented until PHP5 Link to comment https://forums.phpfreaks.com/topic/106363-i-cant-figure-out-whats-wrong-with-this-code/#findComment-545219 Share on other sites More sharing options...
antonb Posted May 19, 2008 Author Share Posted May 19, 2008 No, I am guessing he just accidentally removed that quote when putting in the XXXs. Are you using PHP4? try/catch wasn't implemented until PHP5 I did accidentally delete that quote. I need to check what version of PHP 1and1 is using. I have version 5 going in my test environment but I can't get my SOAP module to work. Link to comment https://forums.phpfreaks.com/topic/106363-i-cant-figure-out-whats-wrong-with-this-code/#findComment-545224 Share on other sites More sharing options...
antonb Posted May 19, 2008 Author Share Posted May 19, 2008 UGH, it's version 4... I need to setup a LAMP server or something because my Windows test environment is a pain in the ass. Thank's for the help! Link to comment https://forums.phpfreaks.com/topic/106363-i-cant-figure-out-whats-wrong-with-this-code/#findComment-545226 Share on other sites More sharing options...
rhodesa Posted May 19, 2008 Share Posted May 19, 2008 Windows test environment? Install WAMP: http://www.en.wampserver.com/ Link to comment https://forums.phpfreaks.com/topic/106363-i-cant-figure-out-whats-wrong-with-this-code/#findComment-545235 Share on other sites More sharing options...
antonb Posted May 20, 2008 Author Share Posted May 20, 2008 Today I was able to get all of the kinks worked out of my code and sever so I am now able to send and receive using SOAP. Now all I need to do is format the SOAP reply... can anyone point me in the right direction for this? I only want to display a few of the returned fields; any suggestions are welcome. Link to comment https://forums.phpfreaks.com/topic/106363-i-cant-figure-out-whats-wrong-with-this-code/#findComment-545818 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.