SOAP Web Services
The QCubed QSoapService class allows you to very easily add SOAP-enabled PHP methods to your application.It utilizes the SoapServer class in PHP 5.1 or greater (and subsequently, this specific example also uses the SoapClient class to illustrate the QSoapService in action). However, QSoapService adds a significant level of functionality, overcoming most of the inherent issues found in the PHP SoapServer, including:
- Full, Automatic WSDL Generation
- Supports parameters that are Pass By Reference
- Supports QDateTime, arrays and other input/output parameters that are complex data structures
- And of course, full support for code generated data objects
Please note is that because SOAP by definition is a strongly-typed protocol, and because PHP is not, you must declare the types of the input and output parameters for each webservice-enabled method. This is done through standard PHPDoc tags. Please view the code for example_service.php for more information.
And finally, due to the heavy processing of WSDL generation, the results of the WSDL generation are cached using QCache, and cached files are stored in /includes/cache/soap.
To view the webservice, please go to http://examples.qcu.be/assets/_core/php/examples/communication/example_service.php
To use the webservice, use any SOAP compatible client and import the WSDL file at http://examples.qcu.be/assets/_core/php/examples/communication/example_service.php?wsdl
Example call on ExampleService:
AddNumbers(15, 22):
To use the webservice, use any SOAP compatible client and import the WSDL file at http://examples.qcu.be/assets/_core/php/examples/communication/example_service.php?wsdl
Example call on ExampleService:
AddNumbers(15, 22):
GetDate(12, 25, 2007):37
GetPeople('Smith'):2007-12-25T00:00:00
(notice how the resulting QDateTime has been converted to a SOAP-compliant dateTime)
- Alex Smith
- Wendy Smith
- Jennifer Smith
