help getting started with php axl

Version 1
    This document was generated from CDN thread

    Created by: Hayden McFadyen on 06-08-2010 02:16:07 AM
    Hi guys,
     
    I'm just trying to get started and am following the example given at:
    http://developer.cisco.com/web/axl/wikidocs/-/wiki/Main/Using%20AXL%20WSDL%20with%20PHP
     
    but I keep getting an error:
    "
    SoapFault: Unauthorized in /var/www/html/apps-dev/haydenm/ccm/index.php
    on line 24
    Call Stack:
        0.0185     634776   1. {main}()
    /var/www/html/apps-dev/haydenm/ccm/index.php:0
        0.0774    5072152   2. SoapClient->getUser()
    /var/www/html/apps-dev/haydenm/ccm/index.php:24
    "
     
    please see my code below:
     
    error_reporting(E_ALL);
    ini_set('display_errors', TRUE);
    ini_set('display_startup_errors', TRUE);

    define('CUCM_AXL_USER',   $_SERVER['PHP_AUTH_USER']);
    define('CUCM_AXL_PASS',   $_SERVER['PHP_AUTH_PW']);

    $options = array('trace'=>true,
                     'exceptions'=>true,
                     'location'=>"https://10.64.32.21:8443/axl",
                     'login'=>CUCM_AXL_USER,
                     'password'=>MD5(CUCM_AXL_PASS),
                      );
                   
    $client = new SoapClient("/var/www/html/apps-dev/haydenm/ccm/AXLAPI.wsdl",$options);

    try{
        $response = $client->getUser(array("userid"=>"haydenm"));
        var_dump($response);
    }catch(SoapFault $soapFault){
       
        var_dump($soapFault);
        echo "<br>theres a bloody error<br>";
        echo "<strong>Request:</strong><br>", htmlentities($client->__getLastRequest()), "<br>";
        echo "<strong>Response:</strong><br>", htmlentities($client->__getLastResponse()), "<br>";
    }
     
     
    I can login to the CM admin interface fine so i thought I would be able to use PHP_AUTH details.
    Any help with the code or just on how to resolve errors in general would be great.

    Cheers
    Hayden
     
    PS I was able to do __getFunctions and it returned a heap of stuff, so Im thinking the soap object is ok... :S

    Subject: RE: help getting started with php axl
    Replied by: Hayden McFadyen on 11-08-2010 11:21:22 PM
    do I need to be using the local_cert option?
    if so can anyone please provide me with an example?
     
    Any help at all would be greatly appreciated

    Subject: RE: help getting started with php axl
    Replied by: Robbie Biesser on 12-08-2010 03:56:13 PM
    Hopefully this helps,
     
    The __getFunctions is a feature of the PHP SOAP client. So to be able to see the available functions means that you have properly pointed your SOAP client to your .wsdl file.
     
    The only other thing I see different is the password for the SOAP client. You are trying to connect to Call Manager with the MD5 hash as the password whereas I have just been using a plaintext password. Also, the AXL user is a Call Manager user with rights to use the AXL API. Check the documentation if you have questions.
     
    Your error, "SoapFault: Unauthorized" leads me to believe you are having a permissions issue.

    Subject: RE: help getting started with php axl
    Replied by: Hayden McFadyen on 12-08-2010 10:35:55 PM
    Thanks for the help guys.
    The problem was with authentication of the password. I changed it to plain text and have progressed.
     

     
     

    Subject: RE: help getting started with php axl
    Replied by: David Staudt on 12-08-2010 04:00:18 PM
    There are two roles/permissions that needs to be assigned to the application's credentials in order to use AXL:
     
    - Standard AXL API Access
    - Standard CCM Admin Users
     
    You can verify your credentials by using a web browser to navigate to the AXL URL:  http://ucm-ip:8443/axl.