不是有效的AllXsd值

Lor*_*Jr. 13 php xml soap

我从Soap客户端请求得到了这个:

例外:SoapFault异常:[soap:Client]服务器无法读取请求.---> XML文档中存在错误(2,273).--->字符串'2010-5-24'不是有效的AllXsd值.在/path/filinet.php:21堆栈跟踪:#0 [内部函数]:SoapClient - > __ call('SubIdDetailsByO ...',数组)#1 /path/filinet.php(21):SoapClient-> SubIdDetailsByOfferId(数组)#2 {main}

好像我发送的值不正确,如何在php中的AllXsd格式化我的值?

这是我的代码:

<?php       
$start = isset($_GET['start']) ? $_GET['start'] : date("Y-m-d");
$end = isset($_GET['end']) ? $_GET['end'] : date("Y-m-d");

//define parameter array
$param = array('userName'=>'user', 'password'=>'pass', 'startDate' => $start, 'endDate' => $end, 'promotionId' => '');

//Get wsdl path
$serverPath = "https://webservices.filinet.com/affiliate/reports.asmx?WSDL";

 //Declare Soap client
 $client = new SoapClient($serverPath);
 try {
        //make the call
        $result = $client->SubIdDetailsByOfferId($param);
        //If error found display error
        if(isset($fault))
        {
            echo "Error: ". $fault;
        }
        //If no error display response
        else
        {
            //Used to display raw XML in the Web Browser
            header("Content-Type: text/xml;");
            //SubIdDetailsResult = XML results
            echo $result->SubIdDetailsByOfferIdResult;
        }
    }
    catch(SoapFault $ex) {
        echo "<b>Exception:</b> ". $ex;
    }
unset($client);
?>
Run Code Online (Sandbox Code Playgroud)

Óla*_*age 29

AllXsd值看起来像这个IIRC

2010-05-24T18:13:00


小智 10

您需要使用ISO 8601日期格式 date('c', strtotime($my_date));

http://php.net/date