SOAP-ERROR:无法加载外部实体 - cURL:连接被拒绝

SOAP-ERROR:无法加载外部实体 - cURL:连接被拒绝

我使用安装了 openlitespeed 的 ubuntu 18.4 运行我的服务器,我正在编写一些 php 代码来使用 SOAP 调用 Web 服务,但是,在我的生产服务器上我遇到一些问题:

这是我使用的代码,我也在本地服务器上使用此功能,并且它可以正常工作:

 $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>";

它返回以下错误:

 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"

我尝试在本地服务器和生产服务器(出现此错误的服务器)上执行 curl,在本地服务器中它响应正常,但在生产服务器中它返回了以下错误:

 root@my-server:/# curl https://myserver.name:8051/MEX?wsdl
 curl: (7) Failed to connect to myserver.name port 8051: Connection refused

我查看了生产服务器上的 /etc/hosts,它显示以下内容:

  127.0.0.1       localhost servermyserver
  ::1             localhost ip6-localhost ip6-loopback
  ff02::1         ip6-allnodes
  ff02::2         ip6-allrouters

我也执行了命令

  netstat -ln | grep 80
  netstat -ln | grep 443

在我的生产服务器上,

  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

但是,当我跑步时

  netstat -ln | grep 8051

这是我尝试用 soap 连接的端口,它没有返回任何内容,似乎 myserver 没有监听我尝试使用的端口。

我尝试使用 ipv4 运行 cURL 来看看是否可以得到一些结果:

  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

我也尝试运行 telnet:

  root@servermyserve:/# telnet localhost 8051
  Trying ::1...
  Trying 127.0.0.1...
  telnet: Unable to connect to remote host: Connection refused

但是,如果我尝试 telnet 到 por 80,它会正常响应:

  root@servermyserve:/# telnet localhost 80
  Trying ::1...
  Trying 127.0.0.1...
  Connected to localhost.
  Escape character is '^]'.

相关内容