[780] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 |
|
---|
| 4 |
|
---|
| 5 |
|
---|
| 6 | /**
|
---|
| 7 | * For creating serializable abstractions of native PHP types. This class
|
---|
| 8 | * allows element name/namespace, XSD type, and XML attributes to be
|
---|
| 9 | * associated with a value. This is extremely useful when WSDL is not
|
---|
| 10 | * used, but is also useful when WSDL is used with polymorphic types, including
|
---|
| 11 | * xsd:anyType and user-defined types.
|
---|
| 12 | *
|
---|
| 13 | * @author Dietrich Ayala <dietrich@ganx4.com>
|
---|
| 14 | * @version $Id: class.soap_val.php,v 1.11 2007/04/06 13:56:32 snichol Exp $
|
---|
| 15 | * @access public
|
---|
| 16 | */
|
---|
| 17 | class soapval extends nusoap_base {
|
---|
| 18 | /**
|
---|
| 19 | * The XML element name
|
---|
| 20 | *
|
---|
| 21 | * @var string
|
---|
| 22 | * @access private
|
---|
| 23 | */
|
---|
| 24 | var $name;
|
---|
| 25 | /**
|
---|
| 26 | * The XML type name (string or false)
|
---|
| 27 | *
|
---|
| 28 | * @var mixed
|
---|
| 29 | * @access private
|
---|
| 30 | */
|
---|
| 31 | var $type;
|
---|
| 32 | /**
|
---|
| 33 | * The PHP value
|
---|
| 34 | *
|
---|
| 35 | * @var mixed
|
---|
| 36 | * @access private
|
---|
| 37 | */
|
---|
| 38 | var $value;
|
---|
| 39 | /**
|
---|
| 40 | * The XML element namespace (string or false)
|
---|
| 41 | *
|
---|
| 42 | * @var mixed
|
---|
| 43 | * @access private
|
---|
| 44 | */
|
---|
| 45 | var $element_ns;
|
---|
| 46 | /**
|
---|
| 47 | * The XML type namespace (string or false)
|
---|
| 48 | *
|
---|
| 49 | * @var mixed
|
---|
| 50 | * @access private
|
---|
| 51 | */
|
---|
| 52 | var $type_ns;
|
---|
| 53 | /**
|
---|
| 54 | * The XML element attributes (array or false)
|
---|
| 55 | *
|
---|
| 56 | * @var mixed
|
---|
| 57 | * @access private
|
---|
| 58 | */
|
---|
| 59 | var $attributes;
|
---|
| 60 |
|
---|
| 61 | /**
|
---|
| 62 | * constructor
|
---|
| 63 | *
|
---|
| 64 | * @param string $name optional name
|
---|
| 65 | * @param mixed $type optional type name
|
---|
| 66 | * @param mixed $value optional value
|
---|
| 67 | * @param mixed $element_ns optional namespace of value
|
---|
| 68 | * @param mixed $type_ns optional namespace of type
|
---|
| 69 | * @param mixed $attributes associative array of attributes to add to element serialization
|
---|
| 70 | * @access public
|
---|
| 71 | */
|
---|
| 72 | function soapval($name='soapval',$type=false,$value=-1,$element_ns=false,$type_ns=false,$attributes=false) {
|
---|
| 73 | parent::nusoap_base();
|
---|
| 74 | $this->name = $name;
|
---|
| 75 | $this->type = $type;
|
---|
| 76 | $this->value = $value;
|
---|
| 77 | $this->element_ns = $element_ns;
|
---|
| 78 | $this->type_ns = $type_ns;
|
---|
| 79 | $this->attributes = $attributes;
|
---|
| 80 | }
|
---|
| 81 |
|
---|
| 82 | /**
|
---|
| 83 | * return serialized value
|
---|
| 84 | *
|
---|
| 85 | * @param string $use The WSDL use value (encoded|literal)
|
---|
| 86 | * @return string XML data
|
---|
| 87 | * @access public
|
---|
| 88 | */
|
---|
| 89 | function serialize($use='encoded') {
|
---|
| 90 | return $this->serialize_val($this->value, $this->name, $this->type, $this->element_ns, $this->type_ns, $this->attributes, $use, true);
|
---|
| 91 | }
|
---|
| 92 |
|
---|
| 93 | /**
|
---|
| 94 | * decodes a soapval object into a PHP native type
|
---|
| 95 | *
|
---|
| 96 | * @return mixed
|
---|
| 97 | * @access public
|
---|
| 98 | */
|
---|
| 99 | function decode(){
|
---|
| 100 | return $this->value;
|
---|
| 101 | }
|
---|
| 102 | }
|
---|
| 103 |
|
---|
| 104 |
|
---|
| 105 |
|
---|
| 106 |
|
---|
| 107 | ?> |
---|