SoapVar::SoapVar

(no version information, might be only in CVS)

SoapVar::SoapVar --  SoapVar constructor

Description

SoapVar SoapVar::SoapVar ( mixed data, int encoding [, string type_name [, string type_namespace [, string node_name [, string node_namespace]]]])

SoapVar is a special low-level class for encoding parameters and returning values in non-WSDL mode. It is just a data holder and does not have any special methods except the constructor. It is useful when you would like to set the type property in SOAP request or response. The constructor takes data to pass or return, encoding ID to encode it (see XSD_... constants) and as option type name and namespace and XML node name and namespace.

Example 1. Some examples

<?php
class SOAPStruct {
    function
SOAPStruct($s, $i, $f)
    {
        
$this->varString = $s;
        
$this->varInt = $i;
        
$this->varFloat = $f;
    }
}
$client = new SoapClient(null, array('location' => "http://localhost/soap.php",
                                     
'uri'      => "http://test-uri/"));
$struct = new SOAPStruct('arg', 34, 325.325);
$soapstruct = new SoapVar($struct, SOAP_ENC_OBJECT, "SOAPStruct", "http://soapinterop.org/xsd");
$client->echoStruct(new SoapParam($soapstruct, "inputStruct"));
?>

See also SoapClient::__call() and SoapParam::SoapParam().