2012-09-24 60 views
3

這裏是我的代碼未捕獲的SOAPFault例外:[HTTP]未找到

$client = new SOAPClient ('http://torcache.net/torcache.wsdl'); 
    var_dump($client->cacheTorrent()); 

我得到這個的$client

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

var_dump後,當我試圖找到的var_dump(但是我得到這個消息$客戶端 - > cacheTorrent()); 未捕獲的SoapFault異常:[HTTP]未找到

但這對我來說沒有意義,因爲我下載了wdsl文件,並且它明白表示操作cacheTorrent存在!

這裏

<?xml version='1.0' encoding='UTF-8' ?> 
<definitions name='Cache' 
    targetNamespace='urn:Torcache' 
    xmlns:tns='urn:Torcache' 
    xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' 
    xmlns:xsd='http://www.w3.org/2001/XMLSchema' 
    xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/' 
    xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/' 
    xmlns='http://schemas.xmlsoap.org/wsdl/'> 

<message name='cacheTorrentRequest'> 
    <part name='torrent' type='xsd:string'/> 
</message> 

<message name='cacheTorrentResponse'> 
    <part name='Result' type='xsd:string'/> 
</message> 

<portType name='CachePortType'> 
    <operation name='cacheTorrent'> 
    <input message='tns:cacheTorrentRequest'/> 
    <output message='tns:cacheTorrentResponse'/> 
    </operation> 
</portType> 

<binding name='CacheBinding' type='tns:CachePortType'> 
    <soap:binding style='rpc' 
    transport='http://schemas.xmlsoap.org/soap/http'/> 

    <operation name='cacheTorrent'> 
    <soap:operation soapAction='urn:xmethods-delayed-quotes#cacheTorrent'/> 
    <input> 
     <soap:body use='encoded' namespace='urn:xmethods-delayed-quotes' 
     encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/> 
    </input> 
    <output> 
     <soap:body use='encoded' namespace='urn:xmethods-delayed-quotes' 
     encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/> 
    </output> 
    </operation> 
</binding> 

<service name='CacheService'> 
    <port name='CachePort' binding='CacheBinding'> 
    <soap:address location='http://torcache.net/api/soap/'/> 
    </port> 
</service> 
</definitions> 

爲什麼我收到此錯誤的任何想法?

回答

0

沒有什麼不對您的客戶端代碼....我運行

$client = new SOAPClient ('http://torcache.net/torcache.wsdl'); 
var_dump($client->__getFunctions()); 

你會得到

array 
    0 => string 'string cacheTorrent(string $torrent)' (length=36) 

顯然cacheTorrent期待它必須是一個有效的洪流的URL。 。確保在soap服務器上生成錯誤,同時嘗試驗證或訪問該URL

+0

你好巴巴感謝您的幫助,但是我仍然得到這個錯誤,即使我使用有效的網址操作 –

+0

我的錯誤是這個致命錯誤:Uncaught SoapFault異常:[HTTP]找不到/ home/public_html/manualtorcache.php:8堆棧跟蹤:#0 [內部函數]:SoapClient - > __ doRequest('<?xml version =「...','http:// torcache ...','urn:xmethods- (...),1,0)#1 /home/public_html//manualtorcache.php(8):SoapClient - > __ call('cacheTorrent',Array)#2 /home/public_html/manualtorcache.php(8): SoapClient-> cacheTorrent('ZDg6YW5ub3VuY2U ...')#3 {main}拋出 –

+0

我遇到了與SOAP類似的問題。有沒有解決這個問題? –

1

確保soap:address指向正確的exis服務

+2

這更適合作爲評論。 – Werner