Jump to content

PrestaShopWebserviceExecption - HTTP Error 302


Recommended Posts

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

  • 4 weeks later...
  • 1 month later...
  • 2 weeks later...
  • 9 months later...

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

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

  • 2 months later...
  • 2 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...