axetone Posted January 26, 2013 Share Posted January 26, 2013 All, I have had a storefront running for some time and updating the catalog using Prestashop WebService. Recently, while running an import script I received a Fatal Error (see below) that appears to be sourced from a failure in the PrestaShopWebservice->get( ) function call. My initial expectation is that this would have been an Apache server failing to send the response, but from what I can tell everything on the Apache server is configured correctly, and has been running with no changes to server configuration for over a year. I am asking for any help towards isolating the real issue as to why the Webservice failed in this instance? Lastly, I do know that my Presatshop was upgraded from 1.4.9- to 1.5.3- about 6 months ago , but so I am certain that the upgrade would have had no cause for this failure, EXCEPT PERHAPS that the version of Webservice itself (as a module) should need replacing...??? This is just a theory / question. I don't know if that should even be a concern, or is even possible -but I got the idea from noticing a version verification control function within the php webservice configuraiton...but I doubt that really is why the Fatal Error below is occurring. Please help! Thank You!!! ( ! ) Fatal error: Uncaught exception 'PrestaShopWebserviceException' with message 'This call to PrestaShop Web Services returned an unexpected HTTP status of:302' in C:\wamp\www\ArcheryWorldUSA\Scripts\prestashop\PSWebServiceLibrary.php on line 93 ( ! ) PrestaShopWebserviceException: This call to PrestaShop Web Services returned an unexpected HTTP status of:302 in C:\wamp\www\ArcheryWorldUSA\Scripts\prestashop\PSWebServiceLibrary.php on line 93 Call Stack # Time Memory Function Location 1 0.0019 172008 {main}( ) ..\prestashop_import.php:0 2 0.0379 227880 ImportController->DoImport( ) ..\prestashop_import.php:223 3 0.0379 228552 Convert->XML2Product( ) ..\prestashop_import.php:216 4 1.0660 3669624 Convert->GetByResourceId( ) ..\prestashop_import.php:132 5 1.0661 3670432 PrestaShopWebservice->get( ) ..\prestashop_import.php:44 6 1.2883 3672224 PrestaShopWebservice->checkStatusCode( ) ..\PSWebServiceLibrary.php:277 APACHE LOG FILE: [sat Jan 26 12:24:45 2013] [error] [client 127.0.0.1] PHP Fatal error: Uncaught exception 'PrestaShopWebserviceException' with message 'This call to PrestaShop Web Services returned an unexpected HTTP status of:302' in C:\\wamp\\www\\ArcheryWorldUSA\\Scripts\\prestashop\\PSWebServiceLibrary.php:93\nStack trace:\n#0 C:\\wamp\\www\\ArcheryWorldUSA\\Scripts\\prestashop\\PSWebServiceLibrary.php(277): PrestaShopWebservice->checkStatusCode(302)\n#1 C:\\wamp\\www\\ArcheryWorldUSA\\Scripts\\prestashop\\prestashop_import.php(44): PrestaShopWebservice->get(Array)\n#2 C:\\wamp\\www\\ArcheryWorldUSA\\Scripts\\prestashop\\prestashop_import.php(132): Convert->GetByResourceId(Object(PrestaShopWebservice), 'AA02')\n#3 C:\\wamp\\www\\ArcheryWorldUSA\\Scripts\\prestashop\\prestashop_import.php(216): Convert->XML2Product('../files/simple...', Object(ConvertOptions))\n#4 C:\\wamp\\www\\ArcheryWorldUSA\\Scripts\\prestashop\\prestashop_import.php(223): ImportController->DoImport()\n#5 {main}\n thrown in C:\\wamp\\www\\ArcheryWorldUSA\\Scripts\\prestashop\\PSWebServiceLibrary.php on line 93 Link to comment Share on other sites More sharing options...
alfathony Posted February 18, 2013 Share Posted February 18, 2013 i have same . who some body help me Link to comment Share on other sites More sharing options...
aGeS67 Posted April 15, 2013 Share Posted April 15, 2013 Same problem.. Link to comment Share on other sites More sharing options...
romulodertinati Posted April 23, 2013 Share Posted April 23, 2013 Same Problem! Link to comment Share on other sites More sharing options...
peorthyr Posted February 10, 2014 Share Posted February 10, 2014 Same problem here. error 302 during the webservice actions. HTTP/1.1 302 FoundDate: Mon, 10 Feb 2014 22:10:50 GMTServer: Apache/2.2.16 (Debian)X-Powered-By: PHP/5.3.3-7+squeeze18location: http://myserver.com/api/categories?schema=blank?url=categories&schema=blankVary: Accept-EncodingContent-Length: 0Content-Type: text/html; charset=utf-8 Link to comment Share on other sites More sharing options...
peorthyr Posted February 11, 2014 Share Posted February 11, 2014 i have done a bit of debug. first in the webservice library, i have added this status code 302 to the function that throws errors: protected function checkStatusCode($status_code) { $error_label = 'This call to PrestaShop Web Services failed and returned an HTTP status of %d. That means: %s.'; switch($status_code) { case 200: case 201: case 302: break; case 204: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'No content'));break; case 400: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Bad Request'));break; case 401: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Unauthorized'));break; case 404: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Not Found'));break; case 405: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Method Not Allowed'));break; case 500: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Internal Server Error'));break; default: throw new PrestaShopWebserviceException('This call to PrestaShop Web Services returned an unexpected HTTP status of:' . $status_code); } } just to go ahead. then i have modified the function parseXML($response) to let it return the xml in any case. i'll update when i got something new. Link to comment Share on other sites More sharing options...
peorthyr Posted February 11, 2014 Share Posted February 11, 2014 digging some more, it seems that there are some problems with the encoding, i mean, in the 302 response, there is a "location" parameter, which, if i put in the browser, bring me to an empty xml, but if i decode the url, but putting the brackets, all looks fine and the xml is well formed... i'm trying to undestand where the encoding is done. Link to comment Share on other sites More sharing options...
kornett Posted April 13, 2014 Share Posted April 13, 2014 (edited) just remove the "www" from PS_SHOP_PATH constant... define('PS_SHOP_PATH', 'http://mysite.com'); Edited April 13, 2014 by kornett (see edit history) 2 Link to comment Share on other sites More sharing options...
dravek Posted April 21, 2016 Share Posted April 21, 2016 Thanks So much! I had the same problem but removing www solved it! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now