I run my server with ubuntu 18.4 with openlitespeed installed, i'm making some php code to call a web service with SOAP, however, on my production server i'm facing some issues:
There is the code i use, i also use this function on my local server and it works normally:
$soapParams = array(
'login' => 'Name',
'password' => 'password',
'authentication' => SOAP_AUTHENTICATION_BASIC,
'trace' => 1,
'exceptions' => 1, );
$params = array();
$client = new SoapClient('https://myserver.name:8051/MEX?wsdl',
$soapParams);
$params = array( 'DataServerName' => 'NAME',
'PrimaryKey'=>'KEYNAME',
);
$result = $client->ReadRecord($params);
echo "response:\n" . $client->__getLastResponse() . "<br><br>";
it returns the following error:
Exceção - SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://myserver.name:8051/MEX?wsdl' : failed to load external entity "https://myserver.name:8051/MEX?wsdl"
I tried executing curl in both my local server and my production server(the one that this error is ocorring), in my local server its responded normally, however in my production server it returned the following error:
root@my-server:/# curl https://myserver.name:8051/MEX?wsdl
curl: (7) Failed to connect to myserver.name port 8051: Connection refused
I looked on the /etc/hosts on my production server and it shows the following:
127.0.0.1 localhost servermyserver
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
I also executed the command
netstat -ln | grep 80
netstat -ln | grep 443
On my production server,
root@servermyserver:/etc# netstat -ln | grep 443
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN
tcp6 0 0 :::443 :::* LISTEN
tcp6 0 0 :::443 :::* LISTEN
tcp6 0 0 :::443 :::* LISTEN
tcp6 0 0 :::443 :::* LISTEN
udp 0 0 0.0.0.0:443 0.0.0.0:*
udp 0 0 0.0.0.0:443 0.0.0.0:*
udp 0 0 0.0.0.0:443 0.0.0.0:*
udp 0 0 0.0.0.0:443 0.0.0.0:*
udp6 0 0 :::443 :::*
udp6 0 0 :::443 :::*
udp6 0 0 :::443 :::*
udp6 0 0 :::443 :::*
root@servermyserver:/etc# netstat -ln | grep 80
tcp 0 0 0.0.0.0:7080 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:8090 0.0.0.0:* LISTEN
udp 0 0 0.0.0.0:7080 0.0.0.0:*
unix 2 [ ACC ] STREAM LISTENING 2307434806 /usr/local/lsws/admin/tmp/admin.sock.7958
unix 2 [ ACC ] STREAM LISTENING 2308072711 /tmp/lshttpd/facsu7698.sock
However, when i run
netstat -ln | grep 8051
That is the port i'm trying to connect with soap, it doesn't return anything, it seems like myserver doesn't listen to the port i'm trying to use.
I tried to run cURL with ipv4 to see if i can get some results:
root@servermyserver:/# curl --ipv4 -v "https://myserver.name:8051/MEX?wsdl"
* Trying xxx.xxx.xxx.xxx...
* TCP_NODELAY set
* connect to xxx.xxx.xxx.xxx port 8051 failed: Connection refused
* Failed to connect to myserver.name:8051 port 8051: Connection refused
* Closing connection 0
curl: (7) Failed to connect to myserver.name:8051 port 8051: Connection refused
I also tried to run telnet:
root@servermyserve:/# telnet localhost 8051
Trying ::1...
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
However, if i try telnet to por 80, it responds normally:
root@servermyserve:/# telnet localhost 80
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.