IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Bibliothèques et frameworks PHP Discussion :

[Web Service] recherche exécution service web sous php


Sujet :

Bibliothèques et frameworks PHP

  1. #1
    Nouveau Candidat au Club
    Inscrit en
    Juin 2013
    Messages
    4
    Détails du profil
    Informations forums :
    Inscription : Juin 2013
    Messages : 4
    Points : 1
    Points
    1
    Par défaut [Web Service] recherche exécution service web sous php
    salut, je cherche un exemple complet (et exécution) d'un service web sous php.
    J'ai essayé WS: Hello et il ne marche pas avec le fichier client.php

    tout mon site est hébergé gratuitement sur mon domaine.
    quels options à modifier pour permettre l'exécution? et quel est l'affichage correct des fichiers,? merci

  2. #2
    Nouveau Candidat au Club
    Inscrit en
    Juin 2013
    Messages
    4
    Détails du profil
    Informations forums :
    Inscription : Juin 2013
    Messages : 4
    Points : 1
    Points
    1
    Par défaut
    http://uprapide.com/image/546323-wsdl

    fichier HelloYou.wsdl
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    <?xml version="1.0"?>
    <!-- partie 1 : Definitions -->
    <definitions    name="HelloYou" 
                    targetNamespace="urn:HelloYou" 
                    xmlns:typens="urn:HelloYou" 
                    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:HelloYou">
            </xsd:schema>
     </types> 
     
     
            <!-- partie 3 : Message -->
            <message name="getHelloRequest">
                    <part name="prenom" type="xsd:string"/>
                    <part name="nom" type="xsd:string"/>
            </message>
            <message name="getHelloResponse">
                    <part name="return" type="xsd:string"/>
            </message>
     
            <!-- partie 4 : Port Type -->
            <portType name="HelloYouPort">
                    <!-- partie 5 : Operation -->
                    <operation name="getHello">
                            <input message="typens:getHelloRequest"/>
                            <output message="typens:getHelloResponse"/>
                    </operation>
            </portType>
     
            <!-- partie 6 : Binding -->
            <binding name="HelloYouBinding" type="typens:HelloYouPort">
                    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
                    <operation name="getHello">
                            <soap:operation soapAction="HelloYouAction"/>
                            <input name="getHelloRequest">
                                    <soap:body      use="encoded"   
                                                    namespace="urn:HelloYou"        
                                                    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
                            </input>
                            <output name="getHelloResponse">
                                    <soap:body      use="encoded"   
                                                    namespace="urn:HelloYou" 
                                                    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
                            </output>
                    </operation>
            </binding>
     
            <!-- partie 7 : Service -->
            <service name="HelloYouService">
                    <documentation>Retourne une phrase simple </documentation>
                    <!-- partie 8 : Port -->
                    <port name="HelloYouPort" binding="typens:HelloYouBinding">
                            <soap:address location="http://ecommercetunisie.netne.net/server.php"/> <!-- modifier ce chemin vers server.php -->
                    </port>
            </service>
    </definitions>

  3. #3
    Nouveau Candidat au Club
    Inscrit en
    Juin 2013
    Messages
    4
    Détails du profil
    Informations forums :
    Inscription : Juin 2013
    Messages : 4
    Points : 1
    Points
    1
    Par défaut
    http://uprapide.com/image/546325-serveur_9

    fichier serveur.php
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    <?php
     
    // première étape : désactiver le cache lors de la phase de test
    ini_set("soap.wsdl_cache_enabled", "0");
     
    // on indique au serveur à quel fichier de description il est lié
    $serveurSOAP = new SoapServer('HelloYou.wsdl');
     
    // ajouter la fonction getHello au serveur
    $serveurSOAP->addFunction('getHello');
     
    // lancer le serveur
    if ($_SERVER['REQUEST_METHOD'] == 'POST')
     
    {
    	$serveurSOAP->handle();
    }
    else
    {
    	echo 'désolé, je ne comprends pas les requêtes GET, veuillez seulement utiliser POST';
    }
     
    function getHello($prenom, $nom)
    {
    	return 'Hello ' . $prenom . ' ' . $nom;
    }
    ?>

  4. #4
    Nouveau Candidat au Club
    Inscrit en
    Juin 2013
    Messages
    4
    Détails du profil
    Informations forums :
    Inscription : Juin 2013
    Messages : 4
    Points : 1
    Points
    1
    Par défaut
    http://uprapide.com/image/546326-client_10

    fichier client.php

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    <?php
     
    // première étape : désactiver le cache lors de la phase de test
    ini_set("soap.wsdl_cache_enabled", "0");
     
    // lier le client au fichier WSDL
    $clientSOAP = new SoapClient('HelloYou.wsdl');
     
    // executer la methode getHello
    echo $clientSOAP->getHello('Marc','Assin');
     
    ?>

Discussions similaires

  1. Exécution de Shell sous php
    Par chivie dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 0
    Dernier message: 16/03/2018, 10h53
  2. Réponses: 1
    Dernier message: 01/10/2015, 12h19
  3. probleme de rechercher dans un site web sous php
    Par fleurrouge dans le forum Langage
    Réponses: 0
    Dernier message: 15/09/2015, 10h12
  4. [Web Service] paramétrer mon web service soap sous php
    Par yanis3021 dans le forum Bibliothèques et frameworks
    Réponses: 0
    Dernier message: 05/11/2014, 16h01
  5. [Web Service] SOAP en php-cli sous win
    Par vallica dans le forum Bibliothèques et frameworks
    Réponses: 3
    Dernier message: 12/09/2008, 10h03

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo