0

mysql データベースからのデータを表示する Web サービスの作成を開始しました

この wsdl の何が問題なのかわかりません。C# で Web 参照を追加するとエラーが表示される

私はこのwsdlを使用します

<?xml version="1.0"?>
<!-- partie 1 : Definitions -->
<definitions      name="listeClient" 
    targetNamespace="urn:listeClient" 
    xmlns:typens="urn:listeClient" 
    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/">

    <!-- partie 2 : Types-->
    <types>
        <xsd:schema       xmlns="http://www.w3.org/2001/XMLSchema" 
            targetNamespace="urn:listeClient">
        </xsd:schema>
    </types> 


    <!-- partie 3 : Message -->
    <message name="rechercheResponse">
        <part name="return" type="xsd:string"/>
    </message>

    <!-- partie 4 : Port Type -->
    <portType name="listeClientPort">
        <!-- partie 5 : Operation -->
        <operation name="recherche">
            <output message="typens:rechercheResponse"/>
        </operation>
    </portType>

    <!-- partie 6 : Binding -->
    <binding name="listeClientBinding" type="typens:listeClientPort">
        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="recherche">
            <soap:operation soapAction="listeClientPortAction"/>
            <output name="rechercheResponse">
                <soap:body        use="encoded"       
                    namespace="urn:listeClient" 
                    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </output>
        </operation>
    </binding>

    <!-- partie 7 : Service -->
    <service name="listeClientService">
        <documentation>Recherche de produit dans la base </documentation>
        <!-- partie 8 : Port -->
        <port name="listeClientPort" binding="typens:listeClientBinding">
            <soap:address location="http://localhost/check-net/test/Serveur/server.php"/> <!-- modifier ce chemin vers server.php -->
        </port>
    </service>
</definitions>

クライアント側で c # 次のエラーが表示されます

Error 3 Error custom tool: Unable to import WebService / Schema. Unable to import binding 'listeClientBinding' from namespace 'urn: ClientList'. Operation 'search' on portType 'listeClientPort' from namespace 'urn:ClientList' has the following syntax error: The operation has no corresponding link. Check if the operation, input and output in the Binding section names correspond to the names of the PortType section.

php

<?php

// premiere etape : desactiver le cache lors de la phase de test
ini_set("soap.wsdl_cache_enabled", "0");

// on indique au serveur a quel fichier de description il est lie
$serveurSOAP = new SoapServer('clients.wsdl');

// ajouter la fonction RechercheProduit au serveur
$serveurSOAP->addFunction('recherche');
// lancer le serveur
if ($_SERVER['REQUEST_METHOD'] == 'POST')

{
        $serveurSOAP->handle();
}
else
{
        echo 'desole, je ne comprends pas les requetes GET, veuillez seulement utiliser POST';
}


    function connexion($server, $user, $pswr, $base)
    {
        mysql_connect($server, $user, $pswr);
        mysql_select_db($base);
    }

    function recherche()
{
connexion("localhost","root","","test");
$Rq="select Nomc,Prenomc,Adresse,codePostale from client";
$Resultat=mysql_query($Rq);
$XML="<clients>";
while($clt=mysql_fetch_array($Resultat)) 
$XML.="<client>
<Nomc>".$clt["Nomc"]."</Nomc>
<Prenomc>".$clt["Prenomc"]."</Prenomc>
<Adresse>".$clt["Adresse"]."</Adresse>
<codePostale>".$clt["codePostale"]."</codePostale>
</client>";
$XML.="</clients>";
echo $XML;
return($Resultat);
}

?>
4

0 に答える 0