2013-09-05 31 views
0

我想設置在PHP SOAP服務器。 這似乎沒有WSDl工作正常。當我點服務器的WSDL它給了我下面的錯誤:PHP - WSDL:找不到任何可用的綁定服務

Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Could not find any usable binding services in WSDL. 

...我已經尋找可能的解決方案的網絡,但沒有答案的幫助。

按照我的測試WSDL:

<?xml version='1.0' encoding='UTF-8'?> 
<definitions name="WSDLExample" targetNamespace="urn:WSDLExample" xmlns:typens="urn:WSDLExample" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"> 
    <message name="doHello"> 
     <part name="yourName" type="xsd:string"></part> 
    </message> 
    <message name="doHelloResponse"> 
     <part name="doHelloReturn" type="xsd:string"></part> 
    </message> 
    <message name="index"></message> 
    <message name="indexResponse"> 
     <part name="indexReturn" type="xsd:boolean"></part> 
    </message> 
    <portType name="ApiPortType"> 
     <operation name="doHello"> 
      <documentation>Gives your name back</documentation> 
      <input message="typens:doHello"></input> 
      <output message="typens:doHelloResponse"></output> 
     </operation> 
     <operation name="index"> 
      <documentation>This is awesome1</documentation> 
      <input message="typens:index"></input> 
      <output message="typens:indexResponse"></output> 
     </operation> 
    </portType> 
    <binding name="ApiBinding" type="typens:ApiPortType"> 
     <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"></soap:binding> 
     <operation name="doHello"> 
      <soap:operation soapAction="urn:ApiAction"></soap:operation> 
      <input> 
       <soap:body namespace="urn:WSDLExample" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"></soap:body> 
      </input> 
      <output> 
       <soap:body namespace="urn:WSDLExample" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"></soap:body> 
      </output> 
     </operation> 
     <operation name="index"> 
      <soap:operation soapAction="urn:ApiAction"></soap:operation> 
      <input> 
       <soap:body namespace="urn:WSDLExample" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"></soap:body> 
      </input> 
      <output> 
       <soap:body namespace="urn:WSDLExample" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"></soap:body> 
      </output> 
     </operation> 
    </binding> 
    <service name="WSDLExampleService"> 
     <port name="ApiPort" binding="typens:ApiBinding"> 
      <soap:address></soap:address> 
     </port> 
    </service> 
</definitions> 

謝謝!

編輯:

我發現這個問題,它是設置沒有正確的服務。 現在的錯誤是:

[WSDL] SOAP的錯誤:解析WSDL:與

沒有相關聯的位置,我想這仍然是一些相關的服務。

這裏是服務器代碼:

error_reporting(0); 
require_once(APPPATH . "/libraries/wsdl/WSDLCreator.php"); //Path to the library 
$test = new WSDLCreator("WSDLExample", "http://localhost/soapWrap/wsdl"); 
$test->setClassesGeneralURL("http://localhost/soapWrap"); 

$test->includeMethodsDocumentation(TRUE); 
$test->addFile(APPPATH . "controllers/api.php"); 

$test->addURLToClass("api", 'http://localhost/soapWrap/'); 
$test->addURLToTypens("XMLCreator", "http://localhost/soapWrap"); 


$test->createWSDL(); 

$test->printWSDL(true); // print with headers 

我也更新了新的WSDL。

謝謝。

+0

你可以發佈你調用wsdl的代碼嗎? – Matheno

+0

剛剛用新信息編輯了mex。我現在得到一個不同的錯誤。之前的問題與服務標籤有關。謝謝 – Andrea

+0

我已經解決了這個問題。我會在幾個小時內回答這個問題,因爲現在由於堆棧溢出規則,我無法正確回答。 – Andrea

回答

0

我已經發現了這個問題(一個或多個)。

首先,我使用笨,我在網上找到了生成WSDL庫。

的問題是與「服務」標籤。

我不得不使用的方法:

「addURLToClass」 和 「addURLToTypens」 來進行設置。

但由於該庫並不意味着與CI的工作,我不得不打了一下代碼。 問題是在WSDLCreator.php頁面,改變傳遞類是CI控制器,然後用它裏面的類。就這樣。

這是實際的代碼:

$classLower = strtolower($class); 
$url = isset($this->classesURLS[$class]) ? $this->classesURLS[$class] : $this->classesGeneralURL; 
$port = new XMLCreator("port"); 
$port->setAttribute("name", $class."Port"); 
$port->setAttribute("binding", "typens:".$class."Binding"); 
$soap = new XMLCreator("soap:address"); 
isset($this->classesURLS[$classLower]) ? $soap->setAttribute("location", $this->classesURLS[$classLower]) : ""; 
$port->addChild($soap); 

如果您需要了解代碼的詳細信息,讓我知道。

感謝您的幫助! Andrea

相關問題