Issue
I've spent the last couple of days trying to figure out why my soap client can't connect, any help is appreciated. Very straightforward issue, my soap client;
$soapClient = new SoapClient("AXLAPI.wsdl", array('trace'=>true, 'exceptions'=>true,'location'=>"https://ip_address:8443/axl",
'login' => "username",'password'=> "password"));
Yields this very common error;
Fatal error: Uncaught SoapFault exception: [HTTP] Could not connect to host in /var/www/html/axl_test.php:18 Stack trace: #0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'https://ip_address...', 'CUCM:DB ver=8.5...', 1, 0) #1 /var/www/html/axl_test.php(18): SoapClient->__call('getLine', Array) #2 /var/www/html/axl_test.php(18): SoapClient->getLine(Array) #3 {main} thrown in /var/www/html/axl_test.php on line 18
I run this exact same code on another server and it runs fine. I'm positive this is related to an SSL issue because a wireshark capture several retransmissions. Also, when I purposefully change the username and password to something false, the error stays the same. So, it must be occuring during the handshake. I can access the remote server from the soap client server with no problems and am able to log in.
The error seems to show that it's trying to connect via HTTP, but my URL specifically calls for HTTPS to be used. I really don't understand where the issue can be.
Solution
After days of working through this issue, I solved the problem. Some of the answers here were correct, there was a problem with the self-signed certificate (so the Soap client has to be made to not care), but another issue was the url itself. For whatever reason, putting in an IP address did not work, using the FQDN did. So, the complete code looks like this;
<?php
error_reporting(E_ALL);
ini_set('display_errors', True);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="style1.css">
<title>AXL Test</title>
<?php
$context = stream_context_create(array('ssl' => array('verify_peer' => false, 'allow_self_signed' => true)));
$soapClient = new SoapClient("AXLAPI.wsdl", array('stream_context' => $context, 'trace'=>true, 'exceptions'=>true,'location'=>"https://hostname.domain.name:8443/axl",'login' => "username",'password'=> "password"));
$response = $soapClient->getLine(array("routePartitionName"=>"partitionName", "pattern"=>"pattern"));
echo "<TR><TD class='body'>" . $response->return->line->description . "</TD><TD class='body'>";
?>
This issue was particularly vexing because I was using tried-and-true code from another server where self-signed ceritificats and FQDNs didn't matter. Now it did, and I don't know why. In any case, I got it working. Thank you to everyone who provided feedback, I hope this helps others.
Answered By - Kimomaru Answer Checked By - Senaida (WPSolving Volunteer)