I already tried http://service/?wadl to get a wadl file, but nothing is returned.
I read there isn't really a standard for wadl files in REST (but there is one for SOAP's WSDL), but I thought maybe it would exist and be web-service framework specific to PHP Symfony.
Is there a default wadl url for pulling a list of function signatures?
There would be, if you create it. Symfony does not define URLs for you, it's just a framework.
A Symfony application is not necessarily a REST API application, or even a Web application. It could be a console application, a message consumer, or anything else. It's not a given that "method signature" should be publicly available via any kind of endpoint.
If you want to an endpoint providing some functionality (say, a WADL endpiont, or a WSDL endpoint, or an anything endpoint), you need to provide it by creating and configuring it.
Some libraries built on top of Symfony like Api-Platform or NelmioApiDoc can provide some automatic or semi-automatic documentation for an API built on top of symfony, but how to configure each would depend on one actually using these libraries, and what's one's use-case.
Related
I want to create a RESTful API using the Zend Framework 2. Even though I'm pretty unexperienced with ZF2 I've choosen this framework because of it's loose coupeling and the fact that the code is audited on a regular basis. I found the tool Apigility provided by Zend and it seems pretty straight forward to implement things. But there's one thing which is not covered directly and I'm not even sure if Apigility makes sense for me:
I need a user role concept where some users are only able to view and modify ressources they created by themselves while other users are able to view and modify all ressources. There are also endpoints(controllers) which shall only available for certain users.
Permission management to certain endpoints could be realized with the ACL module but I don't know how to achieve the filtering of the ressources.
You're going to need to take a couple strategies to get all of this done.
Your endpoint access control can be handled by extending the default authorization listener (or adding additional listeners) provided by zf-mvc-auth. That should allow you to control if an endpoint can be seen at all.
As far as access control on your resources (filtering), you're probably going to need to inject an Authorization container of some nature into your resource services to handle your authorization logic there. Take a peek at the zfc-rbac cookbook for what that might look like (https://github.com/ZF-Commons/zfc-rbac/blob/master/docs/07.%20Cookbook.md#a-real-world-application-part-4---checking-permissions-in-the-view)
I have a web application which has been developed with symfony 1.4. I have a pretty large code base (and growing). Circa 80,000 lines of code (actions, forms, models, templates etc.)
I'm using the default doctrine version which ships with symfony 1.4.
I've just started developing a mobile version using Sencha touch. I don't wish to use symfony for the REST web services because:
REST services in Symfony 1.4 is not great. For example, If i want a PUT request I have to pass a 'sf_method' parameter specifiying that the request method is PUT. This isn't true REST and it's not ideal for Sencha touch.
I don't need all of the unnecessary symfony functionality(for example the plugins that are autoloaded in the ProjectConfiguration file, the form framework etc.) that you'd use to develop a standard web app. All I need is to define my REST routes and return the specified JSON (as everything that needs to be returned for Sencha touch will be JSON)
I want to keep my mobile app as bloated-free, efficient and quick as possible. And unfortunately for this task, Symfony 1.4 would not be the best choice for using as the backend architecture for my mobile app. If I had chosen symfony2 (it was in it's beta phase, alas) it would be a different story as symfony2 supports true REST functionality. What I do need, however, is the ability to use my current doctrine models (I have circa 90 models) in a chosen REST framework.
Basically, in a nutshell what I need is as simple as this:
Call a rest route->Query my doctrine models->return the JSON without using symfony.
So my question, what would be your advice? I don't want this to be a question of which is the best PHP rest framework, however, what I would like to know is what would be a good REST framework which i can develop efficiently and quickly REST service, make use of my doctrine models and is easily extendable.
Here at my employer, I've created a rather big application with a ExtJS frontend, and Symfony 1.4 backend. And two be honest, I don't feel limited by Symfony 1.4 in any way?
First of: I created my own base controller class (which extends sfActions). This controller can handle (render) different types of data. It has generic handling for Doctrine_Query, Doctrine_Collection, Doctrine_Model and array types.
Also the plugins make me help organize the code, and in some cases plugins are shared between differend projects, so that's also a big plus.
And the extra functionality like forms: it's only prepared for you in the autoloader, you don't have to use it. And I don't think it causes any real performance issues (at least not for me). But I like to use the extra sfValidator framework, to make sure data are correct.
The only real "problem" is indeed the HTTP REST-ful commands, especially PUT and DELETE. I just worked around this problem by generating a controller for each 'manageable' model, and implement specific get, list, create, update and delete actions. So when I would like to manage an Object, I call the objects controller, which has executeCreate, executeUpdate and executeDelete actions.
The reason I read, was that Symfony didn't and couldn't implement this feature because PHP has really bad support this. I don't know if this is true, but if this is your only 'real' issue, you could try to fix this in the Symfony core.
So my advice:
If the raw performance is your problem: try profiling your code, install a opcode (APC) cache, and profile your code (yes, that's double).
If the HTTP PUT command is your problem: I would either work around this (that's the way I solved it), or try to fix it in the core.
We have few Web Services witch now are handled by an external application, and we plan to replace them as an new own implementation.
Is there some tool/class witch will generate stock php interface and structures 100% compatible with those WSDL's we have now?
I'll have to re-implement this wsdl interface, and i have to be sure, that interface itself (not a logic implementation), will not change in any way (even WSDL location have to stay as is)
I have found some projects like: http://code.google.com/p/wsdl2php-interpreter
If any of You have used some things like that, please share with me tips, tools recommendations etc.
PS
re-implementation will be made on top of Yii framework and CWebService class
wsdl2php-interpreter is limited -- it doesn't handle attributes and doesn't seem to handle simpleTypes.
I have used http://code.google.com/p/wsdl2php-interpreter and based on generated code wrote an web service controllers following a Yii giude and everything works fine and as expected :)
Does anybody know a good web framework that includes an ORM mapper and allows straight forward implementation of web services? I'm looking for a framework written in PHP or C++. I'm looking for the following features (not all of them required, some will do nicely)
data definition in one place used by database and web service
WSDL generation
XML output/JSON output
boilerplate code generation
So what I would like is a framework that let's me specify the objects, the web service functions on those objects and then generate everything that is required leaving me to fill the business logic (connecting the database to the web service).
Anything like that out there?
Background information for why I need this:
I'm looking into creating a web project: the client is a rich web application that fetches all its data using AJAX. It will be completely custom made using only a low level javascript library. The server back end is supposed to serve static content and javascript (basically the rich web application) and to provide a RESTful web service API (which I would like to implement using aforementioned framework).
I would recommend using Zend_Framework and replacing Zend_Db with Doctrine as your ORM.
You can use Zend_Service to consume webservices and Zend_Rest_Controller to serve a REST API.
There are some good screencasts on integrating Doctrine and Zend here. If you have alot of PHP experience, it shouldn't take very long to integrate. I believe there are even some sample integrations on Github.
I'm developing a zend framework app that's just going to act as a web service. I have no need to ever output HTML at any point in the application and don't even want the overhead of creating empty view files.
I want my app to output XML by default, JSON if requested (via the format parameter would be fine).
Is there any way to do this without explicitly defining the context switching rules in the init() part of every controller?
If you're going to be providing JSON, SOAP or XML-RPC, you're probably better off using Zend_Json_Server + Zend_Soap_Server instead of Zend_Controller_Action. Both the JSON and SOAP server classes can consume the same server class. No need for the overhead of routing, etc.
Matthew Weier O'Phinney's (Zend FW lead), site has a great post detailing the proper way of doing this: Exposing Service APIs via Zend Framework
you could try doing the context switch using a Zend_Controller_Front plugin on preDispatch.