2013-10-17 91 views
-1

我試圖簡單地返回字符串並將其打印在頁面上。PHP中的肥皂返回字符串

這裏PHP代碼

$client = new SoapClient("path/track_on.asmx?WSDL"); $result = $client -> demoa("working!") -> demoaResult;

print_r($result);

SOAP服務


[WebMethod]

public string demoa(string emaildemo) 
{ 

    string a = emaildemo; 
    return a; 

} 

錯誤:

Notice: Undefined property: stdClass::$demoaResult in C:\xampp\htdocs\track_on\index.php on line 4($result = $client -> demoa("working!") -> demoaResult;) 

有什麼建議?

回答

1

嘗試:

$client = new SoapClient("path/track_on.asmx?WSDL"); 
$result = $client -> demoa("working!"); 

print_r($result->demoaResult); 

您試圖訪問的demoa方法demoaResult變量,但你應該從$result變量

+0

嘗試,仍然沒有工作訪問。 :( – user1900123

+0

你能在瀏覽器中訪問「path/track_on.asmx?WSDL」嗎?它是否顯示wsdl定義?如果是這樣的話,請運行「var_dump($ client - > __ getFunctions());」來查看如果demoa()顯示? – tCode