0
我有這個問題,目前我正在學習肥皂和發展與http://vanillatours.com WSDL網上訂票系統在PHPPHP SOAP ERRORMESSAGE - System.NullReferenceException:對象不設置到對象的實例
其所需的標題是soapaction
和charset
。我已包括,soapaction更改爲所需的請求。例如,目前正在嘗試做checklogin()
功能。
我試過print_r($client->__getFunctions())
看功能是否連接,它們是!
我試圖print_r($client)
,看看標題連接,他們是
的問題是,我想不通爲什麼我得到這個errormessage的。
System.NullReferenceException: Object reference not set to an instance of an object.
at WcfService.Wcf.CheckLogin(LoginHeaderWcfRequest loginHeader)
嘗試一切!我非常新的肥皂和任何幫助將不勝感激。也許我沒有正確使用數據「請求」?
謝謝!
<?php
$wsdl = "http://xmltest.vanillatours.com/Wcf.svc?wsdl";
$client = new SoapClient($wsdl);
$data = array(
"request" => array(
"a:AgentId" => blabla,
"a:Language" => "En",
"a:Password" => "blabla",
"a:Username" => "blabla"
)
);
$header = array();
$header[] = new SoapHeader('http://tempuri.org/IWcf/CheckLogin','SOAPAction');
$header[] = new SoapHeader('text/xml; charset=utf-8','ContentType');
$client->__setSoapHeaders($header);
$response = $client->__soapCall('CheckLogin', $data);
echo '<pre>';
print_r($client->__getFunctions()); // functions seem to show pretty well
echo '<br>------------------------------------------------------<br><br>';
print_r($client); // headers are attached
echo '<br>------------------------------------------------------<br><br>';
print_r($response); // errormessage, can not figure out what is the problem.
echo '</pre>';
?>
這是如何從他們的文檔進行連接,如果我可以使用另一種方法,將不勝感激了。
CheckLogin函數檢查用戶憑證是否有效。 的SOAPAction值是http://tempuri.org/IWcf/CheckLogin
3.1.2請求
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<CheckLogin xmlns="http://tempuri.org/">
<loginHeader xmlns:a="http://schemas.datacontract.org/2004/07/WcfService"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:AgentId>Your Agent Id</a:AgentId>
<a:Language>Your preferred language</a:Language>
<a:Password>Your Password</a:Password>
<a:Username>Your username</a:Username>
</loginHeader>
</CheckLogin>
</s:Body>
</s:Envelope>