I am currently using various back-end services and I want to use PHP to simply query these services and perform the final page construction. These services could be coded in any number of programming langauges such as Erlang, Java, Python etc. However I am unsure of the best way to actuall开发者_开发技巧y interface the back-end services with the web app. Requests to these services would be both synchronous and asynchronous. Would I use something like SOAP or JSON-RPC??
Any help greatly appreciated.
You might want to have a look to Thrift:
http://incubator.apache.org/thrift/
- I think you are on the right track using JSON-RPC. I don't like SOAP at all because it is just way too complicated in my opinion
- I would create an interface(document it properly like for example twitter) which I can easily test using cURL from the command line.
- I think Twitter has a pretty good(not perfect) API.
- Also ProgrammableWeb.com is a good place to look up API's(see how other people create API's).
This is a general question how to design web services and there is a hype using REST-like web services. This way you simply can call a given URL (which is even user readable). This increase the interoperability of your web service so you can mix the programming languages which use the REST interface. IMHO its easier than using a SOAP like web service as you simply calls GET
on an url like http://www.example.com/user/5/
(think of it as the mod_rewrite
of web services)
I'd use NuSOAP (to consume java webservices).
精彩评论