我正在使用第三方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链接。