2017-08-02 14 views
0

私は最初のSOAP Webサービスを開発しようとしましたが、WSDLをwizdlで開こうとするとエラーが表示されます。私はこのエラーを得た:ここ<definitions>がWSDLに見つかりません

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> 
<SOAP-ENV:Body> 
<SOAP-ENV:Fault> 
<faultcode>WSDL</faultcode> 
<faultstring> 
SOAP-ERROR: Parsing WSDL: Couldn't find <definitions> in 
'http://localhost/testSolution/test.wsdl' 
</faultstring> 
</SOAP-ENV:Fault> 
</SOAP-ENV:Body> 
</SOAP-ENV:Envelope> 

は私のコードは次のとおりです。testSolution.php:

<?php 

class Ws{ 

    function getString() 
    { 
    return "TESTASTOS"; 
    } 
} 

ini_set("soap.wsdl_cache_enabled", 0); 

$serversoap = new SoapServer("http://localhost/testSolution/test.wsdl"); 

$serversoap->setClass("Ws"); 

$serversoap->handle(); 

?> 

そしてtest.wsdl:

<?xml version="1.0" encoding="iso-8859-1"?> 
<definitions 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
xmlns="http://schemas.xmlsoap.org/wsdl" 

    targetNamespace="urn:serviceTestwsdl" 
    xmlns:tns="urn:serviceTestwsdl" 
> 


<types> 
<xsd:schema targetNamespace="urn:serviceTestwsdl"/> 
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> 
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" /> 
</types> 

<message name="getStringRequest"> 
</message> 
<message name="getStringResponse"> 
<part name="return" type="xsd:string" /> 
</message> 

<portType name="serviceTestPortType"> 

<operation name="getString"> 
    <documentation>Récupère un string</documentation> 
    <input message="tns:getStringRequest"/> 
    <output message="tns:getStringResponse"/> 
</operation> 
</portType> 


<binding name="serviceTestBinding" type="tns:serviceTestPortType"> 

<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> 
<operation name="getString"> 
    <soap:operation soapAction="urn:serviceTestwsdl#getString" style="rpc"/> 
    <input> 
    <soap:body use="encoded" namespace="urn:serviceTestwsdl" 
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> 
    </input> 
    <output> 
    <soap:body use="encoded" namespace="urn:serviceTestwsdl" 
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> 
    </output> 
</operation> 
</binding> 

<service name="serviceTest"> 
<port name="serviceTestPort" binding="tns:serviceTestBinding"> 
    <soap:address location="http://localhost/testSolution/testSolution.php"/> 
</port> 

</service> 
</definitions> 

主な目標は、どのように石鹸のWebサービスを理解することです文字列の上に小さいこんにちはの世界を作って仕事をしてください。

ご協力ありがとうございます

よろしくお願いします。 Didier

答えて

0

test.wsdlにのような接頭辞「wsdl」を追加する必要があります。また、そのPARAM内の要素の最初のレベルまで:

<wsdl:types>...</wsdl:types> 
<wsdl:operation>...</wsdl:operation> 

...など

これは、WSDLをロードできるようになります。

+0

ありがとう、私はWSDLに到達できますが、私の名前空間 'urn:serviceTestwsdl'からserviceTestBindingリンクをインポートできないというエラーが表示されます。 –

+0

あなたは何らかのチュートリアルに従っていますか? [tutorialspoint](https://www.tutorialspoint.com/wsdl/wsdl_example.htm)を提案できますか? – sbrn

+0

今すぐご利用いただきありがとうございます!もしあなたがフランスに来たら、私はあなたにビールの大きな二重 –

関連する問題