1

(1 replies, posted in Questions)

Hello I have a few questions.

1) Is it possible to include a voice recording as an attachment in an email?
2) Is it possible to include a voice recording as an attachment in a SMS?
3) When a recipient receives an SMS message will the phone number of the SMS sender always be the same?  For example when I test this the sender number is 4697342443.
4) Is there a way to convert a recording to text?  Similar to complex input *name.
5) Is there a way to include a return carriage within a SMS message?
6) Within module recording, is it possible to not record the user speaking until the text prompted to the user is complete?

Thank you

2

(7 replies, posted in Questions)

Sure will.  Thanks.

3

(7 replies, posted in Questions)

Hi I never heard back regarding this.  Please reply.

4

(7 replies, posted in Questions)

I'm sorry I meant Method 2.

5

(7 replies, posted in Questions)

Regarding deleting the table, please disregard my request.

However, do please delete the page "Clone of ..."

6

(7 replies, posted in Questions)

Within my app Method 1 I have a page named "Clone of ....".  I am trying to delete the page but it won't delete.  Also, I am trying to create a table called "NYSP" however I get an error that the table exists.  A table named that did exist once but it was deleted months ago.

Can you please delete page "Clone of ...." and also make sure the table NYSP has been removed?

Thanks

7

(3 replies, posted in Questions)

I understand.  Thank you for your help.

8

(3 replies, posted in Questions)

I’m resubmitting this post since the original had some typos.
Hi,
I have included the Elapsed property right before my exit module.  The problem is this value is always a few seconds less than the actual billed seconds.  I’m trying to include the actual billed seconds into my database.  Is there a way to do this?
Also, is there a way to specify the order the fields are listed in a database?
Thanks

9

(3 replies, posted in Questions)

Hi,
I have included the Elapsed property right before my exit module.  The problem is this value is always a few secinds less than the actual billed seo get the actual billed seconds into my apps databse?

Also, Is there a way to specify the order the fields are listed in a database?

Thanks

10

(4 replies, posted in Questions)

Hi,
I wasn't aware that there was a 1000 char maximum.  You are correct that was the issue.  Thanks for your help.

11

(4 replies, posted in Questions)

Hi,
When I get the error the hang-up exit module gets highlighted red.  Can you please test my application to see there error?  The name of the application is QF Test.  Please do the following to duplicate the error.

1)    When prompted for PIN don’t enter anything and wait for the message “I'm sorry, I did not get a response.”
2)    When prompted for PIN the second time again don’t enter anything and wait for the message “I'm sorry, I did not get a response.”
3)    When prompted for PIN the 3rd time enter the number 1 and wait for the message “Your entered an incorrect number of digits.”
4)    When prompted for PIN the 4th time enter the number 1 again and wait for the message “Your entered an incorrect number of digits.”
5)    When prompted for PIN the 5th time enter the numbers 11111 and wait for the message “You have entered an invalid PIN number.”
6)    When prompted for PIN the 6th time again enter the numbers 11111 and wait for the message “You have entered an invalid PIN number.”
7)    When prompted for PIN the 7th time once again enter the numbers 11111 and wait for the message “You have entered an invalid PIN number.”
8)    Now you will here the message “This call is being disconnected due to too many user errors.  Please see your computer monitor for further instructions.  Good bye.” And the application will reach the exit module and you will see the error.

Thanks for your help.

12

(4 replies, posted in Questions)

Hello,
After my application finishes running in the QF status bar I see a message “An error occurred while quick fuse was running your application.”  When this happens it also does not add any data to the database.  I’ve gone over the flow over and over and can not locate what the cause is.

Does QF create an error log with more details?  If not how do you suggest I debug this issue?

Thanks.

13

(2 replies, posted in Questions)

Thanks for your reply.

Your example made me realize I was looking at the flow the wrong way.  I had to move some modules around to get the result I wanted.

Thanks again

14

(2 replies, posted in Questions)

Within post call processing I have specified to insert data into table.  It seems that if a caller hangs up before reachinmg the hang up exit module the data is not entered into the table.  Is there a setting to specify enter to table incomplete calls?

thanks.

15

(4 replies, posted in Questions)

Great thanks for the help.

16

(4 replies, posted in Questions)

Thanks for your reply.  I think you misunderstood me.  I'm trying to pass multiple parameters from the SOAP module to the web service.  Not the other way around.  The QF SOAP module allows you to add multiple parameters but I can't get my web service to accept the multiple parameters.  Hope that makes sense.

17

(4 replies, posted in Questions)

Hello all,
I am new to QF and also to SOAP / WSDL.  I've installed the WSDL example provided by QF (http://quickfuseapps.com/docs/examples/ws.php?WSDL) on my server and I'm able to successfully pass and work with one parameter value.

However, when I try to pass two parameters I can't read the value of the second parameter.

Does anyone have a php sample code that does this?

Thanks.

18

(8 replies, posted in Questions)

Hi,
I wanted to let you know that this problem has been resolved.  It seems to have been a setting issue on our server. 

thanks for your help.

19

(8 replies, posted in Questions)

Hello Admin,
I just wanted to follow up since I never heard back regarding my last post.  I appreciate your help with the matter.

20

(8 replies, posted in Questions)

One more question, is there a way to test this using just a browser?  Maybe something like http://www.traffic101testserver.com/ws. … answer=yes

21

(8 replies, posted in Questions)

Hello,
Thanks for the clarification.  I have added all three files to my web server however it is still not working.  I've posted my files below.  You can also access the ws.php file from www.traffic101testserver.com/ws.php.  The Quick Fuse app is returning an internal server error when it reaches the soap module.  Thanks again for your help.

ws.php

<?php
include_once('WSDL_Gen.php');
$NAMESPACE = "http://traffic101testserver.com";
$WS_DOC_CSS = "ws_doc.css";
$DESCRIPTION = "An example of how to use WSDL_Gen.php";

/**
 * This is a web service class that implents two simple functions
 **/
class SampleWebservice extends Services_Webservice {
  /**
   *
   * @param string $answer
   * @return string
   **/
  function testMethod($answer) {
      if ($answer == 'yes'){
        return 'animallover';
      }
    return 'animalhater';
  }
}

$myService = new SampleWebservice($NAMESPACE, $DESCRIPTION, array('uri'=>$NAMESPACE, 'encoding'=>SOAP_ENCODED));
$myService->handle();

?>

WSDL_Gen.php

<?php

ini_set('error_reporting',E_ALL);
ini_set('error_log','/var/www/error.log');

/* vim: set expandtab tabstop=4 shiftwidth=4: */

/**
 * Easy Web Service (SOAP) creation
 *
 * PHP 5
 *
 * LICENSE: This source file is subject to version 3.0 of the PHP license
 * that is available through the world-wide-web at the following URI:
 * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
 * the PHP License and are unable to obtain it through the web, please
 * send a note to license@○○●○○ so we can mail you a copy immediately.
 *
 * @category   Services
 * @package    Webservice
 * @author     Manfred Weber <weber@○●●○●>
 * @copyright  2005 The PHP Group
 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
 * @version    CVS: $Id: WSDL_Gen.php,v 1.2 2008/10/03 16:59:45 ted Exp $
 * @link       http://dschini.org/Services/
 */

// {{{ abstract class Services_WebService

/**
 * PEAR::Services_Webservice
 *
 * The PEAR::Services_WebService class creates web services from your classes
 *
 * @author  Manfred Weber <weber@○●●○●>
 * @package Webservices
 * @version
 */
abstract class Services_Webservice
{
    /**
     * Namespace of the webservice
     *
     * @var    string
     * @access public
     */
    public $namespace;

    /**
     * Description of the webservice
     *
     * @var    string
     * @access public
     */
    public $description;

    /**
     * Protocol of the webservice
     *
     * @var    string
     * @access public
     */
    public $protocol;


    /**
     * SOAP-server options of the webservice
     *
     * @var    array
     * @access public
     */
    public $soapServerOptions = array();

    /**
     * SOAP schema related URIs
     *
     * @access private
     */
    const SOAP_XML_SCHEMA_VERSION  = 'http://www.w3.org/2001/XMLSchema';
    const SOAP_XML_SCHEMA_INSTANCE = 'http://www.w3.org/2001/XMLSchema-instance';
    const SOAP_SCHEMA_ENCODING   = 'http://schemas.xmlsoap.org/soap/encoding/';
    const SOAP_XML_SCHEMA_MIME   = 'http://schemas.xmlsoap.org/wsdl/mime/';
    const SOAP_ENVELOP           = 'http://schemas.xmlsoap.org/soap/envelope/';
    const SCHEMA_SOAP_HTTP       = 'http://schemas.xmlsoap.org/soap/http';
    const SCHEMA_SOAP            = 'http://schemas.xmlsoap.org/wsdl/soap/';
    const SCHEMA_WSDL            = 'http://schemas.xmlsoap.org/wsdl/';
    const SCHEMA_WSDL_HTTP       = 'http://schemas.xmlsoap.org/wsdl/http/';
    const SCHEMA_DISCO           = 'http://schemas.xmlsoap.org/disco/';
    const SCHEMA_DISCO_SCL       = 'http://schemas.xmlsoap.org/disco/scl/';
    const SCHEMA_DISCO_SOAP      = 'http://schemas.xmlsoap.org/disco/soap/';

    /**
     * Simple WSDL types
     *
     * @var    array
     * @access private
     */
    private $simpleTypes = array(
        'string', 'int', 'float', 'bool', 'double', 'integer', 'boolean',
        'varstring', 'varint', 'varfloat', 'varbool', 'vardouble',
        'varinteger', 'varboolean');

    /**
     * classes are parsed into struct
     *
     * @var    array
     * @access private
     */
    private $wsdlStruct;

    /**
     * disco dom root node
     * the disco dom object
     *
     * @var    object
     * @access private
     */
    private $disco;

    /**
     * wsdl dom root node
     * the wsdl dom object
     *
     * @var    object
     * @access private
     */
    private $wsdl;

    /**
     * wsdl-definitions dom node
     *
     * @var    object
     * @access private
     */
    private $wsdl_definitions;

    /**
     * Name of the class from which to create a webservice from
     *
     * @var    string
     * @access private
     */
    private $classname;

    /**
     * exclude these methods from webservice
     *
     * @var    array
     * @access private
     */
    private $preventMethods;

    /**
     * error namespace
     *
     * @var    bool
     * @access private
     */
    private $warningNamespace;

    /**
     * error description
     *
     * @var    bool
     * @access private
     */
    private $errorDescription;

    /**
     * constructor
     *
     * @var    string
     * @var    string
     * @var    array
     * @access public
     */
    public function __construct($namespace, $description, $options)
    {
        if (isset($namespace) && $namespace != '') {
            $this->warningNamespace   = false;
            $this->errorDescription = false;
            //$namespace .= (substr($namespace, -1) == '/') ? '' : '/';
        } else {
            $this->warningNamespace   = true;
            $this->errorDescription = true;
            $namespace = 'http://traffic101testserver.com/';
        }
        $this->namespace   = $namespace;
        $this->description = ($description != '') ? $description : 'my example service description';
        $this->soapServerOptions = (isset($options) && count($options) > 0) ? $options : array(
            'uri' => $this->namespace,
            'encoding' => SOAP_ENCODED);
        $this->wsdlStruct = array();
        $this->preventMethods = array(
            '__construct',
            '__destruct',
            'handle');
        $this->protocol = 'http';
    }

    // }}}
    // {{{ handle()
    /**
     * handle
     *
     * @access public
     */
    public function handle()
    {
        switch (strtolower($_SERVER['QUERY_STRING'])){
            case 'wsdl':
                $this->intoStruct();
                $this->handleWSDL();
                break;
            case 'disco':
                $this->intoStruct();
                $this->handleDISCO();
                break;
            default:
                $this->intoStruct();
                if (isset($_SERVER['HTTP_SOAPACTION'])) {
                    $this->createServer();
                } else {
                    $this->handleINFO();
                }
                break;
        }
    }

    // }}}
    // {{{ createServer()
    /**
     * create the soap-server
     *
     * @access private
     */
    private function createServer()
    {
        $server = new SoapServer(null, $this->soapServerOptions);
        $server->SetClass($this->classname);
        $server->handle();
    }

    // }}}
    // {{{ handleWSDL()
    /**
     * handle wsdl
     *
     * @access private
     */
    private function handleWSDL()
    {
        header('Content-Type: text/xml');
        $this->wsdl = new DOMDocument('1.0' ,'utf-8');
        $this->createWSDL_definitions();
        $this->createWSDL_types();
        $this->createWSDL_messages();
        $this->createWSDL_portType();
        $this->createWSDL_binding();
        $this->createWSDL_service();
        echo $this->wsdl->saveXML();
    }

    // }}}
    // {{{ createDISCO()
    /**
     * handle disco
     *
     * @access private
     */
    private function handleDISCO()
    {
        header('Content-Type: text/xml');
        $this->disco = new DOMDocument('1.0' ,'utf-8');
        $disco_discovery = $this->disco->createElement('discovery');
        $disco_discovery->setAttribute('xmlns:xsi', self::SOAP_XML_SCHEMA_INSTANCE);
        $disco_discovery->setAttribute('xmlns:xsd', self::SOAP_XML_SCHEMA_VERSION);
        $disco_discovery->setAttribute('xmlns', self::SCHEMA_DISCO );
        $disco_contractref = $this->disco->createElement('contractRef');
        $urlBase = $this->protocol . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
        $disco_contractref->setAttribute('ref', $urlBase . '?wsdl');
        $disco_contractref->setAttribute('docRef', $urlBase);
        $disco_contractref->setAttribute('xmlns', self::SCHEMA_DISCO_SCL);
        $disco_soap = $this->disco->createElement('soap');
        $disco_soap->setAttribute('address', $urlBase);
        $disco_soap->setAttribute('xmlns:q1', $this->namespace);
        $disco_soap->setAttribute('binding', 'q1:' . $this->classname);
        $disco_soap->setAttribute('xmlns', self::SCHEMA_DISCO_SCL);
        $disco_contractref->appendChild($disco_soap);
        $disco_discovery->appendChild($disco_contractref);
        $this->disco->appendChild($disco_discovery);
        echo $this->disco->saveXML();
    }

    // }}}
    // {{{ handleINFO()
    /**
     * handle info-site
     *
     * @access private
     */
    private function handleINFO()
    {
        global $WS_DOC_CSS;
        header('Content-Type: text/html');

        echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>' . $this->classname . ' WebService</title>
<meta name="generator" content="PEAR::Services_Webservice" />
<style type="text/css">'
. file_get_contents($WS_DOC_CSS) .
'</style>
</head>
<body>
<div id="header">
<h1>' . $this->classname . '</h1>
<p>' . htmlspecialchars($this->description) . '</p>
</div>
<p>The following operations are supported. For a formal definition, please review the <a href="' . htmlentities($_SERVER['PHP_SELF']) . '?WSDL">Web Services Description Language</a>.</p>
<ul>';

        foreach ($this->wsdlStruct[$this->classname]['method'] as $methodName => $method) {
            $paramValue = array();
            foreach ($method['var'] AS $methodVars) {
                if (isset($methodVars['param'])) {
                    $paramValue[] = "<var class=\"parameter\">" . $methodVars['type']
                                     . str_repeat('[]', $methodVars['length']) . "</var> " . $methodVars['name'];
                }
            }
            $returnValue = array();
            foreach ($method['var'] AS $methodVars) {
                if (isset($methodVars['return'])) {
                    $returnValue[] = $methodVars['type']
                                     . str_repeat('[]', $methodVars['length']);
                }
            }
            echo sprintf('<li><samp><var class="returnedValue">%s</var> <b class="functionName">%s</b>( %s )</samp>%s</li>'
                    , implode(',', $returnValue)
                    , $methodName
                    , implode(', ', $paramValue)
                    , ((empty($method['description'])) ? '' : ('<br /><span class="description">' . htmlspecialchars($method['description']) . '</span>')));
        }
/*
        echo '</ul>
<p><a href="' . htmlentities($_SERVER['PHP_SELF']) . '?DISCO">DISCO</a> makes it possible for clients to reflect against endpoints to discover services and their associated <acronym title="Web Service Description Language">WSDL</acronym> documents.</p>';
*/
        if ($this->warningNamespace == true
            || $this->namespace == 'http://traffic101testserver.com') {
            echo '
<p class="warning"><strong>This web service is using http://example.org/ as its default namespace.<br />
Recommendation: Change the default namespace before the <acronym title="eXtensible Markup Language">XML</acronym> Web service is made public.</strong></p>

<p>Each XML Web service needs a unique namespace in order for client applications to distinguish it from other services on the Web. http://example.org/ is available for XML Web services that are under development, but published XML Web services should use a more permanent namespace.<br />
Your XML Web service should be identified by a namespace that you control. For example, you can use your company`s Internet domain name as part of the namespace. Although many XML Web service namespaces look like <acronym title="Uniform Resource Locators">URLs</acronym>, they need not point to actual resources on the Web. (XML Web service namespaces are <acronym title="Uniform Resouce Identifiers">URIs</acronym>.)</p>

<p>For more details on XML namespaces, see the <acronym title="World Wide Web Consortium">W3C</acronym> recommendation on <a href="http://www.w3.org/TR/REC-xml-names/">Namespaces in XML</a>.<br />
For more details on <acronym title="Web Service Description Language">WSDL</acronym>, see the <a href="http://www.w3.org/TR/wsdl">WSDL Specification</a>.<br />
For more details on URIs, see <a href="http://www.ietf.org/rfc/rfc2396.txt"><acronym title="Request For Comment">RFC</acronym> 2396</a>.</p>
<p><small>Powered by PEAR <a href="http://pear.php.net/">http://pear.php.net</a></small></p>
</body>
</html>';

        }
    }

    // }}}
    // {{{ intoStruct()
    /**
     * parse classes into struct
     *
     * @access private
     */
    protected function intoStruct()
    {
        $class = new ReflectionObject($this);
        $this->classname = $class->getName();
        $this->classMethodsIntoStruct();
        $this->classStructDispatch();
    }

    // }}}
    // {{{ classStructDispatch()
    /**
     * dispatch types
     *
     * @access private
     */
    protected function classStructDispatch()
    {
        foreach ($this->wsdlStruct[$this->classname]['method'] as $method) {
            foreach ($method['var'] as $var){
                if (($var['class'] == 1 && $var['length'] == 0)
                    || ($var['class'] == 1 && $var['length'] > 0)) {
                    $this->classPropertiesIntoStruct($var['type']);
                }
                if (($var['array'] == 1 && $var['length'] > 0)
                    || ($var['class'] == 1 && $var['length'] > 0)) {
                    $_typensSource = '';
                    for ($i = $var['length']; $i > 0; --$i) {
                        $_typensSource .= 'ArrayOf';
                        $this->wsdlStruct['array'][$_typensSource . $var['type']] = substr($_typensSource, 0, strlen($_typensSource) - 7) . $var['type'];
                    }
                }
            }
        }
    }

    // }}}
    // {{{ classPropertiesIntoStruct()
    /**
     * parse classes properties into struct
     *
     * @var    string
     * @access private
     */
    protected function classPropertiesIntoStruct($className)
    {
        if (!isset($this->wsdlStruct[$className])) {
            $class = new ReflectionClass($className);
            $properties = $class->getProperties();
            $this->wsdlStruct['class'][$className]['property'] = array();
            for ($i = 0; $i < count($properties); ++$i) {
                if ($properties[$i]->isPublic()) {
                    preg_match_all('~@var\s(\S+)~', $properties[$i]->getDocComment(), $var);

                    $_cleanType = str_replace('[]', '', $var[1][0], $_length);
                    $_typens    = str_repeat('ArrayOf', $_length);

                    $this->wsdlStruct['class'][$className]['property'][$properties[$i]->getName()]['type'] =
                            $_cleanType;
                    $this->wsdlStruct['class'][$className]['property'][$properties[$i]->getName()]['wsdltype'] =
                            $_typens.$_cleanType;
                    $this->wsdlStruct['class'][$className]['property'][$properties[$i]->getName()]['length'] =
                            $_length;
                    $this->wsdlStruct['class'][$className]['property'][$properties[$i]->getName()]['array'] =
                            ($_length > 0 && in_array($_cleanType, $this->simpleTypes))
                            ? true : false;
                    $isObject = (!in_array($_cleanType, $this->simpleTypes) && new ReflectionClass($_cleanType))
                            ? true : false;
                    $this->wsdlStruct['class'][$className]['property'][$properties[$i]->getName()]['class'] =
                            $isObject;
                    if ($isObject == true) {
                        $this->classPropertiesIntoStruct($_cleanType);
                    }
                    if ($_length > 0) {
                        $_typensSource = '';
                        for ($j = $_length; $j > 0;  --$j) {
                            $_typensSource .= 'ArrayOf';
                            $this->wsdlStruct['array'][$_typensSource.$_cleanType] =
                                    substr($_typensSource, 0, strlen($_typensSource) - 7) . $_cleanType;
                        }
                    }
                }
            }
        }
    }

    // }}}
    // {{{ classMethodsIntoStruct()
    /**
     * parse classes methods into struct
     *
     * @access private
     */
    protected function classMethodsIntoStruct()
    {
        $class = new ReflectionClass($this->classname);
        $methods = $class->getMethods();
        // params
        foreach ($methods AS $method) {
            if ($method->isPublic()
                && !in_array($method->getName(), $this->preventMethods)) {
                $docComments = $method->getDocComment();
                $_docComments_Description = trim(str_replace('/**', '', substr($docComments, 0, strpos($docComments, '@'))));
                $docComments_Description = preg_replace('/(\\s+|^)\\*\\s*|\\s*\\*(\\s+|$)/', ' ', $_docComments_Description);
                $this->wsdlStruct[$this->classname]['method'][$method->getName()]['description'] = $docComments_Description;
                preg_match_all('~@param\s(\S+)~', $docComments, $param);
                preg_match_all('~@return\s(\S+)~', $method->getDocComment(), $return);
                $params = $method->getParameters();
                for ($i = 0; $i < count($params); ++$i) {
                    $_class = $params[$i]->getClass();
                    $_type  = ($_class) ? $_class->getName() : $param[1][$i];

                    $_cleanType = str_replace('[]', '', $_type, $_length);
                    $_typens    = str_repeat('ArrayOf', $_length);

                    $this->wsdlStruct[$this->classname]['method'][$method->getName()]['var'][$i]['name'] =
                            $params[$i]->getName();
                    $this->wsdlStruct[$this->classname]['method'][$method->getName()]['var'][$i]['wsdltype'] =
                            $_typens . $_cleanType;
                    $this->wsdlStruct[$this->classname]['method'][$method->getName()]['var'][$i]['type'] =
                            $_cleanType;
                    $this->wsdlStruct[$this->classname]['method'][$method->getName()]['var'][$i]['length'] =
                            $_length;
                    $this->wsdlStruct[$this->classname]['method'][$method->getName()]['var'][$i]['array'] =
                            ($_length > 0 && in_array($_cleanType, $this->simpleTypes))
                            ? true : false;
                    $this->wsdlStruct[$this->classname]['method'][$method->getName()]['var'][$i]['class'] =
                            (!in_array($_cleanType, $this->simpleTypes) && new ReflectionClass($_cleanType))
                            ? true : false;
                    $this->wsdlStruct[$this->classname]['method'][$method->getName()]['var'][$i]['param'] = true;
                }
                // return
                if (isset($return[1][0])) {
                    $_cleanType = str_replace('[]', '', $return[1][0], $_length);
                } else {
                    $_cleanType = 'void';
                    $_length = 0;
                }
                $_typens = str_repeat('ArrayOf', $_length);

                $this->wsdlStruct[$this->classname]['method'][$method->getName()]['var'][$i]['wsdltype'] =
                        $_typens.$_cleanType;
                $this->wsdlStruct[$this->classname]['method'][$method->getName()]['var'][$i]['type'] = $_cleanType;
                $this->wsdlStruct[$this->classname]['method'][$method->getName()]['var'][$i]['length'] = $_length;
                $this->wsdlStruct[$this->classname]['method'][$method->getName()]['var'][$i]['array'] =
                        ($_length > 0 && $_cleanType != 'void' && in_array($_cleanType, $this->simpleTypes)) ? true : false;
                $this->wsdlStruct[$this->classname]['method'][$method->getName()]['var'][$i]['class'] =
                        ($_cleanType != 'void' && !in_array($_cleanType, $this->simpleTypes) && new ReflectionClass($_cleanType))
                        ? true : false;
                $this->wsdlStruct[$this->classname]['method'][$method->getName()]['var'][$i]['return'] = true;
            }
        }
    }

    // }}}
    // {{{ createWSDL_definitions()
    /**
     * Create the definition node
     *
     * @return void
     */
    protected function createWSDL_definitions()
    {
      /*
      <definitions name="myService"
          targetNamespace="urn:myService"
          xmlns:typens="urn:myService"
          xmlns:xsd="http://www.w3.org/2001/XMLSchema"
          xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
          xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
          xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
          xmlns="http://schemas.xmlsoap.org/wsdl/">
      */
      
        $this->wsdl_definitions = $this->wsdl->createElement('definitions');
        $this->wsdl_definitions->setAttribute('name', $this->classname);
        $this->wsdl_definitions->setAttribute('targetNamespace', 'urn:'.$this->classname);
        $this->wsdl_definitions->setAttribute('xmlns:typens', 'urn:'.$this->classname);
        $this->wsdl_definitions->setAttribute('xmlns:xsd', self::SOAP_XML_SCHEMA_VERSION);
        $this->wsdl_definitions->setAttribute('xmlns:soap', self::SCHEMA_SOAP);
        $this->wsdl_definitions->setAttribute('xmlns:soapenc', self::SOAP_SCHEMA_ENCODING);
        $this->wsdl_definitions->setAttribute('xmlns:wsdl', self::SCHEMA_WSDL);
        $this->wsdl_definitions->setAttribute('xmlns', self::SCHEMA_WSDL);
       
        //$this->wsdl_definitions->setAttribute('xmlns:mime', self::SOAP_XML_SCHEMA_MIME);
        //$this->wsdl_definitions->setAttribute('xmlns:tns', $this->namespace);
        //$this->wsdl_definitions->setAttribute('xmlns:http', self::SCHEMA_WSDL_HTTP);
       
        $this->wsdl->appendChild($this->wsdl_definitions);
    }

    // }}}
    // {{{ createWSDL_types()
    /**
     * Create the types node
     *
     * @return void
     */
    protected function createWSDL_types()
    {
       /*
      <types>
           <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:myService"/>
        </types>
       */
        $types  = $this->wsdl->createElement('types');
        $schema = $this->wsdl->createElement('xsd:schema');
        $schema->setAttribute('xmlns', self::SOAP_XML_SCHEMA_VERSION );
        $schema->setAttribute('targetNamespace', 'urn:'.$this->classname);
        $types->appendChild($schema);

        // array
        /*
        <xsd:complexType name="ArrayOfclassC">
            <xsd:complexContent>
                <xsd:restriction base="soapenc:Array">
                    <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="typens:classC[]"/>
                </xsd:restriction>
            </xsd:complexContent>
        </xsd:complexType>
        */
        if (isset($this->wsdlStruct['array'])) {

           foreach ($this->wsdlStruct['array'] as $source => $target) {
              
              //<s:complexType name="ArrayOfArrayOfInt">
            //<s:sequence>
            //<s:element minOccurs="0" maxOccurs="unbounded" name="ArrayOfInt" nillable="true" type="tns:ArrayOfInt"/>
            //</s:sequence>
              
               $complexType    = $this->wsdl->createElement('xsd:complexType');
               $complexContent = $this->wsdl->createElement('xsd:complexContent');
               $restriction    = $this->wsdl->createElement('xsd:restriction');
               $attribute       = $this->wsdl->createElement('xsd:attribute');
               $restriction->appendChild($attribute);
               $complexContent->appendChild($restriction);
               $complexType->appendChild($complexContent);
               $schema->appendChild($complexType);
              
               $complexType->setAttribute('name', $source);
               $restriction->setAttribute('base', 'soapenc:Array');
               $attribute->setAttribute('ref', 'soapenc:arrayType');

               try {
                  $class = new ReflectionClass($target);
               }catch (Exception $e){}
              
               if(in_array($target, $this->simpleTypes)){
                  $attribute->setAttribute('wsdl:arrayType', 'xsd:'.$target.'[]');
               }elseif(isset($class)){
                  $attribute->setAttribute('wsdl:arrayType', 'typens:'.$target.'[]');
               }else{
                  $attribute->setAttribute('wsdl:arrayType', 'typens:'.$target.'[]');
               }
               unset($class);
              
           }
        }
       
        // class
        /*
        <xsd:complexType name="classB">
            <xsd:all>
                <xsd:element name="classCArray" type="typens:ArrayOfclassC" />
            </xsd:all>
        </xsd:complexType>
        */
        if (isset($this->wsdlStruct['class'])) {
            foreach ($this->wsdlStruct['class'] as $className=>$classProperty) {
                $complextype = $this->wsdl->createElement('xsd:complexType');
                $complextype->setAttribute('name', $className);
                $sequence = $this->wsdl->createElement('xsd:all');
                $complextype->appendChild($sequence);
                $schema->appendChild($complextype);
                foreach ($classProperty['property'] as $classPropertyName => $classPropertyValue) {
                    $element = $this->wsdl->createElement('xsd:element');
                    $element->setAttribute('name', $classPropertyName);
                    $element->setAttribute('type', ((in_array($classPropertyValue['wsdltype'], $this->simpleTypes))
                                                  ? 'xsd:'
                                                  : 'typens:') . $classPropertyValue['wsdltype']);
                    $sequence->appendChild($element);
                }
            }
        }

        $this->wsdl_definitions->appendChild($types);
    }

    // }}}
    // {{{ createWSDL_messages()
    /**
     * Create the messages node
     *
     * @return void
     */
    protected function createWSDL_messages()
    {
       /*
       <message name="hello">
           <part name="i" type="xsd:int"/>
           <part name="j" type="xsd:string"/>
       </message>
       <message name="helloResponse">
           <part name="helloResponse" type="xsd:string"/>
       </message>
       */
        foreach ($this->wsdlStruct[$this->classname]['method'] AS $methodName => $method){
            $messageInput = $this->wsdl->createElement('message');
            $messageInput->setAttribute('name', $methodName);
            $messageOutput = $this->wsdl->createElement('message');
            $messageOutput->setAttribute('name', $methodName . 'Response');
            $this->wsdl_definitions->appendChild($messageInput);
            $this->wsdl_definitions->appendChild($messageOutput);

            foreach ($method['var'] as $methodVars) {               
                if (isset($methodVars['param'])) {
                    $part = $this->wsdl->createElement('part');
                    $part->setAttribute('name', $methodVars['name']);
                    $part->setAttribute('type', (($methodVars['array'] != 1 && $methodVars['class'] != 1)
                        ? 'xsd:' : 'typens:') . $methodVars['wsdltype']);
                  $messageInput->appendChild($part);
                }
                if (isset($methodVars['return'])) {
                    $part = $this->wsdl->createElement('part');
                    $part->setAttribute('name', $methodName.'Response'); //$methodVars['wsdltype']);
                    $part->setAttribute('type', (($methodVars['array'] != 1 && $methodVars['class'] != 1)
                        ? 'xsd:' : 'typens:') . $methodVars['wsdltype']);
                  $messageOutput->appendChild($part);
                }
            }
        }
    }

   // }}}
    // {{{ createWSDL_binding()
    /**
     * Create the binding node
     *
     * @return void
     */
    protected function createWSDL_binding()
    {
       /*
       <binding name="myServiceBinding" type="typens:myServicePort">   
           <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
               <operation name="hello">
                   <soap:operation soapAction="urn:myServiceAction"/>
               <input>
                   <soap:body use="encoded" namespace="urn:myService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
                   </input>
                   <output>
                       <soap:body use="encoded" namespace="urn:myService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
                   </output>
           </operation>
       </binding>
       */
      $binding = $this->wsdl->createElement('binding');
        $binding->setAttribute('name', $this->classname . 'Binding');
        $binding->setAttribute('type', 'typens:' . $this->classname . 'Port');
        $soap_binding = $this->wsdl->createElement('soap:binding');
        $soap_binding->setAttribute('style', 'rpc');
        $soap_binding->setAttribute('transport', self::SCHEMA_SOAP_HTTP);
        $binding->appendChild($soap_binding);
        foreach ($this->wsdlStruct[$this->classname]['method'] AS $methodName => $methodVars) {
            $operation = $this->wsdl->createElement('operation');
            $operation->setAttribute('name', $methodName);
            $binding->appendChild($operation);
            $soap_operation = $this->wsdl->createElement('soap:operation');
            $soap_operation->setAttribute('soapAction', 'urn:'.$this->classname.'Action');
            $operation->appendChild($soap_operation);           
            $input  = $this->wsdl->createElement('input');
            $output = $this->wsdl->createElement('output');
            $operation->appendChild($input);
            $operation->appendChild($output);
            $soap_body = $this->wsdl->createElement('soap:body');
            $soap_body->setAttribute('use', 'encoded');
            $soap_body->setAttribute('namespace', 'urn:'.$this->namespace);
            $soap_body->setAttribute('encodingStyle', self::SOAP_SCHEMA_ENCODING );
            $input->appendChild($soap_body);
            $soap_body = $this->wsdl->createElement('soap:body');
            $soap_body->setAttribute('use', 'encoded');
            $soap_body->setAttribute('namespace', 'urn:'.$this->namespace);
            $soap_body->setAttribute('encodingStyle', self::SOAP_SCHEMA_ENCODING );
            $output->appendChild($soap_body);
        }
        $this->wsdl_definitions->appendChild($binding);
    }

    // }}}
    // {{{ createWSDL_portType()
    /**
     * Create the portType node
     *
     * @return void
     */
    protected function createWSDL_portType()
    {
       /*
       <portType name="myServicePort">
           <operation name="hello">
               <input message="typens:hello"/>
               <output message="typens:helloResponse"/>
           </operation>
       </portType>
       */
        $portType = $this->wsdl->createElement('portType');
        $portType->setAttribute('name', $this->classname.'Port');
        foreach ($this->wsdlStruct[$this->classname]['method'] AS $methodName => $methodVars) {
            $operation = $this->wsdl->createElement('operation');
            $operation->setAttribute('name', $methodName);
            $portType->appendChild($operation);

            $documentation = $this->wsdl->createElement('documentation');
            $documentation->appendChild($this->wsdl->createTextNode($methodVars['description']));
            $operation->appendChild($documentation);

            $input  = $this->wsdl->createElement('input');
            $output = $this->wsdl->createElement('output');
            $input->setAttribute('message', 'typens:' . $methodName );
            $output->setAttribute('message', 'typens:' . $methodName . 'Response');
            $operation->appendChild($input);
            $operation->appendChild($output);
        }
        $this->wsdl_definitions->appendChild($portType);

    }

    // }}}
    // {{{ createWSDL_service()
    /**
     * Create the service node
     *
     * @return void
     */
    protected function createWSDL_service()
    {
       /*
       <service name="myService">
           <port name="myServicePort" binding="typens:myServiceBinding">
               <soap:address location="http://dschini.org/test1.php"/>
           </port>
       </service>
        */
        $service = $this->wsdl->createElement('service');
        $service->setAttribute('name', $this->classname);
        $port = $this->wsdl->createElement('port');
        $port->setAttribute('name', $this->classname . 'Port');
        $port->setAttribute('binding', 'typens:' . $this->classname . 'Binding');
        $adress = $this->wsdl->createElement('soap:address');
        $adress->setAttribute('location', $this->protocol . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
        $port->appendChild($adress);
        $service->appendChild($port);
        $this->wsdl_definitions->appendChild($service);
    }
}

?>

ws_doc.css

body {
    margin: 0px;
    padding: 10px;
    font-family: sans-serif;
}
#header {
    background-color: #8A76B0;
    color: #FEE2FE;
    padding: 5px 10px;
    margin: -10px;
}
h1 {
    font-size: xx-large;
    color: #FEE2FE;
}
#header p {
    font-size: large;
}

dt {
    margin-top: 1em;
}

.description {
    padding-left: 1.5em;
    margin-bottom: 1.5em;
}

a:link {
    color: #006600;
}

a:visited {
    color: #030;
}

a:hover {
    color: #003300;
}

22

(8 replies, posted in Questions)

Hello,
Thank you for your reply.  I'm trying to get your sample code to work but I think I'm missing an XML and CSS file.  Here's what I've done. 

I’ve created a file named sample-webservice.php and placed the contents of your sample code in it.  I changed the value of $NAMESPACE to my domain.  There is reference to ws_doc.css file.  Do I need this file?

Next, I created a file named WSDL_Gen.php and placed the contents of your sample code in it.  Since your example code was missing the closing ?> for php, I added it to the end.  Changed the value of $namespace to my domain.  Changed "if ($this->warningNamespace == true || $this->namespace == 'http://example.org/') {" to my domain.

Now I see how sample-webservice.php includes WSDL_Gen.php but I don’t understand how ws.php (http://quickfuseapps.com/docs/examples/ws.php?WSDL)connects into all of this.  I believe I need the source for ws.php.

Thanks again for your help.

23

(8 replies, posted in Questions)

Hello All,
Does anyone have an example app that uses the SOAP module?  If you do. can you pleasse email me all of the xml, php, etc. files?

I'm trying to learn how this works and could really use an actual working example to pick at.

Thanks for your help,
Armen