4

We have a multistore magento setup thats still half in development. But we have 1 of the stores open with a test url.

e.g test.domain.com

However when we go to: http://test.domain.com/index.php/api/index/?wsdl=1 I noticed that soap:address shows the main domain not the api url e.g:

<soap:address location="https://www.domain.com/index.php/api/index/index/?SID=vnl0ijdobf6ldj76pmc658rj92"/>

Which atm isn't live. We have no issues with 3rd parties who come in on the V2 api but this doesn't seem to have a soap:address which I believe is the problem.

When I go to: http://test.domain.com/index.php/api/index/?wsdl=1 in a browser it shows xml. When I try and make a soap call i get: looks like we got no XML document.

When I update my local hosts file with the new ip to point at the domain it will work. But the 3rd party can't update their server because its shared hosting. Is there a way to change the API to point at the api url and not the base store url?

1

Try and set the store url in admin as {{base_url}} (this must be changed before you go live). Using that magento will use whatever domain as used to call the site.

Update, after OP comments:

If you trace the code on how the WSDL gets built, you will find the wsdl.xml file in app/code/core/Mage/Api/etc/wsdl.xml

at the end of that file:

<service name="{{var wsdl.name}}Service">
        <port name="{{var wsdl.handler}}Port" binding="typens:{{var wsdl.handler}}Binding">
            <soap:address location="{{var wsdl.url}}" />
        </port>
    </service>

thus magento populates the url in the file from a var called wsdl.url.

Searching the code for where that gets populated reveals:

Mage_Api_Model_Server_Adapter_Soap::run

$wsdlConfig->setUrl(
                htmlspecialchars(Mage::getUrl('*/*/*', array('_query'=>$queryParams) ))
            );

Thus the url is generated using standard magento getUrl method, thus reading it from your config.

So it is very likely that you changed the wrong one. Did you change the default base url, or the site base url? Try the other, or both.

Alternatively, you can copy the wsdl.xml to your local folder, and temporarily override it and hard-code the address. This is a really bad hack, and should try not to do it, but should help you get your testing done ;) It is most likely that you'd need to do this elsewhere, so I would do that as a last resort only.

  • Hi Proxi, i changed the default store to use {{base_url}} and also my sub domain store neither seem to change the soap address. Would i need to reindex / cache clear for it to take effect? – Andy Archer Aug 19 '13 at 9:09
  • Refreshing the cache and indexes didn't seem to work either :( – Andy Archer Aug 19 '13 at 10:20
  • Did you change the main base url, or that of the store? This should have worked, magento is still getting the address from somewhere as your 'base_url'. I updated my answer with some more info, and a 'hack' to get around your issue. (bad bad me) – ProxiBlue Aug 20 '13 at 3:05
  • Hi Proxie, i think there was issues going on with the 'custom admin url' being used rather than using the the local.xml way of updating the custom admin url. Once i removed this and then went back to default store and change my default base url to my test domain it started working - thanks for your help :) – Andy Archer Aug 29 '13 at 9:39
1

In my case the 'use custom admin url' was being used:

admin -> admin base url -> use custom admin url - normally i'd use the option of changing local.xml to set my admin url.

once i removed this and set my default base url it changed correctly in the soap api but still i can only have that then as my soap:address on all sites i went to on that api.

i can only think this is maybe a weird Nginx setup issue. as it seems to work without issue on my local apache environment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.