PHPCoder
PHPCoder

Reputation: 77

SOAP PHP date time issue

When passing array in SOAP request like this, its working fine

$parameters = array(date'=>'2016-08-27T00:00:00','aa'=>'aaaa');

But when i store the date value in a php variable and pass its showing error

$date = '2016-08-27T00:00:00';
$parameters = array(date'=>'$date','aa'=>'aaaa');

Fault code: soap:Client Fault string: Server was unable to read request. ---> There is an error in XML document (2, 592). ---> The string '$date' is not a valid AllXsd value.

Upvotes: 0

Views: 1135

Answers (1)

Jeroen de Jong
Jeroen de Jong

Reputation: 337

The $date value will be passed litterally as '$date' instead of '2016-08-27T00:00:00'. Use double quotes instead (or no quotes at all):

$parameters = array('date'=>"$date",'aa'=>'aaaa');

Upvotes: 1

Related Questions