2011-10-31 45 views
0

所以我嘗試使用SoapClient進行連接,但遇到問題。沒有找到肥皂功能

$this->client = new SoapClient(self::parser_url . '/SovrenConvertAndParse/ConvertAndParse.asmx?WSDL',array('soap_version' => SOAP_1_2 
    )); 
var_dump($this->client); 
var_dump($this->client->__getFunctions()); 
try { var_dump($this->client->GetVersionInfo());} 
catch (Exception $e){echo $e->getMessage();} 

而且這裏的結果我得到:

object(SoapClient)#32 (2) { 
    ["_soap_version"]=> 
    int(2) 
    ["sdl"]=> 
    resource(42) of type (Unknown) 
} 

array(30) { 
... 
    [18]=> 
    string(65) "GetVersionInfoResponse GetVersionInfo(GetVersionInfo $parameters)" 
... 
} 

Not Found 

好像如果該功能getFunctions顯示出來(),那麼我應該能夠調用它,它應該是容易找到。沒有?什麼會導致這樣的事情?

所以我也試了一下沒有try/catch語句,我得到以下錯誤:

Fatal error: Uncaught SoapFault exception: [HTTP] Not Found in /path/to/file:29 

任何人有任何想法,以什麼可以怎麼回事,如何解決這一問題?

+0

你需要傳遞的參數您呼叫 – tkt986

+0

我的功能試圖: 'var_dump($ this-> client-> GetVersionInfo(array('GetVersionInfoResult'=>'xml')));' 但我仍然得到相同的錯誤。 –

回答

0

我從Sovren我和我對面這個職位絆倒了。既然你沒有聯繫我們獲得支持,我會假設你已經解決了這個問題。但是對於其他的讀者,我用PHP 5.2.12運行下面的文件,並調用GetVersionInfo既SOAP_1_1和SOAP_1_2正確迴應:

<?php 
$client = new SoapClient(
    'http://localhost/SovrenConvertAndParse/ConvertAndParse.asmx?WSDL', 
    array('soap_version' => SOAP_1_2)); 
var_dump($client); 
var_dump($client->__getFunctions()); 
try { var_dump($client->GetVersionInfo());} 
catch (Exception $e){echo $e->getMessage();} 
?> 
+0

原來,這是因爲肥皂本身。我們有一個端口集,但SOAP似乎在使用SOAP的PHP中有問題。我們必須使用我在這裏找到的解決方法:http://www.victorstanciu.ro/php-soapclient-port-bug-workaround/感謝您的幫助。 –

0

這應該工作..

$this->client = new SoapClient(self::parser_url . '/SovrenConvertAndParse/ConvertAndParse.asmx?WSDL',array("soap_version" => SOAP_1_1 
    )); 
var_dump($this->client); 
var_dump($this->client->__getFunctions()); 
try { var_dump($this->client->GetVersionInfo(GetVersionInfoResult=>"version"));} //this is where i am editing your question, you need to have a parameter passed 
catch (Exception $e){echo $e->getMessage();} 
+0

我也嘗試了var_dump,但仍然得到相同的錯誤。我也以不同的方式嘗試過,但沒有成功(請參閱我對原始文章的評論) –

+0

嘗試更改「soap_version」=> SOAP_1_1,查看更新後的答案。 – tkt986

+0

第二個var_dump(在你編輯之後)返回相同的錯誤......我也看不出與之前在我上面評論中說過的有什麼不同......將'xml'更改爲'version'不會改變一個HTTP錯誤...我不認爲這與實際的通話有什麼關係,但有其他的事情。 –