Skip to content

Instantly share code, notes, and snippets.

@kcassam
Last active June 28, 2019 09:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kcassam/669479c03dc46b21d1fb3b8a0aacf107 to your computer and use it in GitHub Desktop.
Save kcassam/669479c03dc46b21d1fb3b8a0aacf107 to your computer and use it in GitHub Desktop.
working soap example
<?php
/**
* Invocation simple à un Service WEB : la classe SoapClient() comporte des paramètres supplémentaires
* qui seront intéressants à étudier dans la documentation
*/
//On doit passer le fichier WSDL du Service en paramètre de l'objet SoapClient()
$wsdl="http://www.dneonline.com/calculator.asmx?wsdl";
$service=new SoapClient($wsdl);
//À partir de là, on peut déjà faire appel aux méthodes du service décrites dans le WSDL
$result = $service->Add(['intA' => 2, 'intB' => 3]);
//On renvoie le résutat de notre méthode, pour voir....
print_r($result);
/*******************************************************
Output :
devilbox@php-7.2.19 in /shared/httpd $ php soapdemo.php
stdClass Object
(
[AddResult] => 5
)
********************************************************/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment