Précédent   Forum des professionnels en informatique > PHP > Bibliothèques et frameworks > Services Web
Services Web Forum d'entraide pour les services Web en PHP, qui permettent de créer et de consommer facilement des webservices (génération de WSDL etc.). Exemples : SOAP, NuSOAP, REST, SCA-SDO... Avant de poster -> Cours webservices
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 15/04/2011, 11h36   #1
Membre confirmé
 
Avatar de liquideshark
 
Homme Jamal H Tour
Chercheur en informatique
Inscription : septembre 2006
Messages : 317
Détails du profil
Informations personnelles :
Nom : Homme Jamal H Tour
Localisation : Maroc

Informations professionnelles :
Activité : Chercheur en informatique
Secteur : Service public

Informations forums :
Inscription : septembre 2006
Messages : 317
Points : 243
Points : 243
Par défaut client php webservice

Salut,

J'ai un petit souci d’envoie de paramètre à travers un client php à mon webservice. j'ai un petit

Code :
1
2
3
4
5
 
helloword(string el1){ 
  return "HELLO and welcome "+el1;
 
}
sur mon serveur wsdl.

sur mon client en php j'ai essayé de faire comme suit :

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
 
try{
 
$param=array('el1'=>'15.00');
$outputws= $client->__call('helloWord', $param);
 
 
 
// echo $outputws;
echo $outputws->return;
 
 } catch (SoapFault $exception) {
    echo $exception;
  }
et ca ne marche pas

ps: je suis en php

Merci d'avance
__________________
===================================
===Accroche ta charrue à l'Open source===
===================================
liquideshark est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 16/04/2011, 00h52   #2
Membre émérite
 
Avatar de vorace
 
Homme
Développeur
Inscription : août 2010
Messages : 587
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France, Meurthe et Moselle (Lorraine)

Informations professionnelles :
Activité : Développeur

Informations forums :
Inscription : août 2010
Messages : 587
Points : 861
Points : 861
ta fonction sur ton serveur wsdl n'a pas de majuscule au mot world :
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
try{
 
$param=array('el1'=>'15.00');
$outputws= $client->__call('helloword', $param);
 
 
 
// echo $outputws;
echo $outputws->return;
 
 } catch (SoapFault $exception) {
    echo $exception;
  }
__________________
Développeur informatique contrarié...
vorace est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 16/04/2011, 06h37   #3
Membre confirmé
 
Avatar de liquideshark
 
Homme Jamal H Tour
Chercheur en informatique
Inscription : septembre 2006
Messages : 317
Détails du profil
Informations personnelles :
Nom : Homme Jamal H Tour
Localisation : Maroc

Informations professionnelles :
Activité : Chercheur en informatique
Secteur : Service public

Informations forums :
Inscription : septembre 2006
Messages : 317
Points : 243
Points : 243
salut vorace, et merci d'avance. La reponse à ta question est non :
Sur mon serveur j'ai ceci :
Code :
1
2
3
4
5
 
string helloword(string el1){ 
  return "HELLO and welcome "+el1;
 
}
vous n'auriez pas un exemple simple en php qui envoie en paramètre un string utilisant soapclient ?

Merci
__________________
===================================
===Accroche ta charrue à l'Open source===
===================================
liquideshark est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 16/04/2011, 12h25   #4
Membre émérite
 
Avatar de vorace
 
Homme
Développeur
Inscription : août 2010
Messages : 587
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France, Meurthe et Moselle (Lorraine)

Informations professionnelles :
Activité : Développeur

Informations forums :
Inscription : août 2010
Messages : 587
Points : 861
Points : 861
c'est ce que je disais et toi dans ton code php tu appelles la fonction avec une majuscule à 'world', voici ton code :
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
try{
 
$param=array('el1'=>'15.00');
$outputws= $client->__call('helloWord', $param);
 
 
 
// echo $outputws;
echo $outputws->return;
 
 } catch (SoapFault $exception) {
    echo $exception;
  }
__________________
Développeur informatique contrarié...
vorace est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 18/04/2011, 10h05   #5
Membre confirmé
 
Avatar de liquideshark
 
Homme Jamal H Tour
Chercheur en informatique
Inscription : septembre 2006
Messages : 317
Détails du profil
Informations personnelles :
Nom : Homme Jamal H Tour
Localisation : Maroc

Informations professionnelles :
Activité : Chercheur en informatique
Secteur : Service public

Informations forums :
Inscription : septembre 2006
Messages : 317
Points : 243
Points : 243
Salut vorace,

merci pour ta réponse. Même avec W ça ne change rien:

J'ai essayé de modifier le code comme suis :

Code :
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
<?php
echo "code @ JAmal";

// première étape : désactiver le cache lors de la phase de test
ini_set("soap.wsdl_cache_enabled", "0");
?><br><?php echo "=========1=========== ";

// lier le client au fichier WSDL
$client = new SoapClient('http://localhost:8084/CalculatorWSApplication/CalculatorWS?wsdl',
    array(
      "trace"      => 1,        // enable trace to view what is happening
      "exceptions" => 0,        // disable exceptions
      "cache_wsdl" => 0)         // disable any caching on the wsdl, encase you alter the wsdl server
  );
?><br><?php echo "=========2========== ";
?><br><?php

// executer la methode getHello

$outputws = $client->helloword('Royce Rolls');

// echo $outputws;
echo $outputws->return;
?><br><?php

echo "===============================";

?>
j'obtiens "HELLO and welcome null" sur ma page. ça ne marche pas. Es ce la manière d'écrire ? comment puis -je faire marcher un exemple aussi simple ?
__________________
===================================
===Accroche ta charrue à l'Open source===
===================================
liquideshark est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 18/04/2011, 12h08   #6
Membre émérite
 
Avatar de vorace
 
Homme
Développeur
Inscription : août 2010
Messages : 587
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France, Meurthe et Moselle (Lorraine)

Informations professionnelles :
Activité : Développeur

Informations forums :
Inscription : août 2010
Messages : 587
Points : 861
Points : 861
et si tu fais :
Code :
echo '<pre>', $outputws, '</pre>';
ça donne quoi ?
__________________
Développeur informatique contrarié...
vorace est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 18/04/2011, 15h22   #7
Membre confirmé
 
Avatar de liquideshark
 
Homme Jamal H Tour
Chercheur en informatique
Inscription : septembre 2006
Messages : 317
Détails du profil
Informations personnelles :
Nom : Homme Jamal H Tour
Localisation : Maroc

Informations professionnelles :
Activité : Chercheur en informatique
Secteur : Service public

Informations forums :
Inscription : septembre 2006
Messages : 317
Points : 243
Points : 243
toujours rien , jai la même reponse
__________________
===================================
===Accroche ta charrue à l'Open source===
===================================
liquideshark est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 02/05/2011, 14h58   #8
En attente de confirmation mail
 
Étudiant
Inscription : avril 2011
Messages : 19
Détails du profil
Informations personnelles :
Localisation : France, Meurthe et Moselle (Lorraine)

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : avril 2011
Messages : 19
Points : 34
Points : 34
Code :
1
2
3
4
string helloword(string el1){ 
  return "HELLO and welcome "+el1;
 
}
Si c'est du PHP, la concaténation de chaine c'est le .

Code :
1
2
3
4
string helloword(string el1){ 
  return "HELLO and welcome ".el1;
 
}
dev_cisii est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 02/05/2011, 15h50   #9
Modérateur
 
Inscription : septembre 2010
Messages : 7 103
Détails du profil
Informations forums :
Inscription : septembre 2010
Messages : 7 103
Points : 8 466
Points : 8 466
oublie pas c'est :
Code :
$outputws= $client->helloWord($param);
le SOAP c'est pour ça, inutile de faire via un call
__________________
http://blog.stealth35.com/
stealth35 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 03h09.


 
 
 
 
Partenaires

Hébergement Web