text:
<?php
/**
 * Zend Framework
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://framework.zend.com/license/new-bsd
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@zend.com so we can send you a copy immediately.
 *
 * @category   Zend
 * @package    Zend_Service
 * @subpackage LiveDocx
 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @version    $Id: MailMerge.php 23775 2011-03-01 17:25:24Z ralph $
 */

/** Zend_Date **/
require_once 'Zend/Date.php';

/** Zend_Service_LiveDocx **/
require_once 'Zend/Service/LiveDocx.php';

/**
 * @category   Zend
 * @package    Zend_Service
 * @subpackage LiveDocx
 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @since      LiveDocx 1.0
 */
class Zend_Service_LiveDocx_MailMerge extends Zend_Service_LiveDocx
{
    /**
     * URI of LiveDocx.MailMerge WSDL
     * @since LiveDocx 1.0
     */
    //const WSDL = 'https://api.livedocx.com/1.2/mailmerge.asmx?WSDL';
    const WSDL = 'https://api.livedocx.com/2.0/mailmerge.asmx?WSDL';

    /**
     * Field values
     *
     * @var   array
     * @since LiveDocx 1.0
     */
    protected $_fieldValues;

    /**
     * Block field values
     *
     * @var   array
     * @since LiveDocx 1.0
     */
    protected $_blockFieldValues;

    /**
     * Constructor (LiveDocx.MailMerge SOAP Service)
     *
     * @return void
     * @return throws Zend_Service_LiveDocx_Exception
     * @since  LiveDocx 1.0
     */
    public function __construct($options = null)
    {
        $this->_wsdl             = self::WSDL;
        $this->_fieldValues      = array();
        $this->_blockFieldValues = array();

        parent::__construct($options);
    }

    /**
     * Set the filename of a LOCAL template
     * (i.e. a template stored locally on YOUR server)
     *
     * @param  string $filename
     * @return Zend_Service_LiveDocx_MailMerge
     * @throws Zend_Service_LiveDocx_Exception
     * @since  LiveDocx 1.0
     */
    public function setLocalTemplate($filename)
    {
        if (!is_readable($filename)) {
            throw new Zend_Service_LiveDocx_Exception(
                'Cannot read local template from disk.'
            );
        }

        $this->logIn();

        try {
            $this->getSoapClient()->SetLocalTemplate(array(
                'template' => base64_encode(file_get_contents($filename)),
                'format'   => self::getFormat($filename),
            ));
        } catch (Exception $e) {
            require_once 'Zend/Service/LiveDocx/Exception.php';
            throw new Zend_Service_LiveDocx_Exception(
                'Cannot set local template', 0, $e
            );
        }

        return $this;
    }

    /**
     * Set the filename of a REMOTE template
     * (i.e. a template stored remotely on the LIVEDOCX server)
     *
     * @param  string $filename
     * @return Zend_Service_LiveDocx_MailMerge
     * @throws Zend_Service_LiveDocx_Exception
     * @since  LiveDocx 1.0
     */
    public function setRemoteTemplate($filename)
    {
        $this->logIn();

        try {
            $this->getSoapClient()->SetRemoteTemplate(array(
                'filename' => $filename,
            ));
        } catch (Exception $e) {
            require_once 'Zend/Service/LiveDocx/Exception.php';
            throw new Zend_Service_LiveDocx_Exception(
                'Cannot set remote template', 0, $e
            );
        }

        return $this;
    }

    /**
     * Set an associative or multi-associative array of keys and values pairs
     *
     * @param  array $values
     * @return Zend_Service_LiveDocx_MailMerge
     * @throws Zend_Service_LiveDocx_Exception
     * @since  LiveDocx 1.0
     */
    public function setFieldValues($values)
    {
        $this->logIn();

        foreach ($values as $value) {
            if (is_array($value)) {
                $method = 'multiAssocArrayToArrayOfArrayOfString';
            } else {
                $method = 'assocArrayToArrayOfArrayOfString';
            }
            break;
        }

        try {
            $this->getSoapClient()->SetFieldValues(array(
                'fieldValues' => self::$method($values),
            ));
        } catch (Exception $e) {
            require_once 'Zend/Service/LiveDocx/Exception.php';
            throw new Zend_Service_LiveDocx_Exception(
                'Cannot set field values', 0, $e
            );
        }

        return $this;
    }

    /**
     * Set an array of key and value or array of values
     *
     * @param string $field
     * @param array|string $value
     *
     * @throws Zend_Service_LiveDocx_Exception
     * @return Zend_Service_LiveDocx_MailMerge
     * @since  LiveDocx 1.0
     */
    public function setFieldValue($field, $value)
    {
        $this->_fieldValues[$field] = $value;

        return $this;
    }

    /**
     * Set block field values
     *
     * @param string $blockName
     * @param array $blockFieldValues
     *
     * @return Zend_Service_LiveDocx_MailMerge
     * @throws Zend_Service_LiveDocx_Exception
     * @since  LiveDocx 1.0
     */
    public function setBlockFieldValues($blockName, $blockFieldValues)
    {
        $this->logIn();

        try {
            $this->getSoapClient()->SetBlockFieldValues(array(
                'blockName'        => $blockName,
                'blockFieldValues' => self::multiAssocArrayToArrayOfArrayOfString($blockFieldValues)
            ));
        } catch (Exception $e) {
            require_once 'Zend/Service/LiveDocx/Exception.php';
            throw new Zend_Service_LiveDocx_Exception(
                'Cannot set block field values', 0, $e
            );
        }

        return $this;
    }

    /**
     * Assign values to template fields
     *
     * @param array|string $field
     * @param array|string $value
     * @return Zend_Service_LiveDocx_MailMerge
     * @throws Zend_Service_LiveDocx_Exception
     * @since  LiveDocx 1.0
     */
    public function assign($field, $value = null)
    {
        try {
            if (is_array($field) && (null === $value)) {
                foreach ($field as $fieldName => $fieldValue) {
                    $this->setFieldValue($fieldName, $fieldValue);
                }
            } elseif (is_array($value)) {
                $this->setBlockFieldValues($field, $value);
            } else {
                $this->setFieldValue($field, $value);
            }
        } catch (Exception $e) {
            require_once 'Zend/Service/LiveDocx/Exception.php';
            throw new Zend_Service_LiveDocx_Exception(
                'Cannot assign data to template', 0, $e
            );
        }

        return $this;
    }

    /**
     * Set a password to open to document
     *
     * This method can only be used for PDF documents
     *
     * @param  string  $password
     * @return Zend_Service_LiveDocx_MailMerge
     * @throws Zend_Service_LiveDocx_Exception
     * @since  LiveDocx 1.2 Premium
     */
    public function setDocumentPassword($password)
    {
        $this->logIn();

        try {
            $this->getSoapClient()->SetDocumentPassword(array(
                'password' => $password
            ));
        } catch (Exception $e) {
            require_once 'Zend/Service/LiveDocx/Exception.php';
            throw new Zend_Service_LiveDocx_Exception(
                'Cannot set document password. This method can be used on PDF files only.', 0, $e
            );
        }

        return $this;
    }

    /**
     * Set a master password for document and determine which security features
     * are accessible without using the master password.
     *
     * As default, nothing is allowed. To allow a security setting,
     * explicatively set it using one of he DOCUMENT_ACCESS_PERMISSION_* class
     * constants.
     *
     * {code}
     * $phpLiveDocx->setDocumentAccessPermissions(
     *     array (
     *         Zend_Service_LiveDocx_MailMerge::DOCUMENT_ACCESS_PERMISSION_ALLOW_PRINTING_HIGH_LEVEL,
     *         Zend_Service_LiveDocx_MailMerge::DOCUMENT_ACCESS_PERMISSION_ALLOW_EXTRACT_CONTENTS
     *     ),
     *     'myDocumentAccessPassword'
     * );
     * {code}
     *
     * This method can only be used for PDF documents
     *
     * @param  array  $permissions
     * @param  string $password
     * @return Zend_Service_LiveDocx_MailMerge
     * @throws Zend_Service_LiveDocx_Exception
     * @since  LiveDocx 1.2 Premium
     */
    public function setDocumentAccessPermissions($permissions, $password)
    {
        $this->logIn();

        try {
            $this->getSoapClient()->SetDocumentAccessPermissions(array(
                'permissions' => $permissions,
                'password'    => $password
            ));
        } catch (Exception $e) {
            require_once 'Zend/Service/LiveDocx/Exception.php';
            throw new Zend_Service_LiveDocx_Exception(
                'Cannot set document access permissions', 0, $e
            );
        }

        return $this;
    }

    /**
     * Merge assigned data with template to generate document
     *
     * @throws Zend_Service_LiveDocx_Excpetion
     * @return void
     * @since  LiveDocx 1.0
     */
    public function createDocument()
    {
        $this->logIn();

        if (count($this->_fieldValues) > 0) {
            $this->setFieldValues($this->_fieldValues);
        }

        $this->_fieldValues      = array();
        $this->_blockFieldValues = array();

        try {
            $this->getSoapClient()->CreateDocument();
        } catch (Exception $e) {
            require_once 'Zend/Service/LiveDocx/Exception.php';
            throw new Zend_Service_LiveDocx_Exception(
                'Cannot create document', 0, $e
            );
        }
    }

    /**
     * Retrieve document in specified format
     *
     * @param string $format
     *
     * @throws Zend_Service_LiveDocx_Exception
     * @return binary
     * @since  LiveDocx 1.0
     */
    public function retrieveDocument($format)
    {
        $this->logIn();

        $format = strtolower($format);

        try {
            $result = $this->getSoapClient()->RetrieveDocument(array(
                'format' => $format,
            ));
        } catch (Exception $e) {
            require_once 'Zend/Service/LiveDocx/Exception.php';
            throw new Zend_Service_LiveDocx_Exception(
                'Cannot retrieve document - call setLocalTemplate() or setRemoteTemplate() first', 0, $e
            );
        }

        return base64_decode($result->RetrieveDocumentResult);
    }

    /**
     * Return WMF (aka Windows metafile) data for specified page range of created document
     * Return array contains WMF data (binary) - array key is page number
     *
     * @param  integer $fromPage
     * @param  integer $toPage
     * @return array
     * @since  LiveDocx 1.2
     */
    public function getMetafiles($fromPage, $toPage)
    {
        $this->logIn();

        $ret    = array();
        $result = $this->getSoapClient()->GetMetafiles(array(
            'fromPage' => (integer) $fromPage,
            'toPage'   => (integer) $toPage,
        ));

        if (isset($result->GetMetafilesResult->string)) {
            $pageCounter = (integer) $fromPage;
            if (is_array($result->GetMetafilesResult->string)) {
                foreach ($result->GetMetafilesResult->string as $string) {
                    $ret[$pageCounter] = base64_decode($string);
                    $pageCounter++;
                }
            } else {
               $ret[$pageCounter] = base64_decode($result->GetMetafilesResult->string);
            }
        }

        return $ret;
    }

    /**
     * Return WMF (aka Windows metafile) data for pages of created document
     * Return array contains WMF data (binary) - array key is page number
     *
     * @return array
     * @since  LiveDocx 1.2
     */
    public function getAllMetafiles()
    {
        $this->logIn();

        $ret    = array();
        $result = $this->getSoapClient()->GetAllMetafiles();

        if (isset($result->GetAllMetafilesResult->string)) {
            $pageCounter = 1;
            if (is_array($result->GetAllMetafilesResult->string)) {
                foreach ($result->GetAllMetafilesResult->string as $string) {
                    $ret[$pageCounter] = base64_decode($string);
                    $pageCounter++;
                }
            } else {
               $ret[$pageCounter] = base64_decode($result->GetAllMetafilesResult->string);
            }
        }

        return $ret;
    }

    /**
     * Return graphical bitmap data for specified page range of created document
     * Return array contains bitmap data (binary) - array key is page number
     *
     * @param  integer $fromPage
     * @param  integer $toPage
     * @param  integer $zoomFactor
     * @param  string  $format
     * @return array
     * @since  LiveDocx 1.2
     */
    public function getBitmaps($fromPage, $toPage, $zoomFactor, $format)
    {
        $this->logIn();

        $ret = array();

        $result = $this->getSoapClient()->GetBitmaps(array(
            'fromPage'   => (integer) $fromPage,
            'toPage'     => (integer) $toPage,
            'zoomFactor' => (integer) $zoomFactor,
            'format'     => (string)  $format,
        ));

        if (isset($result->GetBitmapsResult->string)) {
            $pageCounter = (integer) $fromPage;
            if (is_array($result->GetBitmapsResult->string)) {
                foreach ($result->GetBitmapsResult->string as $string) {
                    $ret[$pageCounter] = base64_decode($string);
                    $pageCounter++;
                }
            } else {
               $ret[$pageCounter] = base64_decode($result->GetBitmapsResult->string);
            }
        }

        return $ret;
    }

    /**
     * Return graphical bitmap data for all pages of created document
     * Return array contains bitmap data (binary) - array key is page number
     *
     * @param  integer $zoomFactor
     * @param  string  $format
     * @return array
     * @since  LiveDocx 1.2
     */
    public function getAllBitmaps($zoomFactor, $format)
    {
        $this->logIn();

        $ret    = array();
        $result = $this->getSoapClient()->GetAllBitmaps(array(
            'zoomFactor' => (integer) $zoomFactor,
            'format'     => (string)  $format,
        ));

        if (isset($result->GetAllBitmapsResult->string)) {
            $pageCounter = 1;
            if (is_array($result->GetAllBitmapsResult->string)) {
                foreach ($result->GetAllBitmapsResult->string as $string) {
                    $ret[$pageCounter] = base64_decode($string);
                    $pageCounter++;
                }
            } else {
               $ret[$pageCounter] = base64_decode($result->GetAllBitmapsResult->string);
            }
        }

        return $ret;
    }

    /**
     * Return all the fields in the template
     *
     * @return array
     * @since  LiveDocx 1.0
     */
    public function getFieldNames()
    {
        $this->logIn();

        $ret    = array();
        $result = $this->getSoapClient()->GetFieldNames();

        if (isset($result->GetFieldNamesResult->string)) {
            if (is_array($result->GetFieldNamesResult->string)) {
                $ret = $result->GetFieldNamesResult->string;
            } else {
                $ret[] = $result->GetFieldNamesResult->string;
            }
        }

        return $ret;
    }

    /**
     * Return all the block fields in the template
     *
     * @param  string $blockName
     * @return array
     * @since  LiveDocx 1.0
     */
    public function getBlockFieldNames($blockName)
    {
        $this->logIn();

        $ret    = array();
        $result = $this->getSoapClient()->GetBlockFieldNames(array(
            'blockName' => $blockName
        ));

        if (isset($result->GetBlockFieldNamesResult->string)) {
            if (is_array($result->GetBlockFieldNamesResult->string)) {
                $ret = $result->GetBlockFieldNamesResult->string;
            } else {
                $ret[] = $result->GetBlockFieldNamesResult->string;
            }
        }

        return $ret;
    }

    /**
     * Return all the block fields in the template
     *
     * @return array
     * @since  LiveDocx 1.0
     */
    public function getBlockNames()
    {
        $this->logIn();

        $ret    = array();
        $result = $this->getSoapClient()->GetBlockNames();

        if (isset($result->GetBlockNamesResult->string)) {
            if (is_array($result->GetBlockNamesResult->string)) {
                $ret = $result->GetBlockNamesResult->string;
            } else {
                $ret[] = $result->GetBlockNamesResult->string;
            }
        }

        return $ret;
    }

    /**
     * Upload a template file to LiveDocx service
     *
     * @param  string $filename
     * @return void
     * @throws Zend_Service_LiveDocx_Exception
     * @since  LiveDocx 1.0
     */
    public function uploadTemplate($filename)
    {
        $this->logIn();

        try {
            $this->getSoapClient()->UploadTemplate(array(
                'template' => base64_encode(file_get_contents($filename)),
                'filename' => basename($filename),
            ));
        } catch (Exception $e) {
            require_once 'Zend/Service/LiveDocx/Exception.php';
            throw new Zend_Service_LiveDocx_Exception(
                'Cannot upload template', 0, $e
            );
        }
    }

    /**
     * Download template file from LiveDocx service
     *
     * @param  string $filename
     * @return binary
     * @throws Zend_Service_LiveDocx_Exception
     * @since  LiveDocx 1.0
     */
    public function downloadTemplate($filename)
    {
        $this->logIn();

        try {
            $result = $this->getSoapClient()->DownloadTemplate(array(
                'filename' => basename($filename),
            ));
        } catch (Exception $e) {
            require_once 'Zend/Service/LiveDocx/Exception.php';
            throw new Zend_Service_LiveDocx_Exception(
                'Cannot download template', 0, $e
            );
        }

        return base64_decode($result->DownloadTemplateResult);
    }

    /**
     * Delete a template file from LiveDocx service
     *
     * @param  string $filename
     * @return void
     * @throws Zend_Service_LiveDocx_Exception
     * @since  LiveDocx 1.0
     */
    public function deleteTemplate($filename)
    {
        $this->logIn();

        $this->getSoapClient()->DeleteTemplate(array(
            'filename' => basename($filename),
        ));
    }

    /**
     * List all templates stored on LiveDocx service
     *
     * @return array
     * @since  LiveDocx 1.0
     */
    public function listTemplates()
    {
        $this->logIn();

        $ret    = array();
        $result = $this->getSoapClient()->ListTemplates();

        if (isset($result->ListTemplatesResult)) {
            $ret = $this->_backendListArrayToMultiAssocArray($result->ListTemplatesResult);
        }

        return $ret;
    }

    /**
     * Check whether a template file is available on LiveDocx service
     *
     * @param  string $filename
     * @return boolean
     * @since  LiveDocx 1.0
     */
    public function templateExists($filename)
    {
        $this->logIn();

        $result = $this->getSoapClient()->TemplateExists(array(
            'filename' => basename($filename),
        ));

        return (boolean) $result->TemplateExistsResult;
    }

    /**
     * Share a document - i.e. the document is available to all over the Internet
     *
     * @return string
     * @since  LiveDocx 1.0
     */
    public function shareDocument()
    {
        $this->logIn();

        $ret    = null;
        $result = $this->getSoapClient()->ShareDocument();

        if (isset($result->ShareDocumentResult)) {
            $ret = (string) $result->ShareDocumentResult;
        }

        return $ret;
    }

    /**
     * List all shared documents stored on LiveDocx service
     *
     * @return array
     * @since  LiveDocx 1.0
     */
    public function listSharedDocuments()
    {
        $this->logIn();

        $ret    = array();
        $result = $this->getSoapClient()->ListSharedDocuments();

        if (isset($result->ListSharedDocumentsResult)) {
            $ret = $this->_backendListArrayToMultiAssocArray(
                $result->ListSharedDocumentsResult
            );
        }

        return $ret;
    }

    /**
     * Delete a shared document from LiveDocx service
     *
     * @param  string $filename
     * @return void
     * @since  LiveDocx 1.0
     */
    public function deleteSharedDocument($filename)
    {
        $this->logIn();

        $this->getSoapClient()->DeleteSharedDocument(array(
            'filename' => basename($filename),
        ));
    }

    /*
     * Download a shared document from LiveDocx service
     *
     * @param  string $filename
     * @return binary
     * @throws Zend_Service_LiveDocx_Exception
     * @since  LiveDocx 1.0
     */
    public function downloadSharedDocument($filename)
    {
        $this->logIn();

        try {
            $result = $this->getSoapClient()->DownloadSharedDocument(array(
                'filename' => basename($filename),
            ));
        } catch (Exception $e) {
            require_once 'Zend/Service/LiveDocx/Exception.php';
            throw new Zend_Service_LiveDocx_Exception(
                'Cannot download shared document', 0, $e
            );
        }

        return base64_decode($result->DownloadSharedDocumentResult);
    }

    /**
     * Check whether a shared document is available on LiveDocx service
     *
     * @param  string $filename
     * @return boolean
     * @since  LiveDocx 1.0
     */
    public function sharedDocumentExists($filename)
    {
        $this->logIn();

        $ret             = false;
        $sharedDocuments = $this->listSharedDocuments();
        foreach ($sharedDocuments as $shareDocument) {
            if (isset($shareDocument['filename'])
                && (basename($filename) === $shareDocument['filename'])
            ) {
                $ret = true;
                break;
            }
        }

        return $ret;
    }

    /**
     * Return supported template formats (lowercase)
     *
     * @return array
     * @since  LiveDocx 1.0
     */
    public function getTemplateFormats()
    {
        $this->logIn();

        $ret    = array();
        $result = $this->getSoapClient()->GetTemplateFormats();

        if (isset($result->GetTemplateFormatsResult->string)) {
            $ret = $result->GetTemplateFormatsResult->string;
            $ret = array_map('strtolower', $ret);
        }

        return $ret;
    }

    /**
     * Return supported document formats (lowercase)
     *
     * @return array
     * @since  LiveDocx 1.1
     */
    public function getDocumentFormats()
    {
        $this->logIn();

        $ret    = array();
        $result = $this->getSoapClient()->GetDocumentFormats();

        if (isset($result->GetDocumentFormatsResult->string)) {
            $ret = $result->GetDocumentFormatsResult->string;
            $ret = array_map('strtolower', $ret);
        }

        return $ret;
    }

    /**
     * Return the names of all fonts that are installed on backend server
     *
     * @return array
     * @since  LiveDocx 1.2
     */
    public function getFontNames()
    {
        $this->logIn();

        $ret    = array();
        $result = $this->getSoapClient()->GetFontNames();

        if (isset($result->GetFontNamesResult->string)) {
            $ret = $result->GetFontNamesResult->string;
        }

        return $ret;
    }

    /**
     * Return supported document access options
     *
     * @return array
     * @since  LiveDocx 1.2 Premium
     */
    public function getDocumentAccessOptions()
    {
        $this->logIn();

        $ret    = array();
        $result = $this->getSoapClient()->GetDocumentAccessOptions();

        if (isset($result->GetDocumentAccessOptionsResult->string)) {
            $ret = $result->GetDocumentAccessOptionsResult->string;
        }

        return $ret;
    }

    /**
     * Return supported image formats from which can be imported (lowercase)
     *
     * @return array
     * @since  LiveDocx 2.0
     */
    public function getImageImportFormats()
    {
        $this->logIn();

        $ret    = array();
        $result = $this->getSoapClient()->GetImageImportFormats();

        if (isset($result->GetImageImportFormatsResult->string)) {
            $ret = $result->GetImageImportFormatsResult->string;
            $ret = array_map('strtolower', $ret);
        }

        return $ret;
    }

    /**
     * Return supported image formats to which can be exported (lowercase)
     *
     * @return array
     * @since  LiveDocx 2.0
     */
    public function getImageExportFormats()
    {
        $this->logIn();

        $ret    = array();
        $result = $this->getSoapClient()->GetImageExportFormats();

        if (isset($result->GetImageExportFormatsResult->string)) {
            $ret = $result->GetImageExportFormatsResult->string;
            $ret = array_map('strtolower', $ret);
        }

        return $ret;
    }

    /*
     * Return supported image formats (lowercase)
     *
     * @return array
     * @since  LiveDocx 1.2
     * @deprecated since LiveDocx 2.0
     */
    public function getImageFormats()
    {
        $replacement = 'getImageExportFormats';

        /*
        $errorMessage = sprintf(
                        "%s::%s is deprecated as of LiveDocx 2.0. "
                      . "It has been replaced by %s::%s() (drop in replacement)",
                        __CLASS__, __FUNCTION__, __CLASS__, $replacement);

        trigger_error($errorMessage, E_USER_NOTICE);
        */

        return $this->$replacement();
    }

    /**
     * Upload an image file to LiveDocx service
     *
     * @param  string $filename
     * @return void
     * @throws Zend_Service_LiveDocx_Exception
     * @since  LiveDocx 2.0
     */
    public function uploadImage($filename)
    {
        $this->logIn();

        try {
            $this->getSoapClient()->UploadImage(array(
                'image'    => base64_encode(file_get_contents($filename)),
                'filename' => basename($filename),
            ));
        } catch (Exception $e) {
            require_once 'Zend/Service/LiveDocx/Exception.php';
            throw new Zend_Service_LiveDocx_Exception(
                'Cannot upload image', 0, $e
            );
        }
    }

    /**
     * Download an image file from LiveDocx service
     *
     * @param  string $filename
     * @return void
     * @throws Zend_Service_LiveDocx_Exception
     * @since  LiveDocx 2.0
     */
    public function downloadImage($filename)
    {
        $this->logIn();

        try {
            $result = $this->getSoapClient()->DownloadImage(array(
                'filename' => basename($filename),
            ));
        } catch (Exception $e) {
            require_once 'Zend/Service/LiveDocx/Exception.php';
            throw new Zend_Service_LiveDocx_Exception(
                'Cannot download image', 0, $e
            );
        }

        return base64_decode($result->DownloadImageResult);
    }

    /**
     * List all images stored on LiveDocx service
     *
     * @return array
     * @since  LiveDocx 2.0
     */
    public function listImages()
    {
        $this->logIn();

        $ret    = array();
        $result = $this->getSoapClient()->ListImages();

        if (isset($result->ListImagesResult)) {
            $ret = $this->_backendListArrayToMultiAssocArray($result->ListImagesResult);
        }

        return $ret;
    }

    /**
     * Delete an image file from LiveDocx service
     *
     * @param  string $filename
     * @return void
     * @throws Zend_Service_LiveDocx_Exception
     * @since  LiveDocx 2.0
     */
    public function deleteImage($filename)
    {
        $this->logIn();

        $this->getSoapClient()->DeleteImage(array(
            'filename' => basename($filename),
        ));
    }

    /**
     * Check whether an image file is available on LiveDocx service
     *
     * @param  string $filename
     * @return boolean
     * @since  LiveDocx 2.0
     */
    public function imageExists($filename)
    {
        $this->logIn();

        $result = $this->getSoapClient()->ImageExists(array(
            'filename' => basename($filename),
        ));

        return (boolean) $result->ImageExistsResult;
    }

    /**
     * Convert LiveDocx service return value from list methods to consistent PHP array
     *
     * @param  array $list
     * @return array
     * @since  LiveDocx 1.0
     */
    protected function _backendListArrayToMultiAssocArray($list)
    {
        $this->logIn();

        $ret = array();
        if (isset($list->ArrayOfString)) {
           foreach ($list->ArrayOfString as $a) {
               if (is_array($a)) {      // 1 template only
                   $o = new stdClass();
                   $o->string = $a;
               } else {                 // 2 or more templates
                   $o = $a;
               }
               unset($a);

               if (isset($o->string)) {
                   $date1 = new Zend_Date($o->string[3], Zend_Date::RFC_1123);
                   $date2 = new Zend_Date($o->string[1], Zend_Date::RFC_1123);

                   $ret[] = array (
                        'filename'   => $o->string[0],
                        'fileSize'   => (integer) $o->string[2],
                        'createTime' => (integer) $date1->get(Zend_Date::TIMESTAMP),
                        'modifyTime' => (integer) $date2->get(Zend_Date::TIMESTAMP),
                   );
               }
           }
        }

        return $ret;
    }

    /**
     * Convert assoc array to required SOAP type
     *
     * @param array $assoc
     *
     * @return array
     * @since  LiveDocx 1.0
     */
    public static function assocArrayToArrayOfArrayOfString($assoc)
    {
        $arrayKeys   = array_keys($assoc);
        $arrayValues = array_values($assoc);

        return array($arrayKeys, $arrayValues);
    }

    /**
     * Convert multi assoc array to required SOAP type
     *
     * @param  array $multi
     * @return array
     * @since  LiveDocx 1.0
     */
    public static function multiAssocArrayToArrayOfArrayOfString($multi)
    {
        $arrayKeys   = array_keys($multi[0]);
        $arrayValues = array();

        foreach ($multi as $v) {
            $arrayValues[] = array_values($v);
        }

        $arrayKeys = array($arrayKeys);

        return array_merge($arrayKeys, $arrayValues);
    }

    // -------------------------------------------------------------------------

}


text:
<?php
/**
 * Zend Framework
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://framework.zend.com/license/new-bsd
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@zend.com so we can send you a copy immediately.
 *
 * @category   Zend
 * @package    Zend_Service
 * @subpackage DeveloperGarden
 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @version    $Id: Exception.php 23775 2011-03-01 17:25:24Z ralph $
 */

/**
 * Zend_Service_Exception
 */
require_once 'Zend/Service/Exception.php';

/**
 * @category   Zend
 * @package    Zend_Service
 * @subpackage DeveloperGarden
 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @author     Marco Kaiser
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
class Zend_Service_DeveloperGarden_Exception extends Zend_Service_Exception
{
}

repo_name: michael-romer/zf-boilerplate

repo_language: PHP

mime_type: text/html


text:
<?php
/**
 * Zend Framework
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://framework.zend.com/license/new-bsd
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@zend.com so we can send you a copy immediately.
 *
 * @category   Zend
 * @package    Zend_Service
 * @subpackage DeveloperGarden
 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @version    $Id: VoiceCall.php 23775 2011-03-01 17:25:24Z ralph $
 */

/**
 * @see Zend_Service_DeveloperGarden_Client_ClientAbstract
 */
require_once 'Zend/Service/DeveloperGarden/Client/ClientAbstract.php';

/**
 * @see Zend_Service_DeveloperGarden_Request_VoiceButler_NewCall
 */
require_once 'Zend/Service/DeveloperGarden/Request/VoiceButler/NewCall.php';

/**
 * @see Zend_Service_DeveloperGarden_Request_VoiceButler_NewCallSequenced
 */
require_once 'Zend/Service/DeveloperGarden/Request/VoiceButler/NewCallSequenced.php';

/**
 * @see Zend_Service_DeveloperGarden_Request_VoiceButler_TearDownCall
 */
require_once 'Zend/Service/DeveloperGarden/Request/VoiceButler/TearDownCall.php';

/**
 * @see Zend_Service_DeveloperGarden_Request_VoiceButler_CallStatus
 */
require_once 'Zend/Service/DeveloperGarden/Request/VoiceButler/CallStatus.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_VoiceButler_NewCallResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/VoiceButler/NewCallResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_VoiceButler_NewCallSequencedResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/VoiceButler/NewCallSequencedResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_VoiceButler_TearDownCallResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/VoiceButler/TearDownCallResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_VoiceButler_CallStatusResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/VoiceButler/CallStatusResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_VoiceButler_CallStatus2Response
 */
require_once 'Zend/Service/DeveloperGarden/Response/VoiceButler/CallStatus2Response.php';

/**
 * @category   Zend
 * @package    Zend_Service
 * @subpackage DeveloperGarden
 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @author     Marco Kaiser
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
class Zend_Service_DeveloperGarden_VoiceCall
    extends Zend_Service_DeveloperGarden_Client_ClientAbstract
{
    /**
     * wsdl file
     *
     * @var string
     */
    protected $_wsdlFile = 'https://gateway.developer.telekom.com/p3gw-mod-odg-voicebutler/services/VoiceButlerService?wsdl';

    /**
     * wsdl file local
     *
     * @var string
     */
    protected $_wsdlFileLocal = 'Wsdl/VoiceButlerService.wsdl';

    /**
     * Response, Request Classmapping
     *
     * @var array
     *
     */
    protected $_classMap = array(
        'newCallResponse'          => 'Zend_Service_DeveloperGarden_Response_VoiceButler_NewCallResponse',
        'newCallSequencedResponse' => 'Zend_Service_DeveloperGarden_Response_VoiceButler_NewCallSequencedResponse',
        'tearDownCallResponse'     => 'Zend_Service_DeveloperGarden_Response_VoiceButler_TearDownCallResponse',
        'callStatusResponse'       => 'Zend_Service_DeveloperGarden_Response_VoiceButler_CallStatusResponse',
        'callStatus2Response'      => 'Zend_Service_DeveloperGarden_Response_VoiceButler_CallStatus2Response'
    );

    /**
     * init a new call with the given params
     *
     * @param string $aNumber
     * @param string $bNumber
     * @param integer $expiration
     * @param integer $maxDuration
     * @param integer $account
     * @param boolean $privacyA
     * @param boolean $privacyB
     * @param string $greeter
     * @return Zend_Service_DeveloperGarden_Response_VoiceButler_NewCallResponse
     */
    public function newCall($aNumber, $bNumber, $expiration, $maxDuration,
        $account = null, $privacyA = null, $privacyB = null, $greeter = null
    ) {
        $request = new Zend_Service_DeveloperGarden_Request_VoiceButler_NewCall(
                $this->getEnvironment()
        );
        $request->setANumber($aNumber)
                ->setBNumber($bNumber)
                ->setPrivacyA($privacyA)
                ->setPrivacyB($privacyB)
                ->setExpiration($expiration)
                ->setMaxDuration($maxDuration)
                ->setGreeter($greeter)
                ->setAccount($account);
        $result = $this->getSoapClient()->newCall(array(
            'request' => $request
        ));

        return $result->parse();
    }

    /**
     * init a new call with the given params but specially here,
     * you can define a set of numbers to be called if the first number
     * isnt reachable (ie: bNumber = +4930-111111,+4930-222222,+4930-333333)
     *
     * @throws Zend_Service_DeveloperGarden_Client_Exception
     * @param string $aNumber
     * @param array $bNumber
     * @param integer $expiration
     * @param integer $maxDuration
     * @param integer $maxWait
     * @param integer $account
     * @param boolean $privacyA
     * @param boolean $privacyB
     * @param string $greeter
     * @return Zend_Service_DeveloperGarden_Response_VoiceButler_NewCallSequencedResponse
     */
    public function newCallSequenced($aNumber, $bNumber, $expiration, $maxDuration,
        $maxWait, $account = null, $privacyA = null, $privacyB = null, $greeter = null
    ) {
        $request = new Zend_Service_DeveloperGarden_Request_VoiceButler_NewCallSequenced(
                $this->getEnvironment()
        );
        $request->setANumber($aNumber)
                ->setBNumber($bNumber)
                ->setPrivacyA($privacyA)
                ->setPrivacyB($privacyB)
                ->setExpiration($expiration)
                ->setMaxDuration($maxDuration)
                ->setMaxWait($maxWait)
                ->setGreeter($greeter)
                ->setAccount($account);
        $result = $this->getSoapClient()->newCallSequenced(array(
            'request' => $request
        ));

        return $result->parse();
    }

    /**
     * This tear down the call with the given sessionId
     *
     * @param string $sessionId
     * @return Zend_Service_DeveloperGarden_Response_VoiceButler_TearDownCallResponse
     */
    public function tearDownCall($sessionId)
    {
        $request = new Zend_Service_DeveloperGarden_Request_VoiceButler_TearDownCall(
            $this->getEnvironment(),
            $sessionId
        );
        $result = $this->getSoapClient()->tearDownCall(array(
            'request' => $request
        ));

        return $result->parse();
    }

    /**
     * checks the callStatus and updates the keepAlive if provided
     *
     * @param string $sessionId
     * @param integer $keepAlive
     * @return Zend_Service_DeveloperGarden_Response_VoiceButler_CallStatusResponse
     */
    public function callStatus($sessionId, $keepAlive = null)
    {
        $request = new Zend_Service_DeveloperGarden_Request_VoiceButler_CallStatus(
            $this->getEnvironment(),
            $sessionId,
            $keepAlive
        );

        $result = $this->getSoapClient()->callStatus2(array(
            'request' => $request
        ));

        return $result->parse();
    }
}


text:
<?php
/**
 * Zend Framework
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://framework.zend.com/license/new-bsd
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@zend.com so we can send you a copy immediately.
 *
 * @category   Zend
 * @package    Zend_Service
 * @subpackage DeveloperGarden
 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @version    $Id: SendSms.php 23775 2011-03-01 17:25:24Z ralph $
 */

/**
 * @see Zend_Service_DeveloperGarden_Client_ClientAbstract
 */
require_once 'Zend/Service/DeveloperGarden/Client/ClientAbstract.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_SendSms_SendSMSResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/SendSms/SendSMSResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_SendSms_SendFlashSMSResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/SendSms/SendFlashSMSResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_Request_SendSms_SendSMS
 */
require_once 'Zend/Service/DeveloperGarden/Request/SendSms/SendSMS.php';

/**
 * @see Zend_Service_DeveloperGarden_Request_SendSms_SendFlashSMS
 */
require_once 'Zend/Service/DeveloperGarden/Request/SendSms/SendFlashSMS.php';

/**
 * @category   Zend
 * @package    Zend_Service
 * @subpackage DeveloperGarden
 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @author     Marco Kaiser
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
class Zend_Service_DeveloperGarden_SendSms
    extends Zend_Service_DeveloperGarden_Client_ClientAbstract
{
    /**
     * wsdl file
     *
     * @var string
     */
    protected $_wsdlFile = 'https://gateway.developer.telekom.com/p3gw-mod-odg-sms/services/SmsService?wsdl';

    /**
     * wsdl file local
     *
     * @var string
     */
    protected $_wsdlFileLocal = 'Wsdl/SmsService.wsdl';

    /**
     * Response, Request Classmapping
     *
     * @var array
     *
     */
    protected $_classMap = array(
        'sendSMSResponse'      => 'Zend_Service_DeveloperGarden_Response_SendSms_SendSMSResponse',
        'sendFlashSMSResponse' => 'Zend_Service_DeveloperGarden_Response_SendSms_SendFlashSMSResponse'
    );

    /**
     * this function creates the raw sms object that can be used to send an sms
     * or as flash sms
     *
     * @param string $number
     * @param string $message
     * @param string $originator
     * @param integer $account
     *
     * @return Zend_Service_DeveloperGarden_Request_SendSms_SendSMS
     */
    public function createSms($number = null, $message = null, $originator = null, $account = null)
    {
        $request = new Zend_Service_DeveloperGarden_Request_SendSms_SendSMS($this->getEnvironment());
        $request->setNumber($number)
                ->setMessage($message)
                ->setOriginator($originator)
                ->setAccount($account);
        return $request;
    }

    /**
     * this function creates the raw sms object that can be used to send an sms
     * or as flash sms
     *
     * @param string $number
     * @param string $message
     * @param string $originator
     * @param integer $account
     *
     * @return Zend_Service_DeveloperGarden_Request_SendSms_SendFlashSMS
     */
    public function createFlashSms($number = null, $message = null, $originator = null, $account = null)
    {
        $request = new Zend_Service_DeveloperGarden_Request_SendSms_SendFlashSMS($this->getEnvironment());
        $request->setNumber($number)
                ->setMessage($message)
                ->setOriginator($originator)
                ->setAccount($account);
        return $request;
    }

    /**
     * sends an sms with the given parameters
     *
     * @param Zend_Service_DeveloperGarden_Request_SendSms_SendSmsAbstract $sms
     *
     * @return Zend_Service_DeveloperGarden_Response_SendSms_SendSmsAbstract
     */
    public function send(Zend_Service_DeveloperGarden_Request_SendSms_SendSmsAbstract $sms)
    {
        $client = $this->getSoapClient();
        $request = array(
            'request' => $sms
        );
        switch ($sms->getSmsType()) {
            // Sms
            case 1 :
                $response = $client->sendSms($request);
                break;
            // flashSms
            case 2 :
                $response = $client->sendFlashSms($request);
                break;
            default : {
                require_once 'Zend/Service/DeveloperGarden/Client/Exception.php';
                throw new Zend_Service_DeveloperGarden_Client_Exception('Unknown SMS Type');
            }
        }

        return $response->parse();
    }
}


text:
<?php
/**
 * Zend Framework
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://framework.zend.com/license/new-bsd
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@zend.com so we can send you a copy immediately.
 *
 * @category   Zend
 * @package    Zend_Service
 * @subpackage DeveloperGarden
 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @version    $Id: IpLocation.php 23775 2011-03-01 17:25:24Z ralph $
 */

/**
 * @see Zend_Service_DeveloperGarden_Client_ClientAbstract
 */
require_once 'Zend/Service/DeveloperGarden/Client/ClientAbstract.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_IpLocation_LocateIPResponseType
 */
require_once 'Zend/Service/DeveloperGarden/Response/IpLocation/LocateIPResponseType.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_IpLocation_LocateIPResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/IpLocation/LocateIPResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_IpLocation_IPAddressLocationType
 */
require_once 'Zend/Service/DeveloperGarden/Response/IpLocation/IPAddressLocationType.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_IpLocation_RegionType
 */
require_once 'Zend/Service/DeveloperGarden/Response/IpLocation/RegionType.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_IpLocation_GeoCoordinatesType
 */
require_once 'Zend/Service/DeveloperGarden/Response/IpLocation/GeoCoordinatesType.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_IpLocation_CityType
 */
require_once 'Zend/Service/DeveloperGarden/Response/IpLocation/CityType.php';

/**
 * @see Zend_Service_DeveloperGarden_Request_IpLocation_LocateIPRequest
 */
require_once 'Zend/Service/DeveloperGarden/Request/IpLocation/LocateIPRequest.php';

/**
 * @category   Zend
 * @package    Zend_Service
 * @subpackage DeveloperGarden
 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @author     Marco Kaiser
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
class Zend_Service_DeveloperGarden_IpLocation
    extends Zend_Service_DeveloperGarden_Client_ClientAbstract
{
    /**
     * wsdl file
     *
     * @var string
     */
    protected $_wsdlFile = 'https://gateway.developer.telekom.com/p3gw-mod-odg-iplocation/services/IPLocation?wsdl';

    /**
     * wsdl file local
     *
     * @var string
     */
    protected $_wsdlFileLocal = 'Wsdl/IPLocation.wsdl';

    /**
     * Response, Request Classmapping
     *
     * @var array
     *
     */
    protected $_classMap = array(
        'LocateIPResponseType'  => 'Zend_Service_DeveloperGarden_Response_IpLocation_LocateIPResponseType',
        'IPAddressLocationType' => 'Zend_Service_DeveloperGarden_Response_IpLocation_IPAddressLocationType',
        'RegionType'            => 'Zend_Service_DeveloperGarden_Response_IpLocation_RegionType',
        'GeoCoordinatesType'    => 'Zend_Service_DeveloperGarden_Response_IpLocation_GeoCoordinatesType',
        'CityType'              => 'Zend_Service_DeveloperGarden_Response_IpLocation_CityType',
    );

    /**
     * locate the given Ip address or array of addresses
     *
     * @param Zend_Service_DeveloperGarden_IpLocation_IpAddress|string $ip
     * @return Zend_Service_DeveloperGarden_Response_IpLocation_LocateIPResponse
     */
    public function locateIP($ip)
    {
        $request = new Zend_Service_DeveloperGarden_Request_IpLocation_LocateIPRequest(
            $this->getEnvironment(),
            $ip
        );

        $result = $this->getSoapClient()->locateIP($request);

        $response = new Zend_Service_DeveloperGarden_Response_IpLocation_LocateIPResponse($result);
        return $response->parse();
    }
}


text:
<?php
/**
 * Zend Framework
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://framework.zend.com/license/new-bsd
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@zend.com so we can send you a copy immediately.
 *
 * @category   Zend
 * @package    Zend_Service
 * @subpackage DeveloperGarden
 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @version    $Id: SecurityTokenServer.php 23775 2011-03-01 17:25:24Z ralph $
 */

/**
 * @see Zend_Service_DeveloperGarden_SecurityTokenServer_Cache
 */
require_once 'Zend/Service/DeveloperGarden/SecurityTokenServer/Cache.php';

/**
 * @see Zend_Service_DeveloperGarden_Client_ClientAbstract
 */
require_once 'Zend/Service/DeveloperGarden/Client/ClientAbstract.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_SecurityTokenServer_SecurityTokenResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/SecurityTokenServer/SecurityTokenResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_SecurityTokenServer_GetTokensResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/SecurityTokenServer/GetTokensResponse.php';

/**
 * @category   Zend
 * @package    Zend_Service
 * @subpackage DeveloperGarden
 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @author     Marco Kaiser
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
class Zend_Service_DeveloperGarden_SecurityTokenServer
    extends Zend_Service_DeveloperGarden_Client_ClientAbstract
{
    /**
     * wsdl file
     *
     * @var string
     */
    protected $_wsdlFile = 'https://sts.idm.telekom.com/TokenService?wsdl';

    /**
     * wsdl file local
     *
     * @var string
     */
    protected $_wsdlFileLocal = 'Wsdl/TokenService.wsdl';

    /**
     * Response, Request Classmapping
     *
     * @var array
     *
     */
    protected $_classMap = array(
        'SecurityTokenResponse' => 'Zend_Service_DeveloperGarden_Response_SecurityTokenServer_SecurityTokenResponse',
        'getTokensResponse'     => 'Zend_Service_DeveloperGarden_Response_SecurityTokenServer_GetTokensResponse'
    );

    /**
     * does the login and return the specific response
     *
     * @return Zend_Service_DeveloperGarden_Response_SecurityTokenServer_SecurityTokenResponse
     */
    public function getLoginToken()
    {
        $token = Zend_Service_DeveloperGarden_SecurityTokenServer_Cache::getTokenFromCache(
            'securityToken'
        );

        if ($token === null
            || !$token->isValid()
        ) {
            $token = $this->getSoapClient()->login('login');
            Zend_Service_DeveloperGarden_SecurityTokenServer_Cache::setTokenToCache(
                'securityToken',
                $token
            );
        }

        return $token;
    }

    /**
     * returns the fetched token from token server
     *
     * @return Zend_Service_DeveloperGarden_Response_SecurityTokenServer_GetTokensResponse
     */
    public function getTokens()
    {
        $token = Zend_Service_DeveloperGarden_SecurityTokenServer_Cache::getTokenFromCache(
            'getTokens'
        );

        if ($token === null
            || !$token->isValid()
        ) {
            $token = $this->getSoapClient()->getTokens(array(
                'serviceId' => $this->_serviceAuthId
            ));
            Zend_Service_DeveloperGarden_SecurityTokenServer_Cache::setTokenToCache(
                'getTokens',
                $token
            );
        }
        return $token;
    }
}


text:
<?php
/**
 * Zend Framework
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://framework.zend.com/license/new-bsd
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@zend.com so we can send you a copy immediately.
 *
 * @category   Zend
 * @package    Zend_Service
 * @subpackage DeveloperGarden
 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @version    $Id: LocalSearch.php 23775 2011-03-01 17:25:24Z ralph $
 */

/**
 * @see Zend_Service_DeveloperGarden_Client_ClientAbstract
 */
require_once 'Zend/Service/DeveloperGarden/Client/ClientAbstract.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_LocalSearch_LocalSearchResponseType
 */
require_once 'Zend/Service/DeveloperGarden/Response/LocalSearch/LocalSearchResponseType.php';

/**
 * @see Zend_Service_DeveloperGarden_Request_LocalSearch_LocalSearchRequest
 */
require_once 'Zend/Service/DeveloperGarden/Request/LocalSearch/LocalSearchRequest.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_LocalSearch_LocalSearchResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/LocalSearch/LocalSearchResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_LocalSearch_SearchParameters
 */
require_once 'Zend/Service/DeveloperGarden/LocalSearch/SearchParameters.php';

/**
 * @category   Zend
 * @package    Zend_Service
 * @subpackage DeveloperGarden
 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @author     Marco Kaiser
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
class Zend_Service_DeveloperGarden_LocalSearch
    extends Zend_Service_DeveloperGarden_Client_ClientAbstract
{
    /**
     * wsdl file
     *
     * @var string
     */
    protected $_wsdlFile = 'https://gateway.developer.telekom.com/p3gw-mod-odg-localsearch/services/localsearch?wsdl';

    /**
     * wsdl file local
     *
     * @var string
     */
    protected $_wsdlFileLocal = 'Wsdl/localsearch.wsdl';

    /**
     * Response, Request Classmapping
     *
     * @var array
     *
     */
    protected $_classMap = array(
        'LocalSearchResponseType' => 'Zend_Service_DeveloperGarden_Response_LocalSearch_LocalSearchResponseType'
    );

    /**
     * localSearch with the given parameters
     *
     * @param Zend_Service_DeveloperGarden_LocalSearch_SearchParameters $searchParameters
     * @param integer $account
     * @return Zend_Service_DeveloperGarden_Response_LocalSearch_LocalSearchResponseType
     */
    public function localSearch(
        Zend_Service_DeveloperGarden_LocalSearch_SearchParameters $searchParameters,
        $account = null
    ) {
        $request = new Zend_Service_DeveloperGarden_Request_LocalSearch_LocalSearchRequest(
            $this->getEnvironment(),
            $searchParameters,
            $account
        );

        $result = $this->getSoapClient()->localSearch($request);

        $response = new Zend_Service_DeveloperGarden_Response_LocalSearch_LocalSearchResponse($result);
        return $response->parse();
    }
}


text:
<?php
/**
 * Zend Framework
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://framework.zend.com/license/new-bsd
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@zend.com so we can send you a copy immediately.
 *
 * @category   Zend
 * @package    Zend_Service
 * @subpackage DeveloperGarden
 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @version    $Id: ConferenceCall.php 23775 2011-03-01 17:25:24Z ralph $
 */

/**
 * @see Zend_Service_DeveloperGarden_Client_ClientAbstract
 */
require_once 'Zend/Service/DeveloperGarden/Client/ClientAbstract.php';

/**
 * @see Zend_Service_DeveloperGarden_Request_ConferenceCall_CreateConferenceRequest
 */
require_once 'Zend/Service/DeveloperGarden/Request/ConferenceCall/CreateConferenceRequest.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_CreateConferenceResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/CreateConferenceResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_CreateConferenceResponseType
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/CreateConferenceResponseType.php';

/**
 * @see Zend_Service_DeveloperGarden_Request_ConferenceCall_NewParticipantRequest
 */
require_once 'Zend/Service/DeveloperGarden/Request/ConferenceCall/NewParticipantRequest.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_NewParticipantResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/NewParticipantResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_NewParticipantResponseType
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/NewParticipantResponseType.php';

/**
 * @see Zend_Service_DeveloperGarden_Request_ConferenceCall_GetParticipantStatusRequest
 */
require_once 'Zend/Service/DeveloperGarden/Request/ConferenceCall/GetParticipantStatusRequest.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_GetParticipantStatusResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/GetParticipantStatusResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_GetParticipantStatusResponseType
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/GetParticipantStatusResponseType.php';

/**
 * @see Zend_Service_DeveloperGarden_Request_ConferenceCall_UpdateParticipantRequest
 */
require_once 'Zend/Service/DeveloperGarden/Request/ConferenceCall/UpdateParticipantRequest.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_UpdateParticipantResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/UpdateParticipantResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_Request_ConferenceCall_RemoveParticipantRequest
 */
require_once 'Zend/Service/DeveloperGarden/Request/ConferenceCall/RemoveParticipantRequest.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_RemoveParticipantResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/RemoveParticipantResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_Request_ConferenceCall_GetConferenceListRequest
 */
require_once 'Zend/Service/DeveloperGarden/Request/ConferenceCall/GetConferenceListRequest.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_GetConferenceListResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/GetConferenceListResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_GetConferenceListResponseType
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/GetConferenceListResponseType.php';

/**
 * @see Zend_Service_DeveloperGarden_Request_ConferenceCall_RemoveConferenceRequest
 */
require_once 'Zend/Service/DeveloperGarden/Request/ConferenceCall/RemoveConferenceRequest.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_RemoveConferenceResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/RemoveConferenceResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_CCSResponseType
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/CCSResponseType.php';

/**
 * @see Zend_Service_DeveloperGarden_Request_ConferenceCall_GetConferenceStatusRequest
 */
require_once 'Zend/Service/DeveloperGarden/Request/ConferenceCall/GetConferenceStatusRequest.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_GetConferenceStatusResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/GetConferenceStatusResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_GetConferenceStatusResponseType
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/GetConferenceStatusResponseType.php';

/**
 * @see Zend_Service_DeveloperGarden_Request_ConferenceCall_GetRunningConferenceRequest
 */
require_once 'Zend/Service/DeveloperGarden/Request/ConferenceCall/GetRunningConferenceRequest.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_GetRunningConferenceResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/GetRunningConferenceResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_GetRunningConferenceResponseType
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/GetRunningConferenceResponseType.php';

/**
 * @see Zend_Service_DeveloperGarden_Request_ConferenceCall_GetConferenceTemplateListRequest
 */
require_once 'Zend/Service/DeveloperGarden/Request/ConferenceCall/GetConferenceTemplateListRequest.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_GetConferenceTemplateListResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/GetConferenceTemplateListResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_GetConferenceTemplateListResponseType
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/GetConferenceTemplateListResponseType.php';

/**
 * @see Zend_Service_DeveloperGarden_Request_ConferenceCall_CreateConferenceTemplateRequest
 */
require_once 'Zend/Service/DeveloperGarden/Request/ConferenceCall/CreateConferenceTemplateRequest.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_CreateConferenceTemplateResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/CreateConferenceTemplateResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_CreateConferenceTemplateResponseType
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/CreateConferenceTemplateResponseType.php';

/**
 * @see Zend_Service_DeveloperGarden_Request_ConferenceCall_GetConferenceTemplateRequest
 */
require_once 'Zend/Service/DeveloperGarden/Request/ConferenceCall/GetConferenceTemplateRequest.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_GetConferenceTemplateResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/GetConferenceTemplateResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_GetConferenceTemplateResponseType
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/GetConferenceTemplateResponseType.php';

/**
 * @see Zend_Service_DeveloperGarden_Request_ConferenceCall_RemoveConferenceTemplateRequest
 */
require_once 'Zend/Service/DeveloperGarden/Request/ConferenceCall/RemoveConferenceTemplateRequest.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_RemoveConferenceTemplateResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/RemoveConferenceTemplateResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_Request_ConferenceCall_UpdateConferenceTemplateRequest
 */
require_once 'Zend/Service/DeveloperGarden/Request/ConferenceCall/UpdateConferenceTemplateRequest.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_UpdateConferenceTemplateResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/UpdateConferenceTemplateResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_Request_ConferenceCall_GetConferenceTemplateParticipantRequest
 */
require_once 'Zend/Service/DeveloperGarden/Request/ConferenceCall/GetConferenceTemplateParticipantRequest.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_GetConferenceTemplateParticipantResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/GetConferenceTemplateParticipantResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_GetConferenceTemplateParticipantResponseType
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/GetConferenceTemplateParticipantResponseType.php';

/**
 * @see Zend_Service_DeveloperGarden_Request_ConferenceCall_RemoveConferenceTemplateParticipantRequest
 */
require_once 'Zend/Service/DeveloperGarden/Request/ConferenceCall/RemoveConferenceTemplateParticipantRequest.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_RemoveConferenceTemplateParticipantResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/RemoveConferenceTemplateParticipantResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_Request_ConferenceCall_UpdateConferenceTemplateParticipantRequest
 */
require_once 'Zend/Service/DeveloperGarden/Request/ConferenceCall/UpdateConferenceTemplateParticipantRequest.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_UpdateConferenceTemplateParticipantResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/UpdateConferenceTemplateParticipantResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_Request_ConferenceCall_AddConferenceTemplateParticipantRequest
 */
require_once 'Zend/Service/DeveloperGarden/Request/ConferenceCall/AddConferenceTemplateParticipantRequest.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_AddConferenceTemplateParticipantResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/AddConferenceTemplateParticipantResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_AddConferenceTemplateParticipantResponseType
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/AddConferenceTemplateParticipantResponseType.php';

/**
 * @see Zend_Service_DeveloperGarden_Request_ConferenceCall_CommitConferenceRequest
 */
require_once 'Zend/Service/DeveloperGarden/Request/ConferenceCall/CommitConferenceRequest.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_CommitConferenceResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/CommitConferenceResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_Request_ConferenceCall_UpdateConferenceRequest
 */
require_once 'Zend/Service/DeveloperGarden/Request/ConferenceCall/UpdateConferenceRequest.php';

/**
 * @see Zend_Service_DeveloperGarden_Response_ConferenceCall_UpdateConferenceResponse
 */
require_once 'Zend/Service/DeveloperGarden/Response/ConferenceCall/UpdateConferenceResponse.php';

/**
 * @see Zend_Service_DeveloperGarden_ConferenceCall_ConferenceDetail
 */
require_once 'Zend/Service/DeveloperGarden/ConferenceCall/ConferenceDetail.php';

/**
 * @see Zend_Service_DeveloperGarden_ConferenceCall_ConferenceSchedule
 */
require_once 'Zend/Service/DeveloperGarden/ConferenceCall/ConferenceSchedule.php';

/**
 * @see Zend_Service_DeveloperGarden_ConferenceCall_Participant
 */
require_once 'Zend/Service/DeveloperGarden/ConferenceCall/Participant.php';

/**
 * @see Zend_Service_DeveloperGarden_ConferenceCall_ParticipantDetail
 */
require_once 'Zend/Service/DeveloperGarden/ConferenceCall/ParticipantDetail.php';

/**
 * @see Zend_Service_DeveloperGarden_ConferenceCall_ParticipantStatus
 */
require_once 'Zend/Service/DeveloperGarden/ConferenceCall/ParticipantStatus.php';

/**
 * @see Zend_Service_DeveloperGarden_ConferenceCall_ConferenceAccount
 */
require_once 'Zend/Service/DeveloperGarden/ConferenceCall/ConferenceAccount.php';

/**
 * @category   Zend
 * @package    Zend_Service
 * @subpackage DeveloperGarden
 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @author     Marco Kaiser
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
class Zend_Service_DeveloperGarden_ConferenceCall
    extends Zend_Service_DeveloperGarden_Client_ClientAbstract
{
    /**
     * wsdl file
     *
     * @var string
     */
    protected $_wsdlFile = 'https://gateway.developer.telekom.com/p3gw-mod-odg-ccs/services/ccsPort?wsdl';

    /**
     * the local WSDL file
     *
     * @var string
     */
    protected $_wsdlFileLocal = 'Wsdl/ccsPort.wsdl';

    /**
     * Response, Request Classmapping
     *
     * @var array
     *
     */
    protected $_classMap = array(
        //Struct
        'ConferenceDetailStruct'  => 'Zend_Service_DeveloperGarden_ConferenceCall_ConferenceDetail',
        'ConferenceAccStruct'     => 'Zend_Service_DeveloperGarden_ConferenceCall_ConferenceAccount',
        'ScheduleStruct'          => 'Zend_Service_DeveloperGarden_ConferenceCall_ConferenceSchedule',
        'ParticipantStruct'       => 'Zend_Service_DeveloperGarden_ConferenceCall_Participant',
        'ParticipantDetailStruct' => 'Zend_Service_DeveloperGarden_ConferenceCall_ParticipantDetail',
        'ParticipantStatusStruct' => 'Zend_Service_DeveloperGarden_ConferenceCall_ParticipantStatus',

        //Responses
        'CCSResponseType' => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_CCSResponseType',

        //Conference
        'createConferenceResponse'         => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_CreateConferenceResponse',
        'createConferenceResponseType'     => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_CreateConferenceResponseType',
        'removeConferenceResponse'         => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_RemoveConferenceResponse',
        'commitConferenceResponse'         => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_CommitConferenceResponse',
        'updateConferenceResponse'         => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_UpdateConferenceResponse',
        'getConferenceStatusResponse'      => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_GetConferenceStatusResponse',
        'getConferenceStatusResponseType'  => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_GetConferenceStatusResponseType',
        'getRunningConferenceResponse'     => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_GetRunningConferenceResponse',
        'getRunningConferenceResponseType' => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_GetRunningConferenceResponseType',
        'getConferenceListResponse'        => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_GetConferenceListResponse',
        'getConferenceListResponseType'    => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_GetConferenceListResponseType',

        //Participant
        'newParticipantResponse'           => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_NewParticipantResponse',
        'newParticipantResponseType'       => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_NewParticipantResponseType',
        'removeParticipantResponse'        => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_RemoveParticipantResponse',
        'updateParticipantResponse'        => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_UpdateParticipantResponse',
        'getParticipantStatusResponse'     => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_GetParticipantStatusResponse',
        'getParticipantStatusResponseType' => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_GetParticipantStatusResponseType',

        //Templates
        'createConferenceTemplateResponse'             => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_CreateConferenceTemplateResponse',
        'createConferenceTemplateResponseType'         => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_CreateConferenceTemplateResponseType',
        'getConferenceTemplateResponse'                => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_GetConferenceTemplateResponse',
        'getConferenceTemplateResponseType'            => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_GetConferenceTemplateResponseType',
        'updateConferenceTemplateResponse'             => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_UpdateConferenceTemplateResponse',
        'removeConferenceTemplateResponse'             => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_RemoveConferenceTemplateResponse',
        'getConferenceTemplateListResponse'            => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_GetConferenceTemplateListResponse',
        'getConferenceTemplateListResponseType'        => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_GetConferenceTemplateListResponseType',
        'addConferenceTemplateParticipantResponse'     => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_AddConferenceTemplateParticipantResponse',
        'addConferenceTemplateParticipantResponseType' => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_AddConferenceTemplateParticipantResponseType',
        'getConferenceTemplateParticipantResponse'     => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_GetConferenceTemplateParticipantResponse',
        'getConferenceTemplateParticipantResponseType' => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_GetConferenceTemplateParticipantResponseType',
        'updateConferenceTemplateParticipantResponse'  => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_UpdateConferenceTemplateParticipantResponse',
        'removeConferenceTemplateParticipantResponse'  => 'Zend_Service_DeveloperGarden_Response_ConferenceCall_RemoveConferenceTemplateParticipantResponse',
    );

    /**
     * creates a new conference, ownerId should be between 3 and 39
     * chars
     *
     * @param string $ownerId
     * @param Zend_Service_DeveloperGarden_ConferenceCall_ConferenceDetail $conferenceDetails
     * @param Zend_Service_DeveloperGarden_ConferenceCall_ConferenceSchedule $conferenceSchedule
     * @param integer $account
     * @return Zend_Service_DeveloperGarden_Response_ConferenceCall_CreateConferenceResponseType
     */
    public function createConference($ownerId,
        Zend_Service_DeveloperGarden_ConferenceCall_ConferenceDetail $conferenceDetails,
        Zend_Service_DeveloperGarden_ConferenceCall_ConferenceSchedule $conferenceSchedule = null,
        $account = null
    ) {
        $request = new Zend_Service_DeveloperGarden_Request_ConferenceCall_CreateConferenceRequest(
            $this->getEnvironment(),
            $ownerId,
            $conferenceDetails,
            $conferenceSchedule,
            $account
        );

        $result = $this->getSoapClient()->createConference(array(
            'createConferenceRequest' => $request
        ));

        return $result->parse();
    }

    /**
     * commits the given conference
     *
     * @param string $conferenceId
     * @return Zend_Service_DeveloperGarden_Response_ConferenceCall_CommitConferenceResponse
     */
    public function commitConference($conferenceId)
    {
        $request = new Zend_Service_DeveloperGarden_Request_ConferenceCall_CommitConferenceRequest(
            $this->getEnvironment(),
            $conferenceId
        );

        $result = $this->getSoapClient()->commitConference(array(
            'commitConferenceRequest' => $request
        ));

        return $result->parse();
    }

    /**
     * updates a conference with the given parameter
     *
     * @param string $conferenceId
     * @param string $ownerId
     * @param Zend_Service_DeveloperGarden_ConferenceCall_ConferenceDetail $conferenceDetails
     * @param Zend_Service_DeveloperGarden_ConferenceCall_ConferenceSchedule $conferenceSchedule
     * @param string $account
     * @return Zend_Service_DeveloperGarden_Response_ConferenceCall_CCSResponseType
     */
    public function updateConference(
        $conferenceId,
        $ownerId = null,
        Zend_Service_DeveloperGarden_ConferenceCall_ConferenceDetail $conferenceDetails = null,
        Zend_Service_DeveloperGarden_ConferenceCall_ConferenceSchedule $conferenceSchedule = null,
        $account = null
    ) {
        $request = new Zend_Service_DeveloperGarden_Request_ConferenceCall_UpdateConferenceRequest(
            $this->getEnvironment(),
            $conferenceId,
            $ownerId,
            $conferenceDetails,
            $conferenceSchedule,
            $account
        );

        $result = $this->getSoapClient()->updateConference(array(
            'updateConferenceRequest' => $request
        ));

        return $result->parse();
    }

    /**
     * get conference status details
     *
     * @param string $conferenceId
     * @param integer $what
     * @return Zend_Service_DeveloperGarden_Response_ConferenceCall_GetConferenceStatusResponseType
     */
    public function getConferenceStatus($conferenceId, $what = 0)
    {
        $request = new Zend_Service_DeveloperGarden_Request_ConferenceCall_GetConferenceStatusRequest(
            $this->getEnvironment(),
            $conferenceId,
            $what
        );

        $result = $this->getSoapClient()->getConferenceStatus(array(
            'getConferenceStatusRequest' => $request
        ));

        return $result->parse();
    }

    /**
     * returns the conferenceId of the running conference instance for a planned
     * recurring conference or the current conferenceId
     *
     * @return Zend_Service_DeveloperGarden_Response_ConferenceCall_GetRunningConferenceResponseType
     */
    public function getRunningConference($conferenceId)
    {
        $request = new Zend_Service_DeveloperGarden_Request_ConferenceCall_GetRunningConferenceRequest(
            $this->getEnvironment(),
            $conferenceId
        );

        $result = $this->getSoapClient()->getRunningConference(array(
            'getRunningConferenceRequest' => $request
        ));

        return $result->parse();
    }

    /**
     * remove a conference
     *
     * @param string $conferenceId
     * @return Zend_Service_DeveloperGarden_Response_ConferenceCall_CCSResponseType
     */
    public function removeConference($conferenceId)
    {
        $request = new Zend_Service_DeveloperGarden_Request_ConferenceCall_RemoveConferenceRequest(
            $this->getEnvironment(),
            $conferenceId
        );

        $result = $this->getSoapClient()->removeConference(array(
            'removeConferenceRequest' => $request
        ));

        return $result->parse();
    }

    /**
     * returns a list of conferences
     *
     * @param integer $what
     * @param string $ownerId
     * @return Zend_Service_DeveloperGarden_Response_ConferenceCall_GetConferenceListResponseType
     */
    public function getConferenceList($what = 0, $ownerId = null)
    {
        $request = new Zend_Service_DeveloperGarden_Request_ConferenceCall_GetConferenceListRequest(
            $this->getEnvironment(),
            $what,
            $ownerId
        );

        $result = $this->getSoapClient()->getConferenceList(array(
            'getConferenceListRequest' => $request
        ));

        return $result->parse();
    }

    /**
     * adds a new participant to the given conference
     *
     * @param string $conferenceId
     * @param Zend_Service_DeveloperGarden_ConferenceCall_ParticipantDetail $participant
     * @return Zend_Service_DeveloperGarden_Response_ConferenceCall_NewParticipantResponseType
     */
    public function newParticipant(
        $conferenceId,
        Zend_Service_DeveloperGarden_ConferenceCall_ParticipantDetail $participant
    ) {
        $request = new Zend_Service_DeveloperGarden_Request_ConferenceCall_NewParticipantRequest(
            $this->getEnvironment(),
            $conferenceId,
            $participant
        );

        $result = $this->getSoapClient()->newParticipant(array(
            'newParticipantRequest' => $request
        ));

        return $result->parse();
    }

    /**
     * fetches the participant details for the given conferenceId
     *
     * @param string $conferenceId
     * @param string $participantId
     * @return Zend_Service_DeveloperGarden_Response_ConferenceCall_GetParticipantStatusResponseType
     */
    public function getParticipantStatus($conferenceId, $participantId)
    {
        $request = new Zend_Service_DeveloperGarden_Request_ConferenceCall_GetParticipantStatusRequest(
            $this->getEnvironment(),
            $conferenceId,
            $participantId
        );

        $result = $this->getSoapClient()->getParticipantStatus(array(
            'getParticipantStatusRequest' => $request
        ));

        return $result->parse();
    }

    /**
     * removes the given participant from the conference
     *
     * @param string $conferenceId
     * @param string $participantId
     * @return Zend_Service_DeveloperGarden_Response_ConferenceCall_CCSResponseType
     */
    public function removeParticipant($conferenceId, $participantId)
    {
        $request = new Zend_Service_DeveloperGarden_Request_ConferenceCall_RemoveParticipantRequest(
            $this->getEnvironment(),
            $conferenceId,
            $participantId
        );

        $result = $this->getSoapClient()->removeParticipant(array(
            'removeParticipantRequest' => $request
        ));

        return $result->parse();
    }

    /**
     * updates the participant in the given conference
     *
     * @param string $conferenceId
     * @param string $participantId
     * @param integer $action
     * @param Zend_Service_DeveloperGarden_ConferenceCall_ParticipantDetail $participant
     * @return Zend_Service_DeveloperGarden_Response_ConferenceCall_CCSResponseType
     */
    public function updateParticipant(
        $conferenceId,
        $participantId,
        $action = null,
        Zend_Service_DeveloperGarden_ConferenceCall_ParticipantDetail $participant = null
    ) {
        $request = new Zend_Service_DeveloperGarden_Request_ConferenceCall_UpdateParticipantRequest(
            $this->getEnvironment(),
            $conferenceId,
            $participantId,
            $action,
            $participant
        );

        $result = $this->getSoapClient()->updateParticipant(array(
            'updateParticipantRequest' => $request
        ));

        return $result->parse();
    }

    /**
     * creates a new conference template
     *
     * @param string $ownerId
     * @param Zend_Service_DeveloperGarden_ConferenceCall_ConferenceDetail $conferenceDetails
     * @param array $participants
     * @return Zend_Service_DeveloperGarden_Response_ConferenceCall_CreateConferenceTemplateResponseType
     */
    public function createConferenceTemplate(
        $ownerId,
        Zend_Service_DeveloperGarden_ConferenceCall_ConferenceDetail $conferenceDetails,
        array $participants = null
    ) {
        $request = new Zend_Service_DeveloperGarden_Request_ConferenceCall_CreateConferenceTemplateRequest(
            $this->getEnvironment(),
            $ownerId,
            $conferenceDetails,
            $participants
        );

        $result = $this->getSoapClient()->createConferenceTemplate(array(
            'createConferenceTemplateRequest' => $request
        ));

        return $result->parse();
    }

    /**
     * get a specific template
     *
     * @param string $templateId
     * @return Zend_Service_DeveloperGarden_Response_ConferenceCall_GetConferenceTemplateResponseType
     */
    public function getConferenceTemplate($templateId)
    {
        $request = new Zend_Service_DeveloperGarden_Request_ConferenceCall_GetConferenceTemplateRequest(
            $this->getEnvironment(),
            $templateId
        );

        $result = $this->getSoapClient()->getConferenceTemplate(array(
            'getConferenceTemplateRequest' => $request
        ));

        return $result->parse();
    }

    /**
     * updates a conference template
     *
     * @param string $templateId
     * @param string $initiatorId
     * @param Zend_Service_DeveloperGarden_ConferenceCall_ConferenceDetail $conferenceDetails
     * @return Zend_Service_DeveloperGarden_Response_ConferenceCall_CCSResponseType
     */
    public function updateConferenceTemplate(
        $templateId,
        $initiatorId = null,
        Zend_Service_DeveloperGarden_ConferenceCall_ConferenceDetail $conferenceDetails = null
    ) {
        $request = new Zend_Service_DeveloperGarden_Request_ConferenceCall_UpdateConferenceTemplateRequest(
            $this->getEnvironment(),
            $templateId,
            $initiatorId,
            $conferenceDetails
        );

        $result = $this->getSoapClient()->updateConferenceTemplate(array(
            'updateConferenceTemplateRequest' => $request
        ));

        return $result->parse();
    }

    /**
     * remove a conference template
     *
     * @param string $templateId
     * @return Zend_Service_DeveloperGarden_Response_ConferenceCall_CCSResponseType
     */
    public function removeConferenceTemplate($templateId)
    {
        $request = new Zend_Service_DeveloperGarden_Request_ConferenceCall_RemoveConferenceTemplateRequest(
            $this->getEnvironment(),
            $templateId
        );

        $result = $this->getSoapClient()->removeConferenceTemplate(array(
            'removeConferenceTemplateRequest' => $request
        ));

        return $result->parse();
    }

    /**
     * lists all available conference templates for the given owner
     *
     * @param string $ownerId
     * @return Zend_Service_DeveloperGarden_Response_ConferenceCall_GetConferenceTemplateListResponseType
     */
    public function getConferenceTemplateList($ownerId)
    {
        $request = new Zend_Service_DeveloperGarden_Request_ConferenceCall_GetConferenceTemplateListRequest(
            $this->getEnvironment(),
            $ownerId
        );

        $result = $this->getSoapClient()->getConferenceTemplateList(array(
            'getConferenceTemplateListRequest' => $request
        ));

        return $result->parse();
    }

    /**
     * adds a new participants to the template
     *
     * @param string $templateId
     * @param Zend_Service_DeveloperGarden_ConferenceCall_ParticipantDetail $participant
     * @return Zend_Service_DeveloperGarden_Response_ConferenceCall_AddConferenceTemplateParticipantResponseType
     */
    public function addConferenceTemplateParticipant(
        $templateId,
        Zend_Service_DeveloperGarden_ConferenceCall_ParticipantDetail $participant
    ) {
        $request = new Zend_Service_DeveloperGarden_Request_ConferenceCall_AddConferenceTemplateParticipantRequest(
            $this->getEnvironment(),
            $templateId,
            $participant
        );

        $result = $this->getSoapClient()->addConferenceTemplateParticipant(array(
            'addConferenceTemplateParticipantRequest' => $request
        ));

        return $result->parse();
    }

    /**
     * returns a praticipant for the given templateId
     *
     * @param string $templateId
     * @param string $participantId
     * @return Zend_Service_DeveloperGarden_Response_ConferenceCall_GetConferenceTemplateParticipantResponseType
     */
    public function getConferenceTemplateParticipant($templateId, $participantId)
    {
        $request = new Zend_Service_DeveloperGarden_Request_ConferenceCall_GetConferenceTemplateParticipantRequest(
            $this->getEnvironment(),
            $templateId,
            $participantId
        );

        $result = $this->getSoapClient()->getConferenceTemplateParticipant(array(
            'getConferenceTemplateParticipantRequest' => $request
        ));

        return $result->parse();
    }

    /**
     * updates the participants details
     *
     * @param string $templateId
     * @param string $participantId
     * @param Zend_Service_DeveloperGarden_ConferenceCall_ParticipantDetail $participant
     * @return Zend_Service_DeveloperGarden_Response_ConferenceCall_CCSResponseType
     */
    public function updateConferenceTemplateParticipant(
        $templateId,
        $participantId,
        Zend_Service_DeveloperGarden_ConferenceCall_ParticipantDetail $participant
    ) {
        $request = new Zend_Service_DeveloperGarden_Request_ConferenceCall_UpdateConferenceTemplateParticipantRequest(
            $this->getEnvironment(),
            $templateId,
            $participantId,
            $participant
        );

        $result = $this->getSoapClient()->updateConferenceTemplateParticipant(array(
            'updateConferenceTemplateParticipantRequest' => $request
        ));

        return $result->parse();
    }

    /**
     * removes a praticipant from the given templateId
     *
     * @param string $templateId
     * @param string $participantId
     * @return Zend_Service_DeveloperGarden_Response_ConferenceCall_CCSResponseType
     */
    public function removeConferenceTemplateParticipant($templateId, $participantId)
    {
        $request = new Zend_Service_DeveloperGarden_Request_ConferenceCall_RemoveConferenceTemplateParticipantRequest(
            $this->getEnvironment(),
            $templateId,
            $participantId
        );

        $result = $this->getSoapClient()->removeConferenceTemplateParticipant(array(
            'removeConferenceTemplateParticipantRequest' => $request
        ));

        return $result->parse();
    }
}