0

I need to have a data supply Server with PHP to serve (returning data to) any Client Applications from any universal programming language platforms like, i.e. Java, .NET, Python, iOS, C#, C++, etc.

First few questions would be:

  • Would that one be even called API or Web Service?
  • If Web Service, which one should it be? (In PHP Docs, the WebServices are OAuth, SCA, SOAP, XML-RPC)

Then which particular approach should i use? (in such common scenarios) Which PHP implementation would be make the Server to communicate with ANY MAJOR programming platforms?

4

1 回答 1

1

Its a webservice (btw you are a bit confused about what is an API layered on top of a web-service)

As for formatting the data....that's up to you.

SOAP - is a very formal and complex method of describing data and metadata - which is computationally expensive on both client and server. It defines both the request as well as the response

XML-RPC is a simpler system based on XML - again request and response are XML

JSON is increasingly widespread - much simpler.

Serialized PHP is also comonplace (there are tools available for C#, Java, Ruby, Python...)

At the end of the day, they ALL USE TEXT to comunicate - hence will work with ANY MAJOR programming platform (even if they used binary data, its still data hence should be parseable by anything which can talk HTTP).

IMHO SOAP is somewhat overcomplicated unless you're trying to keep systems in sync using evolving APIs. YAML is...only for Ruby programmers. Serialized PHP is easy to implement but difficult to document. If it were me, I'd go with JSON (do have a google for JSON schema).

于 2013-09-19T16:25:11.747 回答