預期用SOAPClient寫一支PHP去call WCF Service(只有WSHTTPBinding,沒有Basic),以下程式是用來測試能否成功回傳結果,目前還無法成功,求解?
//$params的格式與代入的參數用WCFTestClient測試是有成功回傳值
try{
$params = array(
'stringEncryptionAccount'=> $EncryptionAccount,
'guidToken'=>$systoken,
'stringErrorMsg' => $error
);
echo "<pre>".print_r($params, true)."</pre>";
$client = new SoapClient($url.'?wsdl',
array(
'trace'=>true,
'exceptions' => true,
'cache_wsdl' => 0,
'soap_version' => 'SOAP_1_2',
'encoding' => 'ISO-8859-1'
)
);
$OutParam = $client->GetDecryptAccount($params);
$userid = $OutParam->GetDecryptAccountResult;
echo 'Response'."<BR><BR>";
echo 'userid: '.$userid."<BR><BR>";
} catch (SoapFault $e) {
echo '錯誤訊息: ' .$e->getMessage().'<br>';
echo '錯行數: ' .$e->getLine().'<br>';
echo '錯誤檔案: ' .$e->getFile().'<br>';
echo '錯誤碼: ' .$e->getCode().'<br>';
die;
exit;
}
執行結果:
[更新]2021/9/16 於另一台Server測試相同程式,call相同的WCF service,同樣失敗,但錯誤訊息卻不同?
確認一下$url?wsdl
是否存在