verbeyst
Messages postés77Date d'inscriptionmardi 10 mars 2009StatutMembreDernière intervention15 février 2011
-
24 févr. 2009 à 17:12
thedarkkillerz
Messages postés18Date d'inscriptionsamedi 3 juillet 2004StatutMembreDernière intervention21 juin 2010
-
21 juin 2010 à 11:56
J'ai une question concernant les web services en php.
Le bout de code ci-après fonctionne bien quand je fait un appel client, il s'agit d'une version sans configuration du WSDL.
Par contre lorsque j'essaie de configurer le WSDL, je n'ai plus rien.
Ma méthode getListOfPatients(...) exposée par mon web service ne me retourne que "Array".
VERSION sans WSDL
------------------------
<?php
//importation de la librairie nuSOAP
require_once('nusoap/lib/nusoap.php');
// On crée un objet soap server
$server = new soap_server;
$server->register('getListofPatientsGP');
// Implémentation de la méthode web
// Cette méthode retourne la liste des Code Patient liés au médecin traitant dont le codeInami est
// passé en paramètre
function getListofPatientsGP($codeInami)
{
include ("connexion.php");
$codeInami=substr($codeInami,0,6); // abcd
if ($conn==false)
{return new soap_fault("Server", "Oracle", "echec connexion");
Dans cet exemple, la fonction exposée a le type de retour "ChapterArray"
Ligne de config NuSoap:
array('return' => 'tns:ChapterArray'),
Exemple:
//Déclaration du type complexe
$server->wsdl->addComplexType(
'Chapter',
'complexType',
'struct',
'all',
'',
array(
'title' => array('name'=>'title','type'=>'xsd:string'),
'page' => array('name'=>'page','type'=>'xsd:int')
)
);
//Déclaration du type complexe en version Array
$server->wsdl->addComplexType(
'ChapterArray',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:Chapter[]')
),
'tns:Chapter'
);