Best service/connection combo for Flex/Server Implementation
I'm starting a Flex app on a pretty big reporting engine and want to know how best to connect to a Postgres Database. I'd like to create a REST API architecture so I can use the service for more than just the Flex app(mobile possibly).
These are my options I've found:
Datatype: either XML, JSON or AMF
Flex Service: HTTPService or WebService
Server(usin开发者_StackOverflowg PHP): ZendAMF, custom json_encode implementation, Zend_Rest_Server
I've got my views all mapped out, and the api functions designed. Basically what I need is advice on which Flex / back-end service combo to provide.
Thanks for the advice!
Best service/connection combo for Flex/Server Implementation
There is no best way, but actually depends upon your project and how would you like to proceed. There are three ways.
- Remoting
- HTTP Service
- Web Service
Since you would like to re use those services in other applications too, i would suggest you to go with Web Service. You can create your Web Service using any Server siding language which you prefer and communicate it with your Flex Application.
Regarding AMF
Its one of the ways how you can interact your Flex App with Server siding language. AMFPHP or ZendAMF does a good job and its so easy to communicate.
I would suggest you to concentrate more on Flex Architecture rather than looking into how your Flex is gonna communicate with Backend.
Check out for Modules based Architecture. Check for which framework you are going to develop your Flex App. [ Mate, Cainogram, Swiz or someother] When you have decided with your frontend Architecture on how the flow should happen, you can then decide on how to communicate and which is the best possible approach for your project keeping the future things in your mind.
Since your Application is going to be reports oriented, go for Web Service.
[I] want to know how best to connect to a Postgres Database.
Best is very subjective. You probably don't want to connect to the Postgres database directly from Flex. Flex is not designed for such things. I recommend using an application server as middleware. ColdFusion, .NET, PHP, Java, and just about any other 'current' application server can be used as that middleware. I would recommend using whatever you (or your team) is familiar with.
For Flex, I strongly recommend you using an AMF implementation. AMF is a binary format and will give you smaller data transfer packets, plus server side object to client side object conversion. It'll save you some time writing XML parsing routines, which can be annoying at times.
With ColdFusion, it is pretty easy to create a server side service (CFC) that can be used for AMF, SOAP Web Services, and REST services all at the same time. You just specify 'access="remote"' on the function definition. I would expect other server side languages have similar functionality, but never investigated the web service related features of other languages.
精彩评论