BMC/UUP-SOAP - SOAP service with WSDL and API documentation.

This library makes it easy to publish your PHP classes as SOAP handlers using the native SOAP extension in PHP (fast). The WSDL and API documentation is generated from class and method annotations, with optional WSDL cache.

In addition to simple types as string or int, complex types and arrays are also supported. An array is handled an an unlimited sequence of simple or comlex types.

Create SOAP handler

Define your class as usual. Add annotiations on methods declaring input parameters and return values. The WSDL and API documentation is generated by calling methods on the soap service object. Pass you class or an instance of it to the soap service class to register it as the SOAP service handler.

Utility classes

Request parameter handling is typical handled by your framework were you routes request URL's against methods in your soap service. For standalone services the library provides the SOAP request class that can hides the details of sending WDSL, API documentation or handling the SOAP request.

<?php

use UUP\WebService\Soap\SoapHandler;
use UUP\WebService\Soap\SoapService;

/**
 * Process SOAP request.
 * @param SoapService $service The SOAP service (defined by the uup-soap library).
 * @param SoapHandler $handler The SOAP handler (your user defined class).
 */
function process($service, $handler = null)
{
        if (!isset($handler)) {
                $handler = $service->getHandler();
        }

        if (!isset($handler)) {
                throw new RuntimeException("The SOAP service handler is unset.");
        } else {
                $service->setHandler($handler);
        }

        switch ($this->_target) {
                case self::TARGET_DOCS:
                        $service->sendDocumentation('html');
                        break;
                case self::TARGET_WSDL:
                        $service->sendDescription();
                        break;
                case self::TARGET_SOAP:
                        $service->handleRequest();
                        break;
        }
}

Exceptions

You can throw exceptions at any time in your handler class. These are trapped automatic and forwarded to the peer as SOAP faults.

Reflection

This library uses reflecton on classes and annotations to gather information for exporting the class.

Read More