Changeset 8904
- Timestamp:
- 05/10/08 23:19:33 (4 months ago)
- Files:
-
- plugins/ckWebServicePlugin/branches/1.0/README (modified) (4 diffs)
- plugins/ckWebServicePlugin/trunk/README (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/ckWebServicePlugin/branches/1.0/README
r8753 r8904 1 1 = ckWebService plugin = 2 2 3 '''This is the documentation for the symfony 1.0 compatible plugin version!''' 4 3 5 The `ckWebServicePlugin` is a symfony plugin that let you expose your modules and actions as a webservice. 4 6 … … 18 20 19 21 {{{ 20 http://svn.symfony-project.com/plugins/ckWebServicePlugin/ trunk22 http://svn.symfony-project.com/plugins/ckWebServicePlugin/branches/1.0 21 23 }}} 22 24 … … 203 205 The names in the configuration have to be in the same order like the function arguments. 204 206 205 In general a array containing all params can be retrieved by: ''$request->getParameter('param', null, 'ckWebServicePlugin');''.207 In general an array containing all params can be retrieved by: ''$request->getParameter('param', null, 'ckWebServicePlugin');''. 206 208 207 209 === Getting the action result === 208 210 209 There are multiple stages of getting the action result. First we try to invoke a implementation of the ''result_callback'' configured in ''app.yml''.211 There are multiple stages of getting the action result. First we try to invoke an implementation of the ''result_callback'' configured in ''app.yml''. 210 212 If none is found on the action instance a default getter is mixed into the action and is called. 211 213 … … 255 257 == TODO == 256 258 259 * add support for soap headers 260 * merge changes to configuration model in symfony 1.1 compatible version back 257 261 * decide how to handle redirects 258 * switch to symfony 1.1 (change the ''wsdl-build'' task, ...)259 262 * write tests 260 263 * rewrite the wsdl generator plugins/ckWebServicePlugin/trunk/README
r8555 r8904 1 1 = ckWebService plugin = 2 2 3 '''This is the documentation for the symfony 1.1 compatible plugin version!''' 4 3 5 The `ckWebServicePlugin` is a symfony plugin that let you expose your modules and actions as a webservice. 4 6 … … 8 10 9 11 == Installation == 10 11 To install the current release execute: 12 13 {{{ 14 symfony plugin-install http://plugins.symfony-project.com/ckWebServicePlugin 15 }}} 16 17 or to install the current revision, checkout: 12 13 To install the current revision, checkout: 18 14 19 15 {{{ … … 57 53 === module.yml === 58 54 59 ''' Some of the configuration described here is done by the WSDL Generator!'''55 '''The configuration described here is done by the WSDL Generator!''' 60 56 61 57 The plugin allows per action configuration of parameters passed by the soap call so you can use them like request parameters. 62 Also you can configure per action in which action member the result is stored, if not set ''result'' is assumed. 63 64 {{{ 65 # your enviroment for web service mode 66 soap: 67 # the following part is done by the WSDL Generator, you only have to configure this if you don't use the generator 68 soap_parameter_map: 69 # the action name [mandatory] 70 test: 71 # the name of the first action parameter 72 - test 73 # the name of the second, third, ... action parameter 74 - second 75 - ... 76 # set for each action wether or not action views should be rendered as normal, if this isn't set for an action the value from `ck_web_service_plugin: render` in `app.yml` is used 77 soap_render_map: 78 # the action name [mandatory] 79 test: on 80 # the name of the action member, which contains the result [optional] 81 soap_return_key: result_key 58 Also you can configure per action in which action member the result is stored, if not set ''result'' is assumed, and wether or not to render the view as result. 59 60 {{{ 61 # your enviroment for web service mode 62 soap: 63 # the following part added by the WSDL Generator for each action, you only have to configure this if you don't use the generator 64 action_name: 65 # enable the action to be called from ckWebServiceController, should prevent malicious calls to actions through manipulated soap messages [mandatory] 66 enable: true 67 # ordered list of the parameters [optional] 68 parameter: [first_param, second_param] 69 # the name of the action member, which contains the result, if `render` is true this has no effect [optional] 70 result: null 71 # set wether or not the view should be rendered as normal, if this isn't set the value from `ck_web_service_plugin: render` in `app.yml` is used [optional] 72 render: false 82 73 }}} 83 74 … … 105 96 }}} 106 97 107 === php. yml===98 === php.ini === 108 99 109 100 Disable wsdl file caching, when your developing to see changes to the wsdl file instantly, this is optional. 110 101 111 102 {{{ 112 set: 113 soap.wsdl_cache_enabled: off 103 soap.wsdl_cache_enabled=0 114 104 }}} 115 105 … … 124 114 The method names of the web service methods follow the scheme: ''module_Action''. 125 115 126 The generator is used through the ''wsdl-build'' symfony cli task, it has the following syntax: 127 128 {{{ 129 symfony wsdl-build app_name env_name [controller_name] [debug] webservice_name webservice_base_url 130 }}} 131 132 The first four parameters are the same as of the ''init-controller'' task. 133 116 The generator is used through the ''webservice:generate-wsdl'' symfony cli task, it has the following syntax: 117 118 {{{ 119 symfony webservice:generate-wsdl [--environment=soap] [--debug=on] app_name webservice_name webservice_base_url 120 }}} 121 134 122 It will generate a wsdl file and a controller script in the ''web/'' folder and add / modify all ''module.yml'' files of enabled actions. 135 123 136 124 === Example === 137 125 138 Howto execute the ''w sdl-build'' task shows the following example:139 140 {{{ 141 symfony w sdl-build fronted soapmyFooBarService http://www.myfoobar.com/142 }}} 143 144 * This will add a '' frontend_soap.php'' and a ''myFooBarService.wsdl'' to your ''/web'' folder.145 146 * The endpoint for the generated service will be ''http://www.myfoobar.com/ frontend_soap.php''.126 Howto execute the ''webservice:generate-wsdl'' task shows the following example: 127 128 {{{ 129 symfony webservice:generate-wsdl frontend myFooBarService http://www.myfoobar.com/ 130 }}} 131 132 * This will add a ''myFooBarService.php'' and a ''myFooBarService.wsdl'' to your ''/web'' folder. 133 134 * The endpoint for the generated service will be ''http://www.myfoobar.com/myFooBarService.php''. 147 135 148 136 Howto enable actions for export shows this example: … … 203 191 The names in the configuration have to be in the same order like the function arguments. 204 192 205 In general a array containing all params can be retrieved by: ''$request->getParameter('param', null, 'ckWebServicePlugin');''.193 In general an array containing all params can be retrieved by: ''$request->getParameter('param', null, 'ckWebServicePlugin');''. 206 194 207 195 === Getting the action result === 208 196 209 There are multiple stages of getting the action result. First we try to invoke a implementation of the ''result_callback'' configured in ''app.yml''.210 If none is found on the action instance a default getter is mixed into the action and is called. 197 There are multiple stages of getting the action result. First we try to invoke an implementation of the ''result_callback'' configured in ''app.yml''. 198 If none is found on the action instance a default getter is mixed into the action and is called. In this version this is down by listening to the ''component.method_not_found'' event. 211 199 212 200 This default getter has the following behavior: … … 215 203 * when rendering is disabled: 216 204 * if only one variable exists in the actions parameter holder (set via ''$actionInstance->var = 'some value';''), this variable is returned 217 * if a default key into the parameter holder is configured using ''soap_return_key'' in the ''module.yml'' ('''Attention:''' if this is not configured ''result'' is assumed) and this key exists its corresponding value is returned205 * if a default key into the parameter holder is configured using ''soap_return_key'' in the ''module.yml'' ('''Attention:''' if this is not configured ''result'' is assumed) and this key exists, its corresponding value is returned 218 206 * if both approaches fail nothing is returned 219 207 … … 245 233 # your enviroment for web service mode 246 234 soap: 247 soap_parameter_map: 248 index: 249 - foo 250 - bar 235 index: 236 enable: true 237 parameter: [foo, bar] 251 238 }}} 252 239 … … 255 242 == TODO == 256 243 244 * add support for soap headers 257 245 * decide how to handle redirects 258 * switch to symfony 1.1 (change the ''wsdl-build'' task, ...)259 246 * write tests 260 247 * rewrite the wsdl generator