note 80715 deleted from soapclient.soapclient by cmb

From: Date: Sun, 17 Nov 2019 09:01:43 +0000
Subject: note 80715 deleted from soapclient.soapclient by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-213109@lists.php.net to get a copy of this message
Note Submitter: james dot ellis at gmail dot com ---- A note regarding boolean values that may seem obvious on reflection but could be a gotcha for some: Seeing a SOAP request example with <SomeBooleanParam>true</SomeBooleanParam> may lead you to pass in string "true" or "false" as the parameter, which is incorrect - the correct method is to use boolean data types. <?php $client = new SoapClient($wsdl,$options); $method = "DoSomething"; $params = new stdClass; $params->SomeBooleanParam = TRUE; $client->$method($params); /** simplified request snippet would be <SomeBooleanParam>true</SomeBooleanParam> **/ //this will also be correct, but not for the right reasons: $params->SomeBooleanParam = "true"; $client->$method($params); /** simplified request snippet would be <SomeBooleanParam>true</SomeBooleanParam> **/ //this is where you may be wondering what is going on $params->SomeBooleanParam = "false"; $client->$method($params); /** simplified request snippet would be <SomeBooleanParam>true</SomeBooleanParam> **/ //you need to do this instead $params->SomeBooleanParam = FALSE; $client->$method($params); /** simplified request snippet would be <SomeBooleanParam>false</SomeBooleanParam> **/ ?> Hope that helps!

« previous php.notes (#213109) next »