1

我无法使用我的橙色服务器连接到我的网站,出现此错误:

我启用了 ssl 和 soap,但它仍然不起作用。

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR:
Parsing WSDL: Couldn't load from 'https://m2mconnect.orange.co.uk/orange-soap/services/MessageServiceByCountry?wsdl':
Start tag expected, '<' not found in C:\xampp\htdocs\test\library\connect.class.php:10

Stack trace: #0 C:\xampp\htdocs\test\library\connect.class.php(10): SoapClient->SoapClient('https://m2mconn...')
#1 C:\xampp\htdocs\test\application\views\items\homepage.php(20): Connect->__construct()
#2 C:\xampp\htdocs\test\library\template.class.php(30): include('C:\xampp\htdocs...')
#3 C:\xampp\htdocs\test\library\controller.class.php(25): Template->render()
#4 C:\xampp\htdocs\test\library\shared.php(91): Controller->__destruct()
#5 C:\xampp\htdocs\test\library\shared.php(91): callHook()
#6 C:\xampp\htdocs\test\library\bootstrap.php(4): require_once('C:\xampp\htdocs...')
#7 C:\xampp\htdocs\test\public\index.php(8): require_once('C:\xampp\htdocs...')
#8 {main} thrown in C:\xampp\htdocs\test\library\connect.class.php on line 10
4

2 回答 2

1

[WSDL] SOAP 错误:解析 WSDL:无法从...加载

假设 WSDL 和服务实际上可以在 Internet 上访问,这意味着您的脚本无法连接到远程 Web 服务 - 它无法下载 WSDL 并且无法调用该服务。您需要检查服务器的网络连接(尤其是出站)。您可能需要询问您的主机,因为他们的防火墙/配置可能会停止出站连接。

于 2013-01-15T16:30:02.870 回答
1

尝试将 WSDL 保存到本地文件,并在构造函数中引用它...

$client = new SoapClient('/local/path/to/wsdlfile.wsdl');

编辑:如果您在使用文件系统时遇到 http 错误,那么您做错了什么:-)

试图自己运行这个,这些是我的回应。注意:我也无法连接到橙色服务器,可能是他们的 https 连接有点臭...

Var-dump 一个新的 SoapClient:

$> php -r "var_dump(new SoapClient('https://m2mconnect.orange.co.uk/orange-soap/services/MessageServiceByCountry?wsdl'));"
PHP Fatal error:  SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://m2mconnect.orange.co.uk/orange-soap/services/MessageServiceByCountry?wsdl' :
 failed to load external entity "https://m2mconnect.orange.co.uk/orange-soap/services/MessageServiceByCountry?wsdl"
 in Command line code on line 1
PHP Fatal error:  Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://m2mconnect.orange.co.uk/orange-soap/services/MessageServiceByCountry?wsdl' :
 failed to load external entity "https://m2mconnect.orange.co.uk/orange-soap/services/MessageServiceByCountry?wsdl"
 in Command line code:1
Stack trace:
#0 Command line code(1): SoapClient->SoapClient('https://m2mconn...')
#1 {main}
  thrown in Command line code on line 1

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://m2mconnect.orange.co.uk/orange-soap/services/MessageServiceByCountry?wsdl' :
 failed to load external entity "https://m2mconnect.orange.co.uk/orange-soap/services/MessageServiceByCountry?wsdl"
 in Command line code:1
Stack trace:
#0 Command line code(1): SoapClient->SoapClient('https://m2mconn...')
#1 {main}
  thrown in Command line code on line 1

获取 WSDL:

$> wget https://m2mconnect.orange.co.uk/orange-soap/services/MessageServiceByCountry?wsdl -O MSBC.wsdl
--19:41:45--  https://m2mconnect.orange.co.uk/orange-soap/services/MessageServiceByCountry?wsdl
           => `MSBC.wsdl'
Resolving m2mconnect.orange.co.uk... done.
Connecting to m2mconnect.orange.co.uk[213.52.171.155]:443... connected.

Unable to establish SSL connection.

Unable to establish SSL connection.

通过浏览器下载 WSDL,并使用该浏览器:

$> php -r "$s = new SoapClient('MSBC2.wsdl');var_dump($s, $s->__getFunctions());"
object(SoapClient)#1 (2) {
  ["_soap_version"]=>
  int(1)
  ["sdl"]=>
  resource(6) of type (Unknown)
}
array(11) {
  [0]=>
  string(133) "int sendMessage(string $username, string $password, string $deviceMSISDN, string $message, boolean $deliveryReport, string $mtBearer)"
  [1]=>
  string(116) "ArrayOf_xsd_string getDeliveryReports(string $username, string $password, string $deviceMSISDN, string $countryCode)"
  [2]=>
  string(122) "ArrayOf_xsd_string readMessages(string $username, string $password, int $count, string $deviceMsisdn, string $countryCode)"
  [3]=>
  string(100) "boolean flushMessages(string $username, string $password, string $deviceMSISDN, string $countryCode)"
  [4]=>
  string(139) "ArrayOf_xsd_string waitForMessage(string $username, string $password, int $timeout, string $deviceMSISDN, int $msgref, string $countryCode)"
  [5]=>
  string(204) "int sendMessageWithValidityPeriod(string $username, string $password, string $deviceMSISDN, string $message, boolean $deliveryReport, string $mtBearer, string $binarySmsDcs, string $validityDaysHoursMins)"
  [6]=>
  string(164) "int sendBinarySmsMessage(string $username, string $password, string $deviceMSISDN, string $message, boolean $deliveryReport, string $mtBearer, string $binarySmsDcs)"
  [7]=>
  string(162) "ArrayOf_xsd_string sendAndWait(string $username, string $password, int $timeout, string $deviceMSISDN, string $message, boolean $deliveryReport, string $mtBearer)"
  [8]=>
  string(193) "ArrayOf_xsd_string sendBinarySmsAndWait(string $username, string $password, int $timeout, string $deviceMSISDN, string $message, boolean $deliveryReport, string $mtBearer, string $binarySmsDcs)"
  [9]=>
  string(122) "ArrayOf_xsd_string peekMessages(string $username, string $password, int $count, string $deviceMsisdn, string $countryCode)"
  [10]=>
  string(142) "ArrayOf_xsd_string getDeliveryReportsFromDate(string $username, string $password, string $deviceMSISDN, string $countryCode, string $fromDate)"
}

$>

请注意,我不能调用任何方法,因为我没有有效的详细信息。

于 2013-01-15T15:37:45.833 回答