File size: 5,812 Bytes
07c3cdd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?php
//
// +----------------------------------------------------------------------+
// | PHP Version 4                                                        |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group                                |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.02 of the PHP license,      |
// | that is bundled with this package in the file LICENSE, and is        |
// | available at through the world-wide-web at                           |
// | http://www.php.net/license/2_02.txt.                                 |
// | If you did not receive a copy of the PHP license and are unable to   |
// | obtain it through the world-wide-web, please send a note to          |
// | license@php.net so we can mail you a copy immediately.               |
// +----------------------------------------------------------------------+
// | Authors: Shane Caraveo <Shane@Caraveo.com>                           |
// +----------------------------------------------------------------------+
//
// $Id: params_classes.php,v 1.8 2007/01/21 16:15:00 yunosh Exp $
//
require_once 'SOAP/Value.php';

class SOAPStruct {
    var $varString;
    var $varInt;
    var $varFloat;
    function SOAPStruct($s=NULL, $i=NULL, $f=NULL) {
        $this->varString = $s;
        $this->varInt = $i;
        $this->varFloat = $f;
    }
    
    function __to_soap($name = 'inputStruct', $header=false, $mustUnderstand=0, $actor='http://schemas.xmlsoap.org/soap/actor/next')
    {
        $inner[] = new SOAP_Value('varString','string',$this->varString);
        $inner[] = new SOAP_Value('varInt','int',$this->varInt);
        $inner[] = new SOAP_Value('varFloat','float',$this->varFloat);
        if ($header) {
            return new SOAP_Header($name,'{http://soapinterop.org/xsd}SOAPStruct',$inner,$mustUnderstand,$actor);
        }
        return new SOAP_Value($name,'{http://soapinterop.org/xsd}SOAPStruct',$inner);
        
    }
}

class SOAPStructStruct {
    var $varString;
    var $varInt;
    var $varFloat;
    var $varStruct;
    function SOAPStructStruct($s=NULL, $i=NULL, $f=NULL, $ss=NULL) {
        // XXX unfortunately, a copy of $ss will occure here
        // ze2 can fix this I think
        $this->varString = $s;
        $this->varInt = $i;
        $this->varFloat = $f;
        $this->varStruct = $ss;
    }
    
    function __to_soap($name = 'inputStruct')
    {
        $v[] = new SOAP_Value('varString','string',$this->varString);
        $v[] = new SOAP_Value('varInt','int',$this->varInt);
        $v[] = new SOAP_Value('varFloat','float',$this->varFloat);
        $v[] = $this->varStruct->__to_soap('varStruct');
        return new SOAP_Value($name,'{http://soapinterop.org/xsd}SOAPStructStruct',$v);
    }    
}

class SOAPArrayStruct {
    var $varString;
    var $varInt;
    var $varFloat;
    var $varArray;
    function SOAPArrayStruct($s=NULL, $i=NULL, $f=NULL, $ss=NULL) {
        // XXX unfortunately, a copy of $ss will occure here
        // ze2 can fix this I think
        $this->varString = $s;
        $this->varInt = $i;
        $this->varFloat = $f;
        $this->varArray = $ss;
    }
    
    function __to_soap($name = 'inputStruct')
    {
        $ar = array();
        $c = count($this->varArray);
        for ($i=0; $i<$c; $i++) {
            $ar[] = new SOAP_Value('item','string',$this->varArray[$i]);
        }
        $v[] = new SOAP_Value('varString','string',$this->varString);
        $v[] = new SOAP_Value('varInt','int',$this->varInt);
        $v[] = new SOAP_Value('varFloat','float',$this->varFloat);
        $v[] = new SOAP_Value('varArray',false,$ar);
        
        return new SOAP_Value($name,'{http://soapinterop.org/xsd}SOAPArrayStruct',$v);
    }    
}

class Person {
    var $Age;
    var $ID;
    var $Name;
    var $Male;
    function Person($a=NULL, $i=NULL, $n=NULL, $m=NULL) {
        $this->Age = $a;
        $this->ID = $i;
        $this->Name = $n;
        $this->Male = $m;
    }

    function __set_attribute($key, $value)
    {
        $this->$key = $value;
    }
    
    function __to_soap($name = 'x_Person',$ns = 'http://soapinterop.org/xsd', $compound2=false)
    {
        if (!$compound2) {
            $v[] = new SOAP_Value("\{$ns}Age",'double',$this->Age);
            $v[] = new SOAP_Value("\{$ns}ID",'float',$this->ID);
            return new SOAP_Value("\{$ns}$name",'Person',
                $v,array('Name'=>$this->Name,'Male'=>$this->Male));
        } else
            $v[] = new SOAP_Value("\{$ns}Name",'string',$this->Name);
            $v[] = new SOAP_Value("\{$ns}Male",'boolean',$this->Male);
            return new SOAP_Value("\{$ns}$name",'Person',$v);        
    }        
}

class x_Person extends Person {
    function x_Person($a=NULL, $i=NULL, $n=NULL, $m=NULL) {
        $parent->Person($a,$i,$n,$m);
    }
}

class Employee {
    var $ID;
    var $salary;
    var $person; // class person2
    function Employee($person=NULL,$id=NULL,$salary=NULL) {
        $this->person = $person;
        $this->ID = $id;
        $this->salary = $salary;
    }
    
    function __to_soap($name = 'x_Employee', $ns='http://soapinterop.org/employee')
    {
        $person = $this->person->__to_soap('person','http://soapinterop.org/person',true);
        $person->namespace = $ns;
        $va[] = $person;
        $va[] = new SOAP_Value("\{$ns}salary",'double',$this->salary);
        $va[] = new SOAP_Value("\{$ns}ID",'int',$this->ID);
        return new SOAP_Value("\{$ns}$name",'Employee',$va);
    }    
}

class x_Employee extends Employee {
    function x_Employee($person=NULL,$id=NULL,$salary=NULL) {
        $parent->Employee($person,$id,$salary);
    }
}