用PHP调用WCF后,有一个add方法,参数是对象,向SQL Server插入数据,有一个字段CreateDate类型是datetime,执行就会报错
<?php
$client=new SoapClient("http://192.168.117.223:81/EIPMail.svc?wsdl");
$res = array(
"MailID"=>'BUG00000004',
"Account"=>'353234',
"Address"=>'cjqcy416',
"MailSubject"=>'主题',
"MailBody"=>'正文',
"Url"=>'www.baidu.com',
"SystemName"=>'百度',
"SystemSort"=>'A9',
"Address_BCC"=>'',
"Address_CC"=>'',
"CreateMan"=> 'cjqcy416',
"CreateDate"=> date("Y-m-d H:i:s",time()),
"MailType"=>'通知',
"ID"=>0
);
$info = array('EipMail'=>$res);
$result1 = $client->DoAdd($info);
Fatal error: Uncaught SoapFault exception: [a:DeserializationFailed] The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:EipMail. The InnerException message was 'There was an error deserializing the object of type EipMail.Model.EipMailTable. The value '2017-12-07 17:34:04' cannot be parsed as the type 'DateTime'.'. Please see InnerException for more details.
<?php
$client=new SoapClient("http://192.168.117.223:81/EIPMail.svc?wsdl");
$res = array(
"MailID"=>'BUG00000004',
"Account"=>'353234',
"Address"=>'cjqcy416',
"MailSubject"=>'主题',
"MailBody"=>'正文',
"Url"=>'www.baidu.com',
"SystemName"=>'百度',
"SystemSort"=>'A9',
"Address_BCC"=>'',
"Address_CC"=>'',
"CreateMan"=> 'cjqcy416',
"CreateDate"=> date("Y-m-d H:i:s",time()),
"MailType"=>'通知',
"ID"=>0
);
$info = array('EipMail'=>$res);
$result1 = $client->DoAdd($info);
Fatal error: Uncaught SoapFault exception: [a:DeserializationFailed] The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:EipMail. The InnerException message was 'There was an error deserializing the object of type EipMail.Model.EipMailTable. The value '2017-12-07 17:34:04' cannot be parsed as the type 'DateTime'.'. Please see InnerException for more details.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货