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 :

Script PHP Wsdl2Php


Sujet :

Bibliothèques et frameworks PHP

  1. #1
    Membre à l'essai
    Profil pro
    Inscrit en
    Février 2007
    Messages
    18
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Février 2007
    Messages : 18
    Points : 16
    Points
    16
    Par défaut Script PHP Wsdl2Php
    Salut à tous,

    J'ai un petit soucis, enfaite j'ai des webservices qui développé en C# avec
    un fichier WSDL

    Je veux consommer mes webservice avec du PHP et donc du coup j'ai besoin
    de générer des classes automatique avec mon fichier WSDL

    Cependant j'ai du mal pour y arriver, j'essaye d'utiliser les scripts wsdl2Php ou wsdlInterpreter (http://www.mehtanirav.com/2009/01/28...om-a-wsdl-file) ... mais je n'y arrive pas du tout

    Est ce que quelqu'un a deja utilisé ces scripts PHP ?

    Merci d'avance

  2. #2
    Invité
    Invité(e)
    Par défaut
    Salut,

    quels problèmes rencontres-tu? Quelles sont erreurs que tu as?

  3. #3
    Membre à l'essai
    Profil pro
    Inscrit en
    Février 2007
    Messages
    18
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Février 2007
    Messages : 18
    Points : 16
    Points
    16
    Par défaut
    Salut,

    Ben enfaite je sais pas du tout comment utiliser wsdl2php
    En ce qui concerne wsdlInterpreter, j'essaye d'utiliser les méthode public
    du script php, mais j'ai droit a des erreurs :s

    Par contre, je suis tombé sur ce site : http://labs.wso2.org/wsf/php/wsdl2phptool.php qui permet d'utiliser en ligne le script wsdl2php, donc je met mon fichier sur un hebergeur pour essayer de générer ma classe, mais du coup j'ai des erreur de chargement :s

    Est ce qu'il faut mon serveur qui fournit mes webservice soit aussi en ligne pour la génération ?

  4. #4
    Invité
    Invité(e)
    Par défaut
    Peux-tu copier les erreurs que tu as? peux-tu montrer le wsdl?
    Dernière modification par sabotage ; 25/12/2009 à 22h56. Motif: citation inutile

  5. #5
    Membre à l'essai
    Profil pro
    Inscrit en
    Février 2007
    Messages
    18
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Février 2007
    Messages : 18
    Points : 16
    Points
    16
    Par défaut
    Salut,

    Voila mon fichier wsdl : http://e-sponsor.eu/images/test/LoudoTek.xml

    Et voila l'erreur que j'ai avec wsdl2php (http://labs.wso2.org/wsf/php/wsdl2phptool.php) :

    <br />
    <b>Warning</b>: file_get_contents(http://localhost:1664/LoudoTek?xsd=xsd0) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: Connection refused in <b>/home/dimuthu/software/wso2-wsf-php-src-2.0.0/scripts/dynamic_invocation/wsf_wsdl_util.php</b> on line <b>1329</b><br />
    <br />
    <b>Warning</b>: DOMDocument::loadXML() [<a href='function.DOMDocument-loadXML'>function.DOMDocument-loadXML</a>]: Empty string supplied as input in <b>/home/dimuthu/software/wso2-wsf-php-src-2.0.0/scripts/dynamic_invocation/wsf_wsdl_util.php</b> on line <b>1330</b><br />
    <br />
    <b>Warning</b>: file_get_contents(http://localhost:1664/LoudoTek?xsd=xsd1) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: Connection refused in <b>/home/dimuthu/software/wso2-wsf-php-src-2.0.0/scripts/dynamic_invocation/wsf_wsdl_util.php</b> on line <b>1329</b><br />
    <br />
    <b>Warning</b>: DOMDocument::loadXML() [<a href='function.DOMDocument-loadXML'>function.DOMDocument-loadXML</a>]: Empty string supplied as input in <b>/home/dimuthu/software/wso2-wsf-php-src-2.0.0/scripts/dynamic_invocation/wsf_wsdl_util.php</b> on line <b>1330</b><br />
    <br />
    <b>Warning</b>: file_get_contents(http://localhost:1664/LoudoTek?xsd=xsd2) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: Connection refused in <b>/home/dimuthu/software/wso2-wsf-php-src-2.0.0/scripts/dynamic_invocation/wsf_wsdl_util.php</b> on line <b>1329</b><br />
    <br />
    <b>Warning</b>: DOMDocument::loadXML() [<a href='function.DOMDocument-loadXML'>function.DOMDocument-loadXML</a>]: Empty string supplied as input in <b>/home/dimuthu/software/wso2-wsf-php-src-2.0.0/scripts/dynamic_invocation/wsf_wsdl_util.php</b> on line <b>1330</b><br />
    <br />
    <b>Warning</b>: file_get_contents(http://localhost:1664/LoudoTek?xsd=xsd0) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: Connection refused in <b>/home/dimuthu/software/wso2-wsf-php-src-2.0.0/scripts/dynamic_invocation/wsf_wsdl_util.php</b> on line <b>1329</b><br />
    <br />
    <b>Warning</b>: DOMDocument::loadXML() [<a href='function.DOMDocument-loadXML'>function.DOMDocument-loadXML</a>]: Empty string supplied as input in <b>/home/dimuthu/software/wso2-wsf-php-src-2.0.0/scripts/dynamic_invocation/wsf_wsdl_util.php</b> on line <b>1330</b><br />
    <br />
    <b>Warning</b>: file_get_contents(http://localhost:1664/LoudoTek?xsd=xsd1) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: Connection refused in <b>/home/dimuthu/software/wso2-wsf-php-src-2.0.0/scripts/dynamic_invocation/wsf_wsdl_util.php</b> on line <b>1329</b><br />
    <br />
    <b>Warning</b>: DOMDocument::loadXML() [<a href='function.DOMDocument-loadXML'>function.DOMDocument-loadXML</a>]: Empty string supplied as input in <b>/home/dimuthu/software/wso2-wsf-php-src-2.0.0/scripts/dynamic_invocation/wsf_wsdl_util.php</b> on line <b>1330</b><br />
    <br />
    <b>Warning</b>: file_get_contents(http://localhost:1664/LoudoTek?xsd=xsd2) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: Connection refused in <b>/home/dimuthu/software/wso2-wsf-php-src-2.0.0/scripts/dynamic_invocation/wsf_wsdl_util.php</b> on line <b>1329</b><br />
    <br />
    <b>Warning</b>: DOMDocument::loadXML() [<a href='function.DOMDocument-loadXML'>function.DOMDocument-loadXML</a>]: Empty string supplied as input in <b>/home/dimuthu/software/wso2-wsf-php-src-2.0.0/scripts/dynamic_invocation/wsf_wsdl_util.php</b> on line <b>1330</b><br />
    <br />
    <b>Warning</b>: XSLTProcessor::transformToDoc(http://localhost:1664/LoudoTek?xsd=xsd0) [<a href='function.XSLTProcessor-transformToDoc'>function.XSLTProcessor-transformToDoc</a>]: failed to open stream: Connection refused in <b>/home/dimuthu/software/wso2-wsf-php-src-2.0.0/scripts/dynamic_invocation/wsf_wsdl_util.php</b> on line <b>222</b><br />
    <br />
    <b>Warning</b>: XSLTProcessor::transformToDoc() [<a href='function.XSLTProcessor-transformToDoc'>function.XSLTProcessor-transformToDoc</a>]: I/O warning : failed to load external entity &quot;http://localhost:1664/LoudoTek?xsd=xsd0&quot; in <b>/home/dimuthu/software/wso2-wsf-php-src-2.0.0/scripts/dynamic_invocation/wsf_wsdl_util.php</b> on line <b>222</b><br />
    <br />
    <b>Warning</b>: XSLTProcessor::transformToDoc(http://localhost:1664/LoudoTek?xsd=xsd1) [<a href='function.XSLTProcessor-transformToDoc'>function.XSLTProcessor-transformToDoc</a>]: failed to open stream: Connection refused in <b>/home/dimuthu/software/wso2-wsf-php-src-2.0.0/scripts/dynamic_invocation/wsf_wsdl_util.php</b> on line <b>222</b><br />
    <br />
    <b>Warning</b>: XSLTProcessor::transformToDoc() [<a href='function.XSLTProcessor-transformToDoc'>function.XSLTProcessor-transformToDoc</a>]: I/O warning : failed to load external entity &quot;http://localhost:1664/LoudoTek?xsd=xsd1&quot; in <b>/home/dimuthu/software/wso2-wsf-php-src-2.0.0/scripts/dynamic_invocation/wsf_wsdl_util.php</b> on line <b>222</b><br />
    <br />
    <b>Warning</b>: XSLTProcessor::transformToDoc(http://localhost:1664/LoudoTek?xsd=xsd2) [<a href='function.XSLTProcessor-transformToDoc'>function.XSLTProcessor-transformToDoc</a>]: failed to open stream: Connection refused in <b>/home/dimuthu/software/wso2-wsf-php-src-2.0.0/scripts/dynamic_invocation/wsf_wsdl_util.php</b> on line <b>222</b><br />
    <br />
    <b>Warning</b>: XSLTProcessor::transformToDoc() [<a href='function.XSLTProcessor-transformToDoc'>function.XSLTProcessor-transformToDoc</a>]: I/O warning : failed to load external entity &quot;http://localhost:1664/LoudoTek?xsd=xsd2&quot; in <b>/home/dimuthu/software/wso2-wsf-php-src-2.0.0/scripts/dynamic_invocation/wsf_wsdl_util.php</b> on line <b>222</b><br />
    <?php

    try {

    // create client in WSDL mode
    $client = new WSClient(array ("wsdl" =>"http://e-sponsor.eu/images/test/LoudoTek.xml",
    ));

    // get proxy object reference form client
    $proxy = $client->getProxy();

    // create input object and set values
    //TODO: fill $input with (data type: anyType) data to match your business logic

    // call the operation
    $response = $proxy->Add($input);
    //TODO: Implement business logic to consume $response, which is of type anyType

    //TODO: fill $input with (data type: anyType) data to match your business logic

    // call the operation
    $response = $proxy->Substract($input);
    //TODO: Implement business logic to consume $response, which is of type anyType

    //TODO: fill $input with (data type: anyType) data to match your business logic

    // call the operation
    $response = $proxy->Multiply($input);
    //TODO: Implement business logic to consume $response, which is of type anyType

    //TODO: fill $input with (data type: anyType) data to match your business logic

    // call the operation
    $response = $proxy->PrendreListeJeuxVideos($input);
    //TODO: Implement business logic to consume $response, which is of type anyType

    //TODO: fill $input with (data type: anyType) data to match your business logic

    // call the operation
    $response = $proxy->Test($input);
    //TODO: Implement business logic to consume $response, which is of type anyType

    } catch (Exception $e) {
    // in case of an error, process the fault
    if ($e instanceof WSFault) {
    printf("Soap Fault: %s\n", $e->Reason);
    } else {
    printf("Message = %s\n", $e->getMessage());
    }
    }
    ?>
    A savoir toujours, que lorsque j'essaye de générer ma classe PHP avec le fichier WSDL, j'essaye de le faire uniquement avec le fichier WSDL, c'est à dire que mon serveur quoi fournit mes webservice n'est pas accessible

    Merci

  6. #6
    Invité
    Invité(e)
    Par défaut
    Salut,

    La génération du client soap foire justement parce qu'il essaie d'accéder aux schemas que tu as définis dans ton wsdl.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
    ~$ wsdl2php LoudoTek.xml
    Warning: SoapClient::SoapClient(http://localhost:1664/LoudoTek?xsd=xsd0): failed to open stream: Connection refused in /usr/share/php/wsdl2php.php on line 32
    Warning: SoapClient::SoapClient(): I/O warning : failed to load external entity "http://localhost:1664/LoudoTek?xsd=xsd0" in /usr/share/php/wsdl2php.php on line 32
    SoapFault exception: [WSDL] SOAP-ERROR: Parsing Schema: can't import schema from 'http://localhost:1664/LoudoTek?xsd=xsd0' in /usr/share/php/wsdl2php.php:32
    Stack trace:
    #0 /usr/share/php/wsdl2php.php(32): SoapClient->SoapClient('LoudoTek.xml')
    En mettant donc la définition de tes schemas en commentaire dans le wsdl
    j'ai pu générer le client soap php.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
      4 <!--
      5                 <xsd:schema targetNamespace="<a href="http://tempuri.org/Imports" target="_blank">http://tempuri.org/Imports</a>">
      6                         <xsd:import schemaLocation="<a href="http://localhost:1664/LoudoTek?xsd=xsd0" target="_blank">http://localhost:1664/LoudoTek?xsd=xsd0</a>" namespace="<a href="http://tempuri.org/"/><xsd:import" target="_blank">http://tempuri.org/"/><xsd:import</a> schemaLocation=    "<a href="http://localhost:1664/LoudoTek?xsd=xsd1" target="_blank">http://localhost:1664/LoudoTek?xsd=xsd1</a>" namespace="<a href="http://schemas.microsoft.com/2003/10/Serialization/"/" target="_blank">http://schemas.microsoft.com/2003/10/Serialization/"/</a>>
      7                         <xsd:import schemaLocation="<a href="http://localhost:1664/LoudoTek?xsd=xsd2" target="_blank">http://localhost:1664/LoudoTek?xsd=xsd2</a>" namespace="<a href="http://schemas.datacontract.org/2004/07/LoudoTek" target="_blank">http://schemas.datacontract.org/2004/07/LoudoTek</a>"    />
      8                 </xsd:schema>
      9 -->
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    $ wsdl2php LoudoTek.xml
    Writing LoudoTek.php...ok
    Mais bon de cette manière, nous n'avons de validation sur base du schemas que tu as définis



    Tu trouveras en pièce jointe la classe php générée à partir de ton wsdl
    Fichiers attachés Fichiers attachés

  7. #7
    Membre à l'essai
    Profil pro
    Inscrit en
    Février 2007
    Messages
    18
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Février 2007
    Messages : 18
    Points : 16
    Points
    16
    Par défaut
    Salut,

    Merci de ton coup de main

    Mais est ce que tu crois que le fait de générer la classe sans la validation xml schema poserais des problèmes ?

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

Discussions similaires

  1. [MySQL] Optimisation de scripts PHP/MySQL
    Par DgG dans le forum PHP & Base de données
    Réponses: 368
    Dernier message: 20/11/2013, 18h59
  2. Quel est le meilleur script PHP de portail (CMS) ?
    Par Lana.Bauer dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 187
    Dernier message: 18/10/2012, 07h45
  3. Exécution script php
    Par devmat dans le forum Linux
    Réponses: 11
    Dernier message: 22/04/2007, 11h14
  4. Pb d'execution de requete avec un script php
    Par ythierrin dans le forum Requêtes
    Réponses: 3
    Dernier message: 22/08/2003, 14h34

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