1

我正在使用第三方 wsdl 实现 PHP SOAP 服务器。包含的 xsd 对外部模式的引用如下:

<xsd:import schemaLocation="http://www.w3.org/TR/2008/REC-xmldsig-core-20080610/xmldsig-core-schema.xsd" namespace="http://www.w3.org/2000/09/xmldsig"/>

带有波纹管代码的 SoapClient 可以完美运行:

$options                       = array();
$options['features']           = 1;
$options['trace']              = 1;
$options['connection_timeout'] = 2000;
$options['exceptions']         = 1;
$options['soap_version']       = SOAP_1_1;
$options['encoding']           = 'UTF-8';
$options["user_agent"]  = 'php-file_get_contents/'.phpversion();

$clent = new SoapClient( $wsdl, $options);

但不是 SoapServer

$options                       = array();
$options['features']           = 1;
$options['trace']              = 1;
$options['connection_timeout'] = 2000;
$options['exceptions']         = 1;
$options['soap_version']       = SOAP_1_1;
$options['encoding']           = 'UTF-8';

$server = new SoapServer($wsdl, $options);

这会引发以下错误

SoapServer::SoapServer("http://www.w3.org/TR/2008/REC-xmldsig-core-20080610/xmldsig-core-schema.xsd"): failed to open stream: HTTP request failed! HTTP/1.0 500 Server Error\r\n in ..../index.php on line 54
PHP Warning:  SoapServer::SoapServer(): I/O warning : failed to load external entity "http://www.w3.org/TR/2008/REC-xmldsig-core-20080610/xmldsig-core-schema.xsd" in ..../index.php on line 54
PHP Fatal error:  SOAP-ERROR: Parsing Schema: can't import schema from 'http://www.w3.org/TR/2008/REC-xmldsig-core-20080610/xmldsig-core-schema.xsd' in .../index.php on line 54

SoapClient 也抛出了相同的错误,但在添加“user_agent”选项后得到解决。我没有看到 SoapServer 的“user_agent”选项。

我在这里错过了什么吗?

我可以访问网址:http ://www.w3.org/TR/2008/REC-xmldsig-core-20080610/xmldsig-core-schema.xsd并能够下载 xsd 文件

编辑:添加了实际的 xsd 链接。

4

0 回答 0