I created a SOAP server outside of Magento (lets call it http://www.example.com/soap/). The directory /soap looks like this:
example.wsdl
example_server.php
There are helper classes that I’m ignoring because the users don’t see those. What I want to do is move this code into a Magento module and use the router to avoid forcing users to change their URLs. Is this possible? For example, when a user requests http://www.example.com/soap/example.wsdl I want to route that to My_Newsoap_IndexController::wsdlAction().
This is what I’ve got in my config.xml right now:
<frontend>
<routers>
<newsoap>
<use>standard</use>
<args>
<module>My_Newsoap</module>
<frontName>soap</frontName>
</args>
</newsoap>
</routers>
</frontend>
Conditional yes, but not the way you’re thinking. The
<routers/>tags in the Magento config setup a very specific sort of routing. In plain english, you can say“URLs that start with this
<frontName/>should be handled by this module”Outside of that though, there’s no further way to setup custom routes by configuration alone.
What you can do is configure a custom router object, and then write PHP code to implement your routing logic however you want to. The how of this goes beyond a simple Stack Overflow answer, but you can get the full story in this series of articles, or see an example of custom routing in the simple page module, (self links).