0
我正在嘗試使用php客戶端來使用ASP.Net web服務。 php方法接收一個雙參數並根據它返回一個值。使用php調用ASP.Net web服務
這是我的client.php代碼:
$wsdl_url = "url";
$client = new SoapClient($wsdl_url);
$params = array('value'=>200);
$response = $client->kilogramsToPounds($params);
echo "<pre>";
var_dump($response);
echo "</pre>";
echo "$response->kilogramsToPoundsResult";
當我運行代碼,我得到了以下錯誤:
Fatal error: Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding: object has no 'kilograms' property in /var/www/student/oce1bct/CourseWork/Scenario3/TestFolder/convertersTest.php:23 Stack trace: #0 /var/www/student/oce1bct/CourseWork/Scenario3/TestFolder/convertersTest.php(23): SoapClient->__call('kilogramsToPoun...', Array) #1 /var/www/student/oce1bct/CourseWork/Scenario3/TestFolder/convertersTest.php(23): SoapClient->kilogramsToPounds(Array) #2 {main} thrown in /var/www/student/oce1bct/CourseWork/Scenario3/TestFolder/convertersTest.php on line 23
從被消耗Web服務的摘錄也低於
[WebMethod]
public double kilogramsToPounds(double kilograms)
{
double pounds = 0;
pounds = kilograms * 2.204;
return pounds;
}
我90%確定我沒有正確地將值傳遞給Web服務調用,但一直沒有爲了糾正這個問題。 任何幫助,將不勝感激。 謝謝。