4 Jan 2013 9:27 AM #11
Not exactly, you have to think about your web services written in PHP as completely separate from your Sencha app. You server-side PHP code will be located in it's own area on your server (wherever you host your web services) and they are only exposed through the web service themselves (think of them being on a different server than your Senha app). So you don't mix in your server-side PHP with Sencha at all, they are completely separate. Typically the tools used to create web services allow you to generate a manual access web page which lists your web services and allow you to manually call them with parameters and see the results right from your browser. This is a great way to check that the web service really works if you are having problems calling it from your Sencha app. This is also a great way to work if for example you have someone else write the web services on the server - they simply provide you with the manual access page for your browser and from that you have everything you need - the URL of the web service, the parameters, the results, and you can even try it with real data.
The one thing you need to be careful of is your domains - try and have your Senbcha app and your web service hosted from the same domain. If they are different then you can still access cross-domain using a JSONP store but you are limited to GET (no POSTs) so not that secure and certainly not good for something like a login. Also you can run into problems with mobile, the iPhone for example has the default cookies set to "From visited" which means that if your Sencha app is hosted on a different domain than your web service and you want to use POST then it won't be able to access them until you first browse to the web service URL manually - not very practical for your users. Using a JSONP store gets around this which is why you will see it used to access public web service like twitter because they are on a different domain than your Sencha app, but it is not very secure.
4 Jan 2013 9:48 AM #12
To follow up on this a little more. Think of your PHP code as completely separate and it's own self-contained thing. It is located on your server in it's own area and accesses the MySQL data base there. Your PHP code then exposes the data it wants through web services which may be quite different than how you have organized the data in your database. The web services can be consumed by anything - a Flex app, and ASP.NET app, a Senha app - it does not matte to the server.
Your Sencha app only communicates with the server wbn services, it doesn't know anything about your database MySQL or even your code on the server, it doesn't even know what you data you have in your database, or even what technology you are using to provide the web serves - it could be JAVA code from a Linux server or ASP.NET from a Windows server where each are using totally different database technologies. It does not matter to your Sechna app - all it does is accesses data through web services. So when it comes to defining the fileds in your model for your store, you will only be defining the fields returned from the web service, not anything you may have in your database.
4 Jan 2013 10:09 AM #13
this time....i haven't understood (please could you use another word for web service?)
4 Jan 2013 11:24 AM #14
Yes, a web service is basically a function to get data that you can call across the Internet. All development platforms allow you to write web services and is it is the de facto way software is written today. Google, Twitter, Yelp, Yahoo, Flicker, Amazon, eBay, Facebook... - all written with web services and all you can access from your own application. Literally all corporate software is now written this way too so the data can be shared with their partners using different systems and technology. For example, you can search Amazon for mobiles phones of a certain price range and get the results of pricing, description, and even images if you like and present them in your application all transparently to the user. Google the words "web services" and you will get a lot of good explanations. So, for your program you would write web services on the server side to provide the data your Sencha app needs and then you call these web services (similar to how you would call a function) from your Sencha app and get the results you need.