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] Connexion à mon service web


Sujet :

Bibliothèques et frameworks PHP

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Janvier 2004
    Messages
    53
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2004
    Messages : 53
    Points : 47
    Points
    47
    Par défaut [Web Service] Connexion à mon service web
    Bonjour,

    Je me suis créer un web service avec le wsdl qui va avec. Mais malheureusement, ça ne fonctionne pas. Si vous pouvez m'aider ou me donner des pistes ce serait sympa.

    Et je comprends pas d'ou cela peut venir surment du wsdl je pense

    Merci d'avance pour votre aide

    Voilà mon message d'erreur :
    Code x : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    Warning: SoapClient::SoapClient(http://localhost/scramble.wsdl) [function.SoapClient-SoapClient]: failed to open stream: Une tentative de connexion a échoué car le parti connecté n'a pas répondu convenablement au-delà d'une certaine durée ou une connexion établie a échoué car l'hôte de connexion n'a pas répondu. in C:\web_root\none\client.php on line 4
    
    Warning: SoapClient::SoapClient() [function.SoapClient-SoapClient]: I/O warning : failed to load external entity "http://localhost/scramble.wsdl" in C:\web_root\none\client.php on line 4
    
    Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://localhost/scramble.wsdl' in C:\web_root\none\client.php:4 Stack trace: #0 C:\web_root\none\client.php(4): SoapClient->SoapClient('http://localhos...', Array) #1 {main} thrown in C:\web_root\none\client.php on line 4

    Voilà mon code client :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
     
    ini_set('soap.wsdl_cache_enabled', '3');
    $client = new SoapClient('http://localhost/scramble.wsdl');
    $test=$client->Insertion(2,'hiiih',99);
    echo $test;
    $client-> __getLastRequest;
    Mon code serveur :
    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
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
     
    <?php
     
    class Produit extends SoapServer {
        Private function ConnexionBdd (){
     
            $connexion=mysql_connect('localhost','root','');
            if ($connexion)
            {
                if (mysql_select_db('test'))
                {
                    return true;
                    exit();
                }
            }
            return false;        
        }
        function Insertion ($type, $nomproduit, $gabarit) {
     
            $connect=$this->ConnexionBdd();
            if ($connect=true)
            {            
                $req=mysql_query('INSERT INTO PRODUIT (NomProduit, Type, Gabarit) VALUES(\''.$nomProduit.'\', '.$type.','.$gabarit.')');
                return true;
            }
            else
            {
            return false;
            }
        }
        function MAJ ($id, $type, $nomproduit, $gabarit) {
            $connect=$this->ConnexionBdd();
            if ($connect=true)
            {    
            echo "UPDATE PRODUIT SET NomProduit='".$nomproduit."',Type=".$type.",Gabarit=".$gabarit." where id=$id";
                $req=mysql_query("UPDATE PRODUIT SET NomProduit='".$nomproduit."',Type=".$type.",Gabarit=".$gabarit." where id=$id");
                return true;
            }
            else
            {
            return false;
            }
        }
    }
     
    ini_set('soap.wsdl_cache_enabled', '0');
    $server = new Produit('scramble.wsdl');
    $server->handle();
     
    ?>
    Le WSDL qui va avec :
    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
    65
    66
    67
    68
    69
    70
    <?xml version ='1.0' encoding ='UTF-8' ?>
    <definitions name='Scramble' 
      targetNamespace='http://localhost/scramble.wsdl' 
      xmlns:tns='http://localhost/scramble.wsdl' 
      xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' 
      xmlns='http://schemas.xmlsoap.org/wsdl/'> 
     
    <message name='Insertion'> 
      <part name='type' type='xsd:int'/>
      <part name='NomProduit' type='xsd:string'/>
      <part name='gabarit' type='xsd:int'/>  
    </message> 
    <message name='InsertionResponse'> 
      <part name='result' type='xsd:boolean'/> 
    </message> 
     
    <message name='MAJ'> 
      <part name='idMAJ' type='xsd:int'/>
      <part name='type' type='xsd:int'/>
      <part name='NomProduit' type='xsd:string'/>
      <part name='gabarit' type='xsd:int'/>  
    </message> 
    <message name='MAJResponse'> 
      <part name='result' type='xsd:boolean'/> 
    </message> 
     
    <portType name='ScramblePortType'> 
      <operation name='Insertion'  parameterOrder='type NomProduit gabarit'>
        <input message='tns:Insertion'/> 
        <output message='tns:InsertionResponse'/>   
      </operation>
      <operation name='MAJ'  parameterOrder='idMAJ type NomProduit gabarit'>
        <input message='tns:MAJ'/> 
        <output message='tns:MAJResponse'/>   
      </operation>    
    </portType>
     
    <binding name='ScrambleBinding' type='tns:ScramblePortType'> 
      <soap:binding style='rpc' 
        transport='http://schemas.xmlsoap.org/soap/http'/> 
      <operation name='Insertion'> 
        <soap:operation soapAction='http://localhost/'/> 
        <input> 
          <soap:body use='encoded' namespace='http://localhost/' 
            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/> 
        </input> 
        <output> 
          <soap:body use='encoded' namespace='http://localhost/'' 
            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/> 
        </output> 
      </operation>
      <operation name='MAJ'> 
        <soap:operation soapAction='http://localhost/'/> 
        <input> 
          <soap:body use='encoded' namespace='http://localhost/' 
            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/> 
        </input> 
        <output> 
          <soap:body use='encoded' namespace='http://localhost' 
            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/> 
        </output> 
      </operation>       
    </binding> 
     
    <service name='ScrambleService'> 
      <port name='ScramblePort' binding='ScrambleBinding'> 
        <soap:address location='http://localhost/serverWS.php'/> 
      </port> 
    </service>
    </definitions>

  2. #2
    Expert éminent sénior
    Avatar de mathieu
    Profil pro
    Inscrit en
    Juin 2003
    Messages
    10 235
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2003
    Messages : 10 235
    Points : 15 532
    Points
    15 532
    Par défaut
    est ce que l'URL http://localhost/scramble.wsdl est accessible dans un navigateur ?

  3. #3
    Membre du Club
    Profil pro
    Inscrit en
    Janvier 2004
    Messages
    53
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2004
    Messages : 53
    Points : 47
    Points
    47
    Par défaut
    Bonjour Mathieu,

    oui il me le propose en téléchargement.


    une idée d'ou ça peut venir ?

  4. #4
    Membre du Club
    Profil pro
    Inscrit en
    Janvier 2004
    Messages
    53
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2004
    Messages : 53
    Points : 47
    Points
    47
    Par défaut
    Le pbl a été résolu le code PHP ne voyait pas l'adresse http://localhost/.

    Je l'ai seulement remplacé par 127.0.0.1 pour résoudre le pbl

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 16
    Dernier message: 05/06/2008, 11h32
  2. connexion à mon serveur ftp impossible ?
    Par petitclem dans le forum Distributions
    Réponses: 0
    Dernier message: 28/05/2008, 10h39
  3. erreur de connexion à mon application
    Par paolo2002 dans le forum Tomcat et TomEE
    Réponses: 2
    Dernier message: 14/03/2008, 15h27
  4. [IIS 5.1] Connexion à mon IIS via un routeur
    Par Golzinne dans le forum IIS
    Réponses: 0
    Dernier message: 23/12/2007, 01h07
  5. Problème de connexion à mon instance SQL Server
    Par Amokrane dans le forum MS SQL Server
    Réponses: 5
    Dernier message: 20/12/2007, 16h16

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