PHP and AXL

Version 1
    This document was generated from CDN thread

    Created by: Chandar vr on 01-09-2009 02:26:39 PM
    Hi ,
     
    I am planning to write php program for accessing axl api's.
    Cisco is providing more than one wsdl for getting the functions.
    So each time we have to access each wsdl for corresponding api's.
     
    Is there any single wsdl file defined so that i can point to that file and access the functions ?
     
    Can anyone provide me any links where i can get the examples or detailed explanation of each functions ?
     
    Please help me on this ....
     
    1
    2$options = array (
    3   'login' => 'login',
    4   'password' => 'pwd'
    5    );
    6$client = new SOAPClient('https://server:port/realtimeservice/services/RisPort?wsdl',$options);
    7 

     
     

    Subject: RE: PHP and AXL
    Replied by: David Staudt on 01-09-2009 06:30:44 PM
    Each of the various web services on UCM has its own URL and namespace, so I don't think it's possible to create a single WSDL that will work for all services/requests.
     
    My understanding of the PHP SOAP client is that you can copy the WSDL files to a local file path on the web server, and use that path to instantiate the SOAPClient.  Note also that PHP SOAP caches WSDL files for a default of 1 day.
     
    There is a short how-to/sample here which demonstrates PHP with Admin AXL: http://developer.cisco.com/web/axl/wikidocs?src=/wiki/display/AXL/how-to_PHP
     
     

    Subject: RE: PHP and AXL
    Replied by: ****** fuckyou on 17-06-2010 12:07:39 PM
    Hi,
     
     
    Here is another exemple
     
     
    <?php
        $client = new SoapClient(".\8.0\AXLAPI.wsdl",
                    array('trace'=>true,
                          'exceptions'=>true,
                          'location'=>"https://server:8443/axl",
                          'login'=>'user',
                          'password'=>'pass',
                           ));
                                             
       
       $response = $client->addUser(array('user' => array("userid"=>"asaa","lastName"=>"bob","presenceGroupName"=>"Standard Presence group")));
     
    ?>
     
     
    I'm looking to trade PHP code for an Open source project using Call Manager..
     
    Thanks

    Subject: RE: PHP and AXL
    Replied by: Karel Stadler on 22-07-2010 02:34:30 PM
    I'm also looking for good PHP code ... here is an example for adding a phone in CUCM using PHP. By the way ... this script works with PHP 5.3.1 or higher. Older PHP version have problems with SOAP.
    All you need are the files schema/7.1/WSDL-AXIS/AXLAPI.wsdl und schema/7.1/WSDL-AXIS/AXLSoap.xsd.
     
    More simple examples can be found here

    <?php
    /*
    **************************************************
    * This Script will import Phones into CUCM 7.1.2 *
    * using AXL SOAP (AXIS)                          *
    **************************************************
    DATE   20091105
    AUTHOR Karel Stadler
    */
    // vars
    define('CUCM_SERVER_IP',  '1.1.1.1');
    define('CUCM_SERVER_PORT','8443');
    define('CUCM_AXL_USER',   'userX');
    define('CUCM_AXL_PASS',   'passX');
    define('CUCM_AXL_API',    '/var/www/html/soaptest/AXLAPI.wsdl');
    //test data
    $firstName = 'Hansli';
    $lastName  = 'Meier';
    $phoneType = '7911';
    $extension = '45104';
    //pre processing data
    switch ($phoneType)
    {
     case '7911':
      $phoneButtonTemplate = '7911-1L';
      break;
     case '7965':
      $phoneButtonTemplate = '7965-2L4S';
      break;
    }
    // start soap_client
    $client = new SoapClient(CUCM_AXL_API,array('trace'=>true,'exceptions'=>true,'location'=>"[url=https://".CUCM_SERVER_IP."".CUCM_SERVER_PORT."]https://".CUCM_SERVER_IP.":".CUCM_SERVER_PORT."/axl",'login'=>CUCM_AXL_USER,'password'=>CUCM_AXL_PASS));
    // try
    try
    {
     // add the line first
     $response = $client->addLine(array("newLine"=>array(
        "pattern"=>$extension,
        "description"=>$lastName." ".$firstName." - Line 1",
        "usage"=>"Device",
        "routePartitionName"=>"internal",
        "alertingName"=>strtoupper($lastName)." ".strtoupper(substr($firstName,0,1)).".",
        "asciiAlertingName"=>strtoupper($lastName)." ".strtoupper(substr($firstName,0,1)).".",
        )));
     $lineuuid = $response->return;
     echo "AddLine returned Line UUID: ".$lineuuid."<br>\n";
     // add the phone using the line uuid in dirn
     $response = $client->addPhone(array("newPhone"=>array(
        "name"=>"BAT665544332211",              
        "description"=>"C".$phoneType." ".$lastName." ".$firstName." (".$extension.") vcd001",
        "product"=>"Cisco ".$phoneType,                                              
        "model"=>"Cisco ".$phoneType,                                          
        "callingSearchSpaceName"=>"xy",                            
        "devicePoolName"=>"xy",                                  
        "commonDeviceConfigName"=>"",                                      
        "commonPhoneConfigName"=>"xy",                                 
        "locationName"=>"xy",                                                  
        "networkHoldMOHAudioSourceId"=>0,
        "userHoldMOHAudioSourceId"=>0,
        "automatedAlternateRoutingCSSId"=>"xy",
        "automatedAlternateRoutingCSSName"=>"xy",
        "phoneTemplateName"=>$phoneButtonTemplate,
        "userLocale"=>"German Germany",
        "softkeyTemplateName"=>"xy",
        "class"=>"Phone",
        "protocol"=>"SCCP",
        "protocolSide"=>"User",
        "enableExtensionMobility"=>0,
        "SecurityProfileName"=>"Cisco ".$phoneType." - SCCP Secure Profile",
        "lines"=>array("line"=>array("index"=>"1","label"=>"Test","display"=>"test","dirn"=>array("uuid"=>$lineuuid,"usage"=>"Device","pattern"=>"1234"),"callInfoDisplay"=>array("callerName"=>1))))));
    }
    catch (SoapFault $soapFault)
    {
     var_dump($soapFault);
     echo "There is an error<br>\n";
     echo "<strong>Request:</strong><br>", htmlentities($client->__getLastRequest()), "<br>";
     echo "<strong>Response:</strong><br>", htmlentities($client->__getLastResponse()), "<br>";
    }
    echo "<strong>Debug of your request</strong><br>";
    echo "<strong>Request:</strong><br>", htmlentities($client->__getLastRequest()), "<br>";
    echo "<strong>Response:</strong><br>", htmlentities($client->__getLastResponse()), "<br>";
    ?>

    Subject: RE: PHP and AXL
    Replied by: JAMES DEPHILLIP II on 26-10-2010 04:15:00 PM
    When I run this script I get the following error does anyone know why? Thanks in advance!
     
    Debug of your request
    Request:
    <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><parameters><item><key>newLine</key><value><item><key>pattern</key><value>45104</value></item><item><key>description</key><value>Meier Hansli - Line 1</value></item><item><key>usage</key><value>Device</value></item><item><key>routePartitionName</key><value>internal</value></item><item><key>alertingName</key><value>MEIER H.</value></item><item><key>asciiAlertingName</key><value>MEIER H.</value></item></value></item></parameters></SOAP-ENV:Body></SOAP-ENV:Envelope> 
    Response:
    <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Client</faultcode><faultstring>No Handler found for parameters</faultstring><detail><axl:Error xmlns:axl="http://www.cisco.com/AXL/API/1.0"><axl:code>5003</axl:code><axl:message>No Handler found for parameters</axl:message><request>parameters</request></axl:Error></detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>