1

私は現在、phpでsoapメソッドを使用してredbus apiを作成しています。

今私のコーディングには日時の問題があります。これらはコードです

$c = new soapclient('...wsdl....',
 array('Authentication' => array('LoginID' =>'x','Password'=>'x')));

$timezone = new DateTimeZone('UTC');
 $time='2012-04-17T16:50:45';
$date = new DateTime($time,$timezone);
$sourceid=array('SourceID'=>'244','DestinationID'=>'477','DateOfJourney' =>$date);

Fatal error: Uncaught SoapFault exception: [soap:Client] Server was Could to read request. としてエラーが表示されます。---> XML 文書にエラーがあります (2, 252)。---> 文字列 '' は有効な AllXsd 値ではありません

私はこれが日付の問題であるべきです

4

1 に答える 1

1

OK、PHPで必要な場合は、次のとおりです。

交換

$sourceid=array('SourceID'=>'244','DestinationID'=>'477','DateOfJourney' =>$date);

$sourceid=array('SourceID'=>'244','DestinationID'=>'477','DateOfJourney' =>str_replace($date->format( 'P' ), '', $date->format( 'c' )));

お役に立てれば。

于 2012-04-16T08:50:52.057 に答える