home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / SOAP / Interop / interop_Round2GroupB.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  4.1 KB  |  100 lines

  1. <?php
  2. //
  3. // +----------------------------------------------------------------------+
  4. // | PHP Version 4                                                        |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2003 The PHP Group                                |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.02 of the PHP license,      |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available at through the world-wide-web at                           |
  11. // | http://www.php.net/license/2_02.txt.                                 |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Authors: Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more   |
  17. // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author         |
  18. // +----------------------------------------------------------------------+
  19. //
  20. // $Id: interop_Round2GroupB.php,v 1.9 2007/01/22 14:53:21 yunosh Exp $
  21. //
  22. require_once 'params_classes.php';
  23.  
  24. class SOAP_Interop_GroupB {
  25.  
  26.     var $__dispatch_map = array();
  27.     
  28.     function SOAP_Interop_GroupB()
  29.     {
  30.         $this->__dispatch_map['echoStructAsSimpleTypes'] =
  31.             array('in' => array('inputStruct' => 'SOAPStruct'),
  32.                   'out' => array('outputString' => 'string', 'outputInteger' => 'int', 'outputFloat' => 'float'));
  33.         $this->__dispatch_map['echoSimpleTypesAsStruct'] =
  34.             array('in' => array('inputString' => 'string', 'inputInteger' => 'int', 'inputFloat' => 'float'),
  35.                   'out' => array('return' => 'SOAPStruct'));
  36.         $this->__dispatch_map['echoNestedStruct'] =
  37.             array('in' => array('inputStruct' => 'SOAPStructStruct'),
  38.                   'out' => array('return' => 'SOAPStructStruct'));
  39.         $this->__dispatch_map['echo2DStringArray'] =
  40.             array('in' => array('input2DStringArray' => 'ArrayOfString2D'),
  41.                   'out' => array('return' => 'ArrayOfString2D'));
  42.         $this->__dispatch_map['echoNestedArray'] =
  43.             array('in' => array('inputString' => 'SOAPArrayStruct'),
  44.                   'out' => array('return' => 'SOAPArrayStruct'));
  45.     }
  46.     
  47.     /* this private function is called on by SOAP_Server to determine any
  48.      * special dispatch information that might be necessary. This, for
  49.      * example, can be used to set up a dispatch map for functions that return
  50.      * multiple OUT parameters. */
  51.     function __dispatch($methodname)
  52.     {
  53.         if (array_key_exists($methodname,$this->__dispatch_map)) {
  54.             return $this->__dispatch_map[$methodname];
  55.         }
  56.         return null;
  57.     }
  58.     
  59.     function echoStructAsSimpleTypes ($struct)
  60.     {
  61.         // Convert a SOAPStruct to an array.
  62.         return array(
  63.             new SOAP_Value('outputString','string',$struct->varString),
  64.             new SOAP_Value('outputInteger','int',$struct->varInt),
  65.             new SOAP_Value('outputFloat','float',$struct->varFloat));
  66.     }
  67.  
  68.     function echoSimpleTypesAsStruct($string, $int, $float)
  69.     {
  70.         // Convert a input into struct.
  71.         $v = new SOAPStruct($string, $int, $float);
  72.         return new SOAP_Value('return', '{http://soapinterop.org/xsd}SOAPStruct', $v);
  73.     }
  74.  
  75.     function echoNestedStruct($struct)
  76.     {
  77.         $separator = "\n";
  78.         $methods = get_class_methods($struct);
  79.         $arr_str = $separator . strtolower(implode($separator, $methods));
  80.         $string = $separator . '__to_soap' . $separator;
  81.         if (strpos($arr_str, $string) !== false) {
  82.             return $struct->__to_soap();
  83.         }
  84.         return $struct;
  85.     }
  86.  
  87.     function echo2DStringArray($array)
  88.     {
  89.         $ret = new SOAP_Value('return', 'Array', $array);
  90.         $ret->options['flatten'] = true;
  91.         return $ret;
  92.     }
  93.  
  94.     function echoNestedArray($array)
  95.     {
  96.         return $array;
  97.     }
  98.  
  99. }
  100.