0
我正在使用Zend框架,并且我需要使用Zend_Soap来制作Web服务。搜索了3天后,我决定自问。创建Zend_Soap_Server后我得到消息 <SOAP-ENV ..> <SOAP-ENV:Body> <SOAP-ENV:Fault> <faultcode>sender</faultcode> <faultstring>Invalid XML</faultstring> </SOAP-ENV:Fault> </SOAP-ENV:Body> </SOAP-ENV>
然后我试图this solution,我得到XML使用Zend_Soap_AutoDiscover工作,但是当我尝试连接Zend_Soap_Client ...Zend_Soap_Server/Client不起作用。返回“看起来像我们没有XML文档”
<?php
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Soap_Client');
$options = array(
'location' => 'http://zend/service/soap',
'uri' => 'http://zend/service/soap'
);
try {
$client = new Zend_Soap_Client(null, $options);
$foo = $client->foo();
var_dump($foo);
} catch (Exception $e) {
die($e->getMessage());
}
我得到的回应是
看起来像我们有没有XML文档
在服务器上的代码($肥皂不使用,因为我无法得到它的工作):
public function soapAction() {
$this->_helper->layout()->disableLayout();
$this->getHelper('viewRenderer')->setNoRender(true);
$soap = new Zend_Soap_Server(null,array(
'uri' => 'http://zend/service/soap'
));
$soap->setClass('API_SoapFunctions');
$soap->setUri('http://zend/service/soap');
$autodiscover = new Zend_Soap_AutoDiscover();
$autodiscover->setClass('API_SoapFunctions')->setBindingStyle(array('style' => 'document'))->setUri('http://zend/service/soap');
header('Content-type: application/xml');
echo $autodiscover->toXml();
//$soap->handle();
}
我刚刚问...你不使用URI'HTTP://的Zend /服务/ soap'当你运行你的代码,对吧? –
我在公用文件夹index.php旁边有一个文件service.php –
当然,在上面的代码中,你有'http:// zend/service/soap'作为URL,而不是'service.php'文件。上面的代码是你的实际代码吗? –