In symfony framework, we can generate WSDL files easily by using ckwebservice plugin.
There are different releases available in this plugin. We need to choose the release which suits for our symfony version.
To install this plugin type the following command
php symfony plugin:install ckWebServicePlugin
To use this plugin, we need to make changes in our application’s configuration files also.
1. In app.yml
all:
enable_soap_parameter: off
soap:
# enable the `ckSoapParameterFilter`
enable_soap_parameter: on
ck_web_service_plugin:
# the location of your wsdl file, relative to your project's `web/` folder
wsdl: %SF_WEB_DIR%/Billing.wsdl
# the class which will be registered as handler for webservice requests
handler: BillingHandler
soap_options:
encoding: utf-8
soap_version: <?php echoln(SOAP_1_2) ?>
classmap:
# mapping of wsdl types to PHP types
DoubleArray: ckGenericArray
Note : Billing.wsdl and BillingHandler is our WSDL and Handler names respectively.
2. In factories.yml
# your environment for webservice mode
soap:
controller:
class: ckWebServiceController
3. In filters.yml (only Symfony 1.3 or later versions)
rendering: ~
security: ~
# insert your own filters here
cache: ~
common: ~
execution: ~
soap_parameter:
class: ckSoapParameterFilter
param:
# `app_enable_soap_parameter` has to be set to `on` so the filter is only enabled in soap mode
condition: %APP_ENABLE_SOAP_PARAMETER%
In symfony 1.2 or less versions filters.yml should look like this:
rendering: ~
security: ~
# insert your own filters here
soap_parameter:
class: ckSoapParameterFilter
param:
# `app_enable_soap_parameter` has to be set to `on` so the filter is only enabled in soap mode
condition: %APP_ENABLE_SOAP_PARAMETER%
cache: ~
common: ~
execution: ~
Now we are ready to use this plugin. Once our action file is ready we can generate WSDL file by using ‘webservice:generate-wsdl’ command. Syntax of this command is
php symfony webservice:generate-wsdl [--environment=soap] [--debug] [--handler] app_name webservice_name webservice_base_url
- [--environment=soap] – (Optional) This sets the environment to webservice mode. Default value is ‘soap’
- [--debug] – (Optional) This enables the debug mode. Default is ‘FALSE’
- [--handler] – (Optional) This generates custom SOAP handler by extending ckSoapHandler. Default is ‘FALSE’
- app_name – Name of the application
- webservice_name – Name of the webservice
- webservice_base_url – URL under which webservice is accessable
For example :
php symfony webservice:generate-wsdl frontend Billing http://localhost:8080/
The above command will generate Billling.wsdl and BillingHandler.php in ‘web/’ folder
To view the generated WSDL file : http://localhost:8080/Billing.wsdl





