0
$xml = "<?xml version='1.0' encoding='utf-8'?>
<soap12:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap12='http://www.w3.org/2003/05/soap-envelope'>
<soap12:Body>
<GetProviderTrades xmlns='ZuluTrade.WebServices'>
<providerId>128391</providerId>
<currencyIds>
<string>EURUSD</string>
<string>USDCAD</string>
</currencyIds>
<fromDateStr>1986-08-27T09:00:00</fromDateStr>
<toDateStr>2014-01-12T09:00:00</toDateStr>
<validTrades>true</validTrades>
<lotSize>Standard</lotSize>
<start>0</start>
<length>20</length>
<sortBy>dc</sortBy>
<sortAscending>false</sortAscending>
</GetProviderTrades>
</soap12:Body>
</soap12:Envelope>";
請求函數
function http_post ($url, $xml)
{
date_default_timezone_set('America/New_York');
$post_string = $xml;
$soap_do = curl_init();
curl_setopt($soap_do, CURLOPT_URL, $url);
curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($soap_do, CURLOPT_TIMEOUT, 10);
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true);
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($soap_do, CURLOPT_POST, true);
curl_setopt($soap_do, CURLOPT_POSTFIELDS, $post_string);
curl_setopt($soap_do, CURLOPT_HTTPHEADER, array('Content-Type: text/xml; charset=utf-8', 'Content-Length: '.strlen($post_string)));
//curl_setopt($soap_do, CURLOPT_USERPWD, $user . ":" . $password);
$result = curl_exec($soap_do);
$err = curl_error($soap_do);
return $result;
}
呼叫
$postRequest = http_post('http://www.zulutrade.com/WebServices/Performance.asmx?op=GetProviderTrades',$xml);
充分反應
soap:ServerServer was unable to process request. ---> There was an error generating the XML document. ---> <>f__AnonymousType55`2[System.Int32,Z.T[]] cannot be serialized because it does not have a parameterless constructor.
的WSDL http://www.zulutrade.com/WebServices/Performance.asmx?WSDL
有沒有發現什麼毛病我在做什麼,什麼想法?