v2_Soap API on Elastic Beanstalk Setup Stopped Working After 1.81 Upgrade

adminapice-1.8.1.0soap

Currently, I have my app servers deployed through Amazon Web Services Elastic Beanstalk. I have a separate EC2 instance set up as a backend admin server that is only accessible from our office. The admin server also shares the media folder with the app servers through NFS.

I have recently upgraded everything to CE 1.8.1 and installed the latest patches. I just noticed that the magento API stopped working – specifically v2_soap, although none of them seem to work. If I remember correctly, everything worked fairly well in 1.7. It probably even worked in 1.8. I am currently in the middle of testing the previous versions to make sure.

If I enter any of the following (as well as other variations) in a browser, I get a wsdl:

http://www.example.com/api/v2_soap?wsdl 
http://www.example.com/index.php/api/v2_soap?wsdl\
http://www.example.com/index.php/api/v2_soap/index/?wsdl

But in the wsdl, the <soap:address location> is

http://admin.example.com/index.php/api/V2_soap/index/ 

in all 3 cases.

Entering that url or the url with a ?wsdl at the end redirects me to the frontend www.example.com. Pretty much anything starting with admin.example.com/index.php redirects to the frontend(exception is index.php/admin).

Trying to post a soap request (login) to that admin soap address using Firefox SOA client returns

SOAP-ERROR: Parsing WSDL: Couldn't load from
'http://admin.example.com/index.php/api/v2_soap/index/?wsdl=1' :
failed to load external entity
"http://admin.example.com/index.php/api/v2_soap/index/?wsdl=1"

Similar results with my vb.net program that I wrote for syncing inventory.

I've also tried a bunch of other stuff. i tried posting soap to

http://www.example.com/index.php/api/v2_soap/index/

and other variations. No luck with anything.

The only way that I can get a wsdl through the admin server without getting redirected is to go to:

http://admin.example.com/api.php?type=v2_soap&wsdl=1

But that gives a <soap:address location> of

http://admin.example.com/index.php/?type=v2_soap

which is weird and useless. I tried a lot of other stuff, like changing the api server rewrites on the app and admin servers in .htaccess. NOthing seems to work.

Does anyone know if there were any changes in 1.81, the patches or 1.8 that might cause this odd behavior? Or did I change something else that resulted in this weird behavior?

Edit: I forgot an important fact. If I don't use the admin server (No to "Use Custom Admin URL"), the api works fine.

Best Answer

I had Auto-redirect to Base Url set to Yes for some reason. Setting it to No seems to have fixed it. I hope someone finds this useful.

The configuration can be viewed from System > Web > Url Options.

Related Topic