source: trunk/data/module/SOAP/example/example_types.php @ 18562

Revision 18562, 1.5 KB checked in by kajiwara, 14 years ago (diff)

EC-CUBE Ver2.4.3 分コミット。詳細はこちら( http://www.ec-cube.net/release/detail.php?release_id=210

Line 
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 */
14class SOAPStruct
15{
16
17    var $varString;
18    var $varInt;
19    var $varFloat;
20
21    function SOAPStruct($s = null, $i = null, $f = null)
22    {
23        $this->varString = $s;
24        $this->varInt = $i;
25        $this->varFloat = $f;
26    }
27   
28    function &__to_soap($name = 'inputStruct', $header = false,
29                        $mustUnderstand = 0,
30                        $actor = 'http://schemas.xmlsoap.org/soap/actor/next')
31    {
32        $inner[] = new SOAP_Value('varString', 'string', $this->varString);
33        $inner[] = new SOAP_Value('varInt', 'int', $this->varInt);
34        $inner[] = new SOAP_Value('varFloat', 'float', $this->varFloat);
35
36        if ($header) {
37            $value = new SOAP_Header($name,'{http://soapinterop.org/xsd}SOAPStruct',$inner,$mustUnderstand,$actor);
38        } else {
39            $value = new SOAP_Value($name,'{http://soapinterop.org/xsd}SOAPStruct',$inner);
40        }
41
42        return $value;
43    }
44}
Note: See TracBrowser for help on using the repository browser.