1

我遇到了 Uncaught SoapFault 异常错误:[HTTP] Not Found

这是我的代码

$client = new SOAPClient ( 'http://torcache.net/torcache.wsdl');
$infoHash = $client->cacheTorrent(base64_encode(file_get_contents('my.torrent')));

这是 WSDL

<?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>

我的服务器统计

PHP 版本 5.3.15

知道为什么我会收到此错误吗?我从他们的 api 页面 https://torcache.net/api得到了这个示例脚本

4

1 回答 1

0

我从来没有让远程 Wsdl 加载 php 的soapclient。要进行测试,请尝试将 wsdl 下载到本地文件并使用根目录“/”的绝对文件路径而不是 url。如果它工作正常,正如我所料,你至少可以确定这不是你的错,但可以肯定它是库中的一个错误。我认为 php 开发世界中没有人关心肥皂,也没有人解决这个问题。或者,也许我们只是遗漏了一些明显的东西......

如果您不介意 php 5.3 已弃用的警告,您可以找到旧 nusoap 库的副本并使用它——它可以毫无问题地加载远程 wsdls。

于 2012-09-25T02:52:51.707 回答