How to ... Use the AXL WSDL with PHP
CUCM/AXL Version tested: 10.5(1)
Platform: Ubuntu 9.04, extra packages: php5, php-soap
The PHP project provides a simple SOAP handling library that makes it fairly easy to interact with web services. The following code performs a <getUser> query and prints out the user's first and last names.
Note, this example creates an HTTPS connection to the UCM AXL service, but does not validate the UCM's security certificate. (See the PHP SOAPClient 'local_cert' option.)
The AXL WSDL (AXLAPI.wsdl and axlsoap.xsd files from the AXL SQL Toolkit - AXIS versions) were copied to /var/www on the PHP server. Note, PHP SOAP will cache this WSDL for 24 hours by default - this caching can be disabled in php.ini.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | < html > < head > < title >PHP Test</ title > </ head > < body > <? php $client = new SoapClient( "/var/www/AXLAPI.wsdl" , array ( 'trace' =>true, 'exceptions' =>true, 'login' => 'adminUserID' , 'password' => 'password' , )); $response = $client ->getUser( array ( "userid" => "dstaudt" )); echo ( "First Name: " . $response -> return ->user->firstName). "<br>" ; echo ( "Last Name: " . $response -> return ->user->lastName); ?> </ body > </ html > |