views:

92

answers:

1

My iPhone app relies on a vendor's XML feed to provide data. But that feed is not locked down. The vendor could change the format of the XML at any time, although so far they've promised not to.

Since I might want to tell my app to use a different URL for its data source, I'd like to set up a single "Command Central" Web page, on my own server, to direct the app to the correct data source.

In other words, each time my app starts, in the background and unseen by the user, it would visit "http://www.myserver.com/iphoneapp_data_sources.xml" to retrieve the URL for retrieving data from my vendor. That way, if my vendor suddenly changes the exact URL or the XML feed that the app needs, I can update that Web page and ensure that all installations of the app are using the correct XML feed.

Does anyone have any advice or examples showing this kind of approach? It seems as if this must be a common problem, but so far I haven't found a well-established design pattern that fits it.

+4  A: 

Instead of connecting your iPhone app directly to the vendor's XML feed, you could use a page on your own server as a proxy. The iPhone app connects with http://www.yourserver.com/proxyxmlfeed.xml, which redirects to the correct vendor URL, http://www.vendorsserver.com/realxmlfeed.xml. This way, if for some reason the real XML feed URL changes, you only have to change the URL the proxyxmlfeed.xml file redirects to, and you're done!

Douwe Maan
This is exactly how my app handles the external dependency on an XML feed. Works perfectly. It is certainly much more maintainable/nimble to manage this on the server and keep the iPhone "in the dark" if for no other reason than the deployment time for an update is significant.
MystikSpiral
Thanks for the quick suggestion, DouweM. That's definitely a great first step for insulating my app from the vendor's changes.
Chris_K
No problem ;-) If you're happy with my answer, could you perhaps accept it as the answer you were looking for? :-)
Douwe Maan
Done. (Didn't know how to do that before!) :>
Chris_K