2013-09-05 4 views
0

PHP에서 비누 서버를 설정하려고합니다. WSD1 없이는 제대로 작동하는 것 같습니다. 나는 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

나는 문제를 해결했다. 나는 stackOverflow 규칙으로 인해 지금 당장은 할 수 없기 때문에 몇 시간 만에 질문에 대답 할 것이다. – Andrea

답변

0

문제점을 발견했습니다.

우선, CodeIgniter와 WSDL을 생성하기 위해 웹에서 찾은 라이브러리를 사용하고 있습니다.

'service'태그에 문제가 있습니다. 를 설정하는

"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

관련 문제