从Zend_Soap_AutoDiscover类生成WSDL文件有问题。
有人能解释我做错了什么吗?
在bootstrap.php中,我有一个方法:
public function _initWsdl()
{
require_once("http://localhost:8080/zf_mta/backend.php");
$autoDiscover = new Zend_Soap_AutoDiscover('Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex');
$autoDiscover->setClass('Backend');
$autoDiscover->setUri('http://localhost:8080/zf_mta/backend.php');
$autoDiscover->handle();
return $autoDiscover;
}这是backend.php类
class Order {
/** @var string */
public $productid;
/** @var string */
public $customerid;
/** @var int */
public $productcnt;
public function __construct($productid,$customerid,$productcnt) {
$this->productid = $productid;
$this->customerid = $customerid;
$this->productcnt = $productcnt;
}
}
class Orders {
/** @var Order[] */
public $orders;
}
class Backend {
/**
* @param Orders $orders
* @return string
*/
public function placeOrders($orders) {
return print_r($orders,1);
}
}我搞错了:
内部服务器错误 服务器遇到内部错误或配置错误,无法完成请求.
error_log:
[07-Sep-2012 13:39:48 UTC] PHP Warning: require_once() [<a href='function.require-once'>function.require-once</a>]: http:// wrapper is disabled in the server configuration by allow_url_include=0 in E:\Zend Server\Apache2\htdocs\zf_mta\application\Bootstrap.php on line 18
[07-Sep-2012 13:39:48 UTC] PHP Warning: require_once(http://localhost:8080/zf_mta/backend.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: no suitable wrapper could be found in E:\Zend Server\Apache2\htdocs\zf_mta\application\Bootstrap.php on line 18
[07-Sep-2012 13:39:48 UTC] PHP Fatal error: require_once() [<a href='function.require'>function.require</a>]: Failed opening required 'http://localhost:8080/zf_mta/backend.php' (include_path='E:\Zend Server\Apache2\htdocs\zf_mta\application/../library;E:\Zend Server\Apache2\htdocs\zf_mta\library;.;E:\Zend Server\ZendServer\share\ZendFramework\library') in E:\Zend Server\Apache2\htdocs\zf_mta\application\Bootstrap.php on line 18发布于 2012-09-10 01:43:40
Florent的评论解决了第一个问题: PHP配置禁止使用HTTP包含文件。因此,您需要更改require语句,以引用文件系统中的文件名。
但是,我看到了代码中的其他几个问题:
Zend_Soap_Autodiscover通常在SOAP服务器中用于响应客户端对WSDL副本的请求。因此,您通常会将该代码包含在专门用于处理该请求的方法中,而不是在应用程序引导程序中。_init...()方法的代码忽略了从这些方法中传递回来的任何值或对象,因此最终这段代码将什么也不做。我认为您需要查看一些示例代码,以真正了解如何使用Zend实现SOAP服务器。下面的片段是关于我可以为SOAP服务使用Zend的最简单示例:http://pastebin.com/9mb64LeG注意到它不使用Zend或路由基础结构,但它可能会帮助您了解Zend_Soap_Server和Zend_Soap_Autodiscover的基本用法。
https://stackoverflow.com/questions/12316159
复制相似问题