Zend_Soap_Client得到“;看起来我们没有XML文档“;错误


Zend_Soap_Client gets "looks like we got no XML document" error

我正在尝试从提供者访问Web服务(SOAP)。我无法控制服务器的响应。对于我使用的这个方法,Zend_Soap_Client在构造函数中传递WDSL和选项,我可以执行getFunctions,但当尝试访问第一个Soap方法时,我会得到

[Sender] looks like we got no XML document

在环顾四周并用soapUI检查了我从服务器上得到的答案后,我发现答案缺少XML声明:

<?xml version="1.0" encoding="XXXXXXX"?>

那么,有没有什么方法可以让Zend_Soap_Client省略基于XML声明的XML验证呢?假设没有声明是我的问题。

这是我使用的代码:

private $_connection_settings = array('login' => self::API_user, 'pwd' => self::API_password, 'key'=> self::API_Key);

private static $CONNEXION_PARAMS = array(                                            
                                        'soap_version'   => SOAP_1_1,
                                        'encoding'      => 'UTF-8'
                                     );
...
//somewhere in my code: 
$client = new Zend_Soap_Client('http://server_URL?wsdl', self::$CONNEXION_PARAMS);
$response = $client->fistSoapMethod($this->_connection_settings);            

并且没有分配响应。

谢谢!

除了SOAP错误之外,您的代码中没有其他警告/错误?

不确定它是WSDL。可以始终尝试使用在线工具验证WSDL。

您使用过getLastResponse()和getLastRequest()方法吗?听起来你可能在请求开始时发送了一些垃圾。测试时我经常做的另一件事是关闭WSDL缓存。

ini_set("soap.wsdl_cache_enabled", 0);