SOAP_Interop
[ class tree: SOAP_Interop ] [ index: SOAP_Interop ] [ all elements ]

Source for file params_classes.php

Documentation is available at params_classes.php

  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>                           |
  17. // +----------------------------------------------------------------------+
  18. //
  19. // $Id: params_classes.php,v 1.8 2007/01/21 16:15:00 yunosh Exp $
  20. //
  21. require_once 'SOAP/Value.php';
  22.  
  23. class SOAPStruct {
  24.     var $varString;
  25.     var $varInt;
  26.     var $varFloat;
  27.     function SOAPStruct($s=NULL$i=NULL$f=NULL{
  28.         $this->varString $s;
  29.         $this->varInt $i;
  30.         $this->varFloat $f;
  31.     }
  32.     
  33.     function __to_soap($name 'inputStruct'$header=false$mustUnderstand=0$actor='http://schemas.xmlsoap.org/soap/actor/next')
  34.     {
  35.         $inner[= new SOAP_Value('varString','string',$this->varString);
  36.         $inner[= new SOAP_Value('varInt','int',$this->varInt);
  37.         $inner[= new SOAP_Value('varFloat','float',$this->varFloat);
  38.         if ($header{
  39.             return new SOAP_Header($name,'{http://soapinterop.org/xsd}SOAPStruct',$inner,$mustUnderstand,$actor);
  40.         }
  41.         return new SOAP_Value($name,'{http://soapinterop.org/xsd}SOAPStruct',$inner);
  42.         
  43.     }
  44. }
  45.  
  46. class SOAPStructStruct {
  47.     var $varString;
  48.     var $varInt;
  49.     var $varFloat;
  50.     var $varStruct;
  51.     function SOAPStructStruct($s=NULL$i=NULL$f=NULL$ss=NULL{
  52.         // XXX unfortunately, a copy of $ss will occure here
  53.         // ze2 can fix this I think
  54.         $this->varString $s;
  55.         $this->varInt $i;
  56.         $this->varFloat $f;
  57.         $this->varStruct $ss;
  58.     }
  59.     
  60.     function __to_soap($name 'inputStruct')
  61.     {
  62.         $v[= new SOAP_Value('varString','string',$this->varString);
  63.         $v[= new SOAP_Value('varInt','int',$this->varInt);
  64.         $v[= new SOAP_Value('varFloat','float',$this->varFloat);
  65.         $v[$this->varStruct->__to_soap('varStruct');
  66.         return new SOAP_Value($name,'{http://soapinterop.org/xsd}SOAPStructStruct',$v);
  67.     }    
  68. }
  69.  
  70. class SOAPArrayStruct {
  71.     var $varString;
  72.     var $varInt;
  73.     var $varFloat;
  74.     var $varArray;
  75.     function SOAPArrayStruct($s=NULL$i=NULL$f=NULL$ss=NULL{
  76.         // XXX unfortunately, a copy of $ss will occure here
  77.         // ze2 can fix this I think
  78.         $this->varString $s;
  79.         $this->varInt $i;
  80.         $this->varFloat $f;
  81.         $this->varArray $ss;
  82.     }
  83.     
  84.     function __to_soap($name 'inputStruct')
  85.     {
  86.         $ar = array();
  87.         $c count($this->varArray);
  88.         for ($i=0; $i<$c$i++{
  89.             $ar[= new SOAP_Value('item','string',$this->varArray[$i]);
  90.         }
  91.         $v[= new SOAP_Value('varString','string',$this->varString);
  92.         $v[= new SOAP_Value('varInt','int',$this->varInt);
  93.         $v[= new SOAP_Value('varFloat','float',$this->varFloat);
  94.         $v[= new SOAP_Value('varArray',false,$ar);
  95.         
  96.         return new SOAP_Value($name,'{http://soapinterop.org/xsd}SOAPArrayStruct',$v);
  97.     }    
  98. }
  99.  
  100. class Person {
  101.     var $Age;
  102.     var $ID;
  103.     var $Name;
  104.     var $Male;
  105.     function Person($a=NULL$i=NULL$n=NULL$m=NULL{
  106.         $this->Age $a;
  107.         $this->ID $i;
  108.         $this->Name $n;
  109.         $this->Male $m;
  110.     }
  111.  
  112.     function __set_attribute($key$value)
  113.     {
  114.         $this->$key $value;
  115.     }
  116.     
  117.     function __to_soap($name 'x_Person',$ns 'http://soapinterop.org/xsd'$compound2=false)
  118.     {
  119.         if (!$compound2{
  120.             $v[= new SOAP_Value("\{$ns}Age",'double',$this->Age);
  121.             $v[= new SOAP_Value("\{$ns}ID",'float',$this->ID);
  122.             return new SOAP_Value("\{$ns}$name",'Person',
  123.                 $v,array('Name'=>$this->Name,'Male'=>$this->Male));
  124.         else
  125.             $v[= new SOAP_Value("\{$ns}Name",'string',$this->Name);
  126.             $v[= new SOAP_Value("\{$ns}Male",'boolean',$this->Male);
  127.             return new SOAP_Value("\{$ns}$name",'Person',$v);        
  128.     }        
  129. }
  130.  
  131. class x_Person extends Person {
  132.     function x_Person($a=NULL$i=NULL$n=NULL$m=NULL{
  133.         $parent->Person($a,$i,$n,$m);
  134.     }
  135. }
  136.  
  137. class Employee {
  138.     var $ID;
  139.     var $salary;
  140.     var $person// class person2
  141.     function Employee($person=NULL,$id=NULL,$salary=NULL{
  142.         $this->person $person;
  143.         $this->ID $id;
  144.         $this->salary $salary;
  145.     }
  146.     
  147.     function __to_soap($name 'x_Employee'$ns='http://soapinterop.org/employee')
  148.     {
  149.         $person $this->person->__to_soap('person','http://soapinterop.org/person',true);
  150.         $person->namespace = $ns;
  151.         $va[$person;
  152.         $va[= new SOAP_Value("\{$ns}salary",'double',$this->salary);
  153.         $va[= new SOAP_Value("\{$ns}ID",'int',$this->ID);
  154.         return new SOAP_Value("\{$ns}$name",'Employee',$va);
  155.     }    
  156. }
  157.  
  158. class x_Employee extends Employee {
  159.     function x_Employee($person=NULL,$id=NULL,$salary=NULL{
  160.         $parent->Employee($person,$id,$salary);
  161.     }
  162. }

Documentation generated on Mon, 11 Mar 2019 15:06:26 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.