未捕获的SoapFault异常:[HTTP]未找到

时间:2012-09-24 08:23:45

标签: php soap

这是我的代码

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

我在var_dump

$client之后得到了这个
object(SoapClient)#1 (2) { ["_soap_version"]=> int(1) ["sdl"]=> resource(1) of type (Unknown) }

然而,当我尝试找到var_dump($ client-> 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>

为什么我收到此错误的任何想法?

2 个答案:

答案 0 :(得分:1)

确保soap:address指向正确的现有服务

答案 1 :(得分:0)

您的客户端代码没有任何问题....我运行

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

你会得到

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

显然cacheTorrent期待一个需要成为有效torrent的URL ..我确定在尝试过验证或访问该URL时肥皂服务器上生成了错误