1 | <?php |
---|
2 | /** |
---|
3 | * This is a data type that is used in SOAP Interop testing, but is here as an |
---|
4 | * example of using complex types. When the class is deserialized from a SOAP |
---|
5 | * message, it's constructor IS NOT CALLED! So your type classes need to |
---|
6 | * behave in a way that will work with that. |
---|
7 | * |
---|
8 | * Some types may need more explicit serialization for SOAP. The __to_soap |
---|
9 | * function allows you to be very explicit in building the SOAP_Value |
---|
10 | * structures. The soap library does not call this directly, you would call |
---|
11 | * it from your soap server class, echoStruct in the server class is an |
---|
12 | * example of doing this. |
---|
13 | * |
---|
14 | * @category Web Services |
---|
15 | * @package SOAP |
---|
16 | */ |
---|
17 | class SOAPStruct |
---|
18 | { |
---|
19 | |
---|
20 | var $varString; |
---|
21 | var $varInt; |
---|
22 | var $varFloat; |
---|
23 | |
---|
24 | function SOAPStruct($s = null, $i = null, $f = null) |
---|
25 | { |
---|
26 | $this->varString = $s; |
---|
27 | $this->varInt = $i; |
---|
28 | $this->varFloat = $f; |
---|
29 | } |
---|
30 | |
---|
31 | function &__to_soap($name = 'inputStruct', $header = false, |
---|
32 | $mustUnderstand = 0, |
---|
33 | $actor = 'http://schemas.xmlsoap.org/soap/actor/next') |
---|
34 | { |
---|
35 | $inner = array( |
---|
36 | new SOAP_Value('varString', 'string', $this->varString), |
---|
37 | new SOAP_Value('varInt', 'int', $this->varInt), |
---|
38 | new SOAP_Value('varFloat', 'float', $this->varFloat)); |
---|
39 | |
---|
40 | if ($header) { |
---|
41 | $value = new SOAP_Header($name, |
---|
42 | '{http://soapinterop.org/xsd}SOAPStruct', |
---|
43 | $inner, |
---|
44 | $mustUnderstand, |
---|
45 | $actor); |
---|
46 | } else { |
---|
47 | $value = new SOAP_Value($name, |
---|
48 | '{http://soapinterop.org/xsd}SOAPStruct', |
---|
49 | $inner); |
---|
50 | } |
---|
51 | |
---|
52 | return $value; |
---|
53 | } |
---|
54 | |
---|
55 | } |
---|