first PHP query

Version 1
    This document was generated from CDN thread

    Created by: Jacob Munson on 07-03-2012 01:02:20 PM
    I am trying get my first php query working and having problems. I am folowing the example here
    http://developer.cisco.com/web/axl/wikidocs/-/wiki/Main/Using+AXL+WSDL+with+PHP
     
    this is what my code looks like.

    <html>
     <head>
     <title>PHP Test</title>
     </head>
     <body>
    <?php
     $client = new SoapClient("https://172.16.16.101:8443/perfmonservice/services/PerfmonPort?wsdl",
     array('trace'=>true,
     'exceptions'=>true,
     'location'=>"https://172.16.16.101:8443/axl",
     'login'=>'ccmadministrator',
     'password'=>'wdictevf',
     ));
     $response = $client->getUser(array("userid"=>"jmunson"));
     echo("First Name: ".$response->return->user->firstname)."<br>";
     echo("Last Name: ".$response->return->user->lastname);
    ?>
     </body>
    </html>

     
    and this is the error I am getting. 
    Fatal error: Uncaught SoapFault exception:  Function ("getUser") is not a valid method for this service in /var/www/Cisco/index.php:14 Stack trace: #0 /var/www/Cisco/index.php(14): SoapClient->__call('getUser', Array) #1 /var/www/Cisco/index.php(14): SoapClient->getUser(Array) #2 {main} thrown in /var/www/Cisco/index.php on line 14
     
    I also tried using  $client = new SoapClient("/var/www/AXLAPI.wsdl", 
    putting just the AXLAPI.wsdl and axlsoap.xsd files that i downloaded from my call manager in the plugins section ( Plugins > Cisco AXL Toolkit > axlsqltoolkit > schema > current ) in the root www directory. and that gave me this different error. 
     

    Notice: Undefined property: stdClass::$firstname in /var/www/Cisco/index.php on line 15 First Name: 
    Notice: Undefined property: stdClass::$lastname in /var/www/Cisco/index.php on line 16 Last Name:

     
    Thank you for any help. 
     
     
     

    Subject: RE: first PHP query
    Replied by: Jacob Munson on 07-03-2012 03:56:06 PM
    I think you'll find that 'firstname' should now be 'firstName' similarly for lastName.
     

     
    This did the trick thanks.

    Subject: RE: first PHP query
    Replied by: David Staudt on 07-03-2012 03:44:07 PM
    I believe the first attempt is problematic as you are attempting to access the Serviceability SOAP APIs's 'perfmon port' service WSDL rather than AXL SOAP's.  Hence the complaint that getUser is not recognized.
     
    The second attempt looks like it is using the correct WSDL/XSD, however the example noted was used with UCM 7.0(1), and in 8.0(1) and higher some cleanup was done to 'camel casing' of element names - I think you'll find that 'firstname' should now be 'firstName' similarly for lastName.
     
     

    Subject: RE: first PHP query
    Replied by: Jan Seynaeve on 07-03-2012 03:46:31 PM
    looks to me like you need authentication if you go get the wsdl file from the CUCM itself. I'd say, go for your second option and put the wsdl in your server root, not sure if the '/var/www' is needed / correct. I have mine in the server root and just call it like below:

     1
     2try{
     3    $this->soap = new SoapClient("AXLAPI.wsdl",
     4        array(
     5            'trace'=>true,
     6            'exceptions'=>true,
     7            'location'=>'https://'.$_SESSION['AXLServer'].':8443/axl',
     8            'login'=>$_SESSION['AXLUser'],
     9            'password'=>$_SESSION['AXLPwd'],
    10        ));
    11}
    12catch (SoapFault $E) {
    13    echo "Arr, an error: <br/>".$E -> faultstring;
    14}


    The try-catch thinggy might give you a bit more info on the error when it occurs ...

    Have fun,
    Jan.

    PS: just replace the $_SESSION[] stuff by the appropriate server, user and pwd ;-)