(PHP 5, PHP 7, PHP 8)
SoapVar::__construct — Constructor de SoapVar
$data
,$encoding
,$typeName
= null
,$typeNamespace
= null
,$nodeName
= null
,$nodeNamespace
= null
Construye un nuevo objeto SoapVar.
data
Los datos a pasar o a devolver.
encoding
El ID de codificación, una de las constantes XSD_...
.
typeName
El nombre del tipo.
typeNamespace
El tipo del espacio de nombres.
nodeName
El nombre del nodo XML.
nodeNamespace
El espacio de nombres del nodo XML.
Versión | Descripción |
---|---|
8.0.3 |
typeName , typeNamespace , nodeName ,
y nodeNamespace ahora son nullable.
|
Ejemplo #1 Ejemplo con SoapVar::__construct()
<?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"));
?>