Bonjour à tous,

J'ai voulu créer un web service de type SOAP depuis mon projet Symfony2, seulement je rencontre une erreur un peu tenace !

Dans mon contrôleur, j'ai tout d'abord créé la méthode 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
 
 public function indexAction()
    {
    	$server = new \SoapServer('http://localhost/citelis2/lib/Payline.wsdl');
    	$server->setObject($this->get('payline_service'));
    	$server->returnURL = 'http://www.payline.com/';
    	$server->cancelURL = 'http://www.payline.com/';
    	$server->notificationURL = '';
 
    	$response = new Response();
    	$response->headers->set('Content-Type', 'text/xml; charset=ISO-8859-1');
 
    	ob_start();
    	$server->handle();
    	$response->setContent(ob_get_clean());
 
    	return $response;
    }
Ensuite, toujours dans mon contrôleur, j'ai crée la méthode coté client :

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
 
 public function createAction()
    {
		...	
    	if ($request->getMethod() == 'POST') {    		
    	        $array = array();
    		$array['payment']['amount'] = $_POST['amount'];
    		$array['payment']['currency'] = $_POST['currency'];
    		$array['payment']['action'] = 101;
    		$array['payment']['mode'] = 'CPT';
    		$array['order']['ref'] = $_POST['ref'];
    		$array['order']['amount'] = $_POST['amount'];
    		$array['order']['currency'] = $_POST['currency'];
    		$array['payment']['contractNumber'] = '99999999';
    		$array['contracts'] = '99999999';
    		$array['secondContracts'] = '';
 
    		$client = new \Soapclient('http://localhost/example_lvl/web/app_dev.php/commande/soap?wsdl', true);
    		$result = $client->soapCall('doWebPayment',$array);
 
    		if(isset($result) && $result['result']['code'] == '00000'){
    			header("location:".$result['redirectURL']);
    			exit();
    		}
    		elseif(isset($result)) {
    			echo 'ERROR : '.$result['result']['code']. ' '.$result['result']['longMessage'].' <BR/>';
    		}
Lorsque j'exécute l'URL "http://localhost/example_lvl/web/app_dev.php/commande/soap?wsdl", j'ai bien mon fichier WSDL qui est retourné donc je suppose que la méthode coté serveur fonctionne correctement...

Cependant, à l'appel de la fonction "$client->soapCall('doWebPayment',$array);", je rencontre le message d'erreur suivant :

CRITICAL - Uncaught PHP Exception SoapFault: "SoapClient::SoapClient(): Invalid parameters" at E:\Workspace\example_website\src\Example\CommandeBundle\Controller\CommandeController.php line 182
Quelqu'un a-t-il déjà rencontré ce type d'erreur ?

Merci d'avance.