cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
22740
Views
0
Helpful
4
Replies

Fatal error: Uncaught Error: Class 'SoapClient' not found

alsaafani
Level 1
Level 1

hello community,

I farly new to APIs and Soap. I am trying to get my first script going but i cannot find what wrong am I doing.

my web browser keeps throwing this error 

Fatal error: Uncaught Error: Class 'SoapClient' not found in C:\xampp\htdocs\FAC.php:24 Stack trace: #0 {main} thrown in C:\xampp\htdocs\FAC.php on line 24 .

 

here's my script:-

 


<?php

echo "<h1>Fac Info Test</h1>";

$host="callmanager pub ip address";
$username="admin username";
$password="admin password";


//disable cert check
//$context = stream_context_create(array('ssl'=>array('verify_peer_name'=>false,'allow_self_signed'=>true)));



// cert check with cert full pathinfo
//$context = stream_context_create(array('ssl'=>array('verify_peer_name'=>true,'allow_self_signed'=>true,'cafile'=>"/var/www/html/PHP-Sample/DS-UCM105.cisco.com.pem")));

 


$client = new SoapClient("C:\xampp\htdocs\AXLAPI.wsdl",

array('trace'=>true,
'exceptions'=>true,
'location'=>"https://".$host.":8443/axl",
'login'=>$username,
'password'=>$password,
));


function getFacInfo($client, $name) {
$returnedTags = array("name"=>"","code"=>"","authorizationLevel"=>"");

try {
$response = $client->getFacInfo(array("name"=>$name),array("returnedTags"=>$returnedTags));
}
catch (SoapFault $sf) {
echo "SoapFault: " . $sf . "<BR>";
}
catch (Exception $e) {
echo "Exception: " . $e . "<BR>";
}

echo("Uuid: ".$response->return->facInfo->uuid."<br>");
echo("Name: ".$response->return->facInfo->name."<br>");
echo("Code: ".$response->return->facInfo->code."<br>");
echo("Auth Level: ".$response->return->facInfo->authorizationLevel."<br>");
echo("<hr>");
}
?>

 

2 Accepted Solutions

Accepted Solutions

thedd
Level 1
Level 1

As far as i see you have an error in SOAP Client.

This might be because this is not active in your php.ini

phpinfo.jpg

 

Do the following:

  1. Locate php.ini in your xampp folder
  2. Remove the ; from the beginning of extension=php_soap.dll
  3. Restart your web server
  4. Look up your phpinfo(); again and check if you see a similar picture to the one above
  5. If you do, problem solved!

View solution in original post

The Error "Couldn't load from 'C: mpp\htdocs\AXLAPI.wsdl' "

seems to be because you reffer to C: mpp not C:\xmpp or it is a copy mistake.

 

I would suggest you put your wsdl and php file in one folder.

The you can reffer to /AXLAPI.wsdl or create a subdirectory maybe AXL the reffer to /AXL/AXLAPI.wsdl

 

View solution in original post

4 Replies 4

thedd
Level 1
Level 1

As far as i see you have an error in SOAP Client.

This might be because this is not active in your php.ini

phpinfo.jpg

 

Do the following:

  1. Locate php.ini in your xampp folder
  2. Remove the ; from the beginning of extension=php_soap.dll
  3. Restart your web server
  4. Look up your phpinfo(); again and check if you see a similar picture to the one above
  5. If you do, problem solved!

thanks thedd, it seems to be working but still I am facing an other issue not sure if it is related to this original post.
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'C: mpp\htdocs\AXLAPI.wsdl' : failed to load external entity "C: mpp/htdocs/AXLAPI.wsdl" in C:\xampp\htdocs\FAC.php:39 Stack trace: #0 C:\xampp\htdocs\FAC.php(39): SoapClient->SoapClient('C:\nmpp\\htdocs\\A...', Array) #1 {main} thrown in C:\xampp\htdocs\FAC.php on line 39

The Error "Couldn't load from 'C: mpp\htdocs\AXLAPI.wsdl' "

seems to be because you reffer to C: mpp not C:\xmpp or it is a copy mistake.

 

I would suggest you put your wsdl and php file in one folder.

The you can reffer to /AXLAPI.wsdl or create a subdirectory maybe AXL the reffer to /AXL/AXLAPI.wsdl

 

Anusha B R
Cisco Employee
Cisco Employee

Hi,

Most likely you have caught this error because, you might have not enabled Soap Client in php.ini file.

SoapClient is an extension of PHP that must be enabled in your php.ini file in order to be extended,

 

Do the following to enable soap:

  1. Locate php.ini in your apache bin folder, I.e Apache/bin/php.ini
  2. Remove the ; from the beginning of extension=php_soap.dll
  3. Restart your Apache server

HTH!

Regards,
Anusha B R

.