SOAP: Difference between revisions

From Rosetta Code
Content added Content deleted
(initial import of php soap client example)
 
Line 2: Line 2:


<?php
<?php

//PHP5 only example due to changes in XML extensions between version 4 and 5 (Tested on PHP5.2.0)
/*
/*
* Assuming you have a wsdl definition file at at 'http://example.com/soap/wsdl',
* Assuming you have a wsdl definition file at at 'http://example.com/soap/wsdl',
Line 20: Line 20:
*/
*/
$result = $client->anotherSoapFunc(34234);
$result = $client->anotherSoapFunc(34234);
?>

Revision as of 15:34, 23 January 2007

PHP

<?php
 /*
  * Assuming you have a wsdl definition file at at 'http://example.com/soap/wsdl',
  * you can create a client...
  */
 $client = new SoapClient('http://example.com/soap/wsdl');
 /*
  * in this example, the soap server has a function called 'soapFunc' with a 
  * single string parameter $input, and returns a result.
  */
 $result = $client->soapFunc('hello');
 /*
  * in this example, the soap server has a function called 'anotherSoapFunc' with a 
  * single integer parameter $input, and returns a result.
  */
 $result = $client->anotherSoapFunc(34234);