PHPでSOAPサーバーを設定しようとしています。WSDl がなくても問題なく動作するようです。サーバーを 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-ERROR: 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も新しいものに更新しました。
ありがとう。