An alternative to creating a proper web service for the iPhone app to use

I am developing an iPhone application for a client. Among other things, the application will allow users to view and place orders for specific (tangible) products.

The client has a website that is currently doing a similar thing, and due to the limited budget and the fact that the website works on a third-party platform on which they have no control, we are exploring possible alternatives to creating a website maintenance .

On the website, user registration and authentication, as well as placing orders, are performed through POST requests through secure HTTP. The response is always a formatted HTML page that will indicate lines indicating whether the request was successful or not, and if an error occurs, what the error is, etc.

So, if I can replicate POST requests on the phone and parse HTML responses to read the results of each request, do you think this is an acceptable alternative to creating a web service for this?

Besides the possibility of modifying the pages (which we can manage) and the fact that I probably have to download and parse a relatively large HTML response, are there any other drawbacks to this solution, and is there anything else that I could lacks?

Thanks a lot in advance for your thoughts. Hurray, Horn

+4
source share
6 answers

You can create an intermediate server that will interact with the client server and expose some REST web services on it using json (small invoices and easy to process) answers that will be consumed by the iPhone application.

+12
source

So, you are going to analyze HTML and formulate POST from a third-party server and pray that they do not even rename the form field.

Your question is indicated in two parts:

  • Do I think a miracle is an acceptable solution? I dont know.
  • Do I think that besides the fact that a miracle is required, are there other disadvantages? Nothing I can think of.

You did not ask, but this is a terrible course of action. Two sentences.

  • I suggest that third-party platform providers are not interested in providing third-party applications by providing an API. They have a very good business reason, which is that it helps to block the platform. Contact the support department and talk with them.

  • You must sell the client when creating an intermediate web service. To at least try to mitigate the damage that could affect this third-party platform, you can create and use a proxy server that receives requests from your applications and transfers them to a third-party platform. You must create in this client-server protocol a means of returning "we are in maintenance mode, we are leaving" to applications, on the inevitable day when a third-party server changes something that violates your application (they swapped billing and delivery address pages, for example ), and you need to upgrade through Apple to handle this.

A proxy server can be written in something more flexible and easier to use bash, for example, PHP, Python, Perl or Ruby. It can be hosted on Amazon in a micro-instance.

ps This question is incorrectly marked with object C.

+6
source

HTML is the worst because of parsing (1-2 seconds per page), memory and changes, but you already know that. Remember that ALL the data you need is displayed in HTML.

If you use a mediation server, you move the work to another place, and you have another server for support. I would only do this if there is a memory problem. Check How to choose the best XML parser for your iPhone project to support memory / performance / xpath. libxml2 is a good option, but it depends on your needs. And you might want to check out ASIHTTPRequest before using the SDK.

+1
source

I think that using the JSON web language will help reduce parsing time. By building a REST service that, when sending a GET request, will return the correct information for convenient sorting, you can display the result much faster than parsing HTML.

I prefer JSON over XML, but each has its own personal preferences. You should look at some very good libraries that are created specifically for parsing both XML and JSON.

For XML, I recommend using the built-in libxml parser. Although sometimes it can be considered very difficult to use. A simple Google search will result in a bunch of results that are specific to which parser should be used, depending on which task should be completed.

As for the JSON parser, I recommend SBJSON . I am currently using it as one of the largest projects I have undertaken, and it definitely works great for my use.

If you need a good way to connect to a RESTful web service, you should try LRResty .

+1
source

Do not submit the parsing solution to iPhone for 4 reasons:

  • The server can change its design and break your application (the presentation in the AppStore is lengthy) + They can also find that the request is sent from the application based on the user agent, which you must update the application to change it.
  • Some of the requests can be made through Javascript, so you need to not only parse (X) the HTML, but also a Javascript request (which may be in the form of XMLHttpRequest, but not required)
  • Long-term evolution of the mobile market: perhaps your client wants (or wants) applications for Android, Blackberry, Bada OS (Samsung), Symbian (Nokia / OVIStore), Java Mobile or Windows Phone 7?
  • Of course, the network traffic, memory, and processor needed to parse HTML (see how long the browser takes)?

As for traffic, if the application does not have huge traffic, you can host your proxy server. Or you can find some provider to host it for you. I think you will not need more than a few megabytes of memory, but maybe traffic. For less than 100 € / year, you can find some of them with unlimited traffic (for example, OVH Pro or Infomaniak plan). But if you want to go to Java, take a look at the Google App Engine: you pay only if your traffic is important and if your application generates many CPU cycles. If not: you won’t have to pay. And it is hosted on a Google server: reliable.

+1
source

If the client is open, you can consider the paypal API .

0
source

All Articles