06-15-2021 08:53 PM - edited 06-15-2021 08:58 PM
I have seen a lot of discussions of this problem on the internet but I couldn't find a solution that would work for me so far.
I'm writing a php script that would create a line.
The commented section is what I used and it didn't work. And I've changed personal info in the code of course.
<?php /* ini_set('soap.wsdl_cache_enabled',0); ini_set('soap.wsdl_cache_ttl',0); $options = [ 'cache_wsdl'=> WSDL_CACHE_NONE, 'trace'=> 1, 'stream_context' => stream_context_create( [ 'ssl' => [ 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true ] ] ) ]; */ $hostname = '10.10.10.10'; $SCHEMA = "C:/.../schema/10.5/AXLAPI.wsdl"; $client = new SoapClient($SCHEMA, array( $options, 'trace'=>true, 'exceptions'=>true, 'login'=>'User', 'password'=>'123', )); $client->__setLocation('C:/.../schema/10.5/AXLAPI.wsdl'); */ $config = array("line"=> array( "pattern"=>"111111", "description"=>"Operator", "usage"=>"Device", "routePartitionName"=>"Internal", "callForwardAll"=>array("callingSearchSpaceName"=>"Internal", "destination"=>"101010"), "callPickupGroupName"=>"Internal", "alertingName"=>"Оператор", "asciiAlertingName"=>"Operator", "allowCtiControlFlag"=>"true" ) ); $response = $client->addLine($config); print_r($response);
I'm getting this error when I try to run it: "Fatal error: Uncaught SoapFault exception: [HTTP] Unable to parse URL in C:\...\index.php:66 Stack trace: #0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'C:/xampp/htdocs...', 'CUCM:DB ver=10....', 1, false) #1 C:\...\index.php(66): SoapClient->__call('getPhone', Array) #2 {main} thrown in C:\...\index.php" on this line:
$response = $client->addLine($config);
I tried to use getPhone function (it's an example from AXL documentation) just to check if it would work:
$hostname = '10.10.10.10';
$SCHEMA = "C:/.../schema/10.5/AXLAPI.wsdl";
$client = new SoapClient($SCHEMA,
array(
$options,
'trace'=>true,
'exceptions'=>true,
'login'=>'User',
'password'=>'123',
)); $client->__setLocation('C:/.../AXLAPI.wsdl'); $payload = array( "name"=>"11111", "returnedTags"=>array("name"=>"", "description"=>"", "product"=>"", "class"=>"", "protocol"=>"" ) ); $response = $client->getPhone($payload);
It failed again with the same message on $response = $client->getPhone($payload); line.
I really don't know what to do now because I tried so many solutions already but they didn't help.
06-16-2021 07:06 AM
I'm just lobbing spitballs here (that is, I haven't looked deeply into this, just taking a wild guess).
$SCHEMA = "C:/.../schema/10.5/AXLAPI.wsdl";
I'm not certain that is a problem, but I wouldn't do that. Instead, go to the folder where your PHP application exists and point to the AXLAPI files like this:
$SCHEMA = ".\..\..\schema\10.5\AXLAPI.wsdl"
Notice I left out "C:" and used backslashes not slashes. That's because I assume you're running Windows. And Windows doesn't understand "...", which is why I just used 2 dots twice. There's no need to include C: unless your PHP files are on another drive, in which case that path shouldn't work.
Now, if your PHP is on drive C:, it's possible PHP makes up for these things and your $SCHEMA reference is just fine. I haven't tested it, yet. The above is simply how I'd approach it by default.
Also, open a CMD window, go to your PHP file's directory, and then cd .\..\..\schema\10.5 and make sure all 3 AXLAPI files are there.
06-16-2021 04:17 PM
Now the path is being read incorrectly and I'm getting this message: "Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from '\schema.5\AXLAPI.wsdl'"
06-16-2021 08:35 AM
I forgot to mention, the post I made also applies to:
$client->__setLocation('C:/.../AXLAPI.wsdl');
06-16-2021 08:56 AM
I think __setLocation() should be for providing the URL of the AXL service endpoint, e.g.: https://cucmhost:8443/axl/
See this set of AXL+PHP samples: https://github.com/CiscoDevNet/axl-php-samples
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide