我在 PHP 5 中使用 native SOAP 类,由于 native 类更快(并且 NuSOAP 开发似乎已经停止),因此已从 NuSOAP 更改。但是 PHP 5 SOAP 缺乏生成 WSDL 的能力。
有没有人用 PHP 生成 WSDL 的经验?如果是这样,请推荐您喜欢的方法。
谢谢。
最佳答案
斯图尔特
如果您或其他任何人正在寻找此问题的解决方案,这就是我所做的。
首先得到这个脚本:http://www.phpclasses.org/browse/download/zip/package/3509/name/php2wsdl-2009-05-15.zip
然后看它的示例文件。之后,我只是按照我需要的方式对其进行切片,因为我使用的是 codeigniter:
function wsdl(){
error_reporting(0);
require_once(APPPATH."/libraries/WSDLCreator.php"); //Path to the library
$test = new WSDLCreator("Webservice", $this->site."/wsdl");
//$test->includeMethodsDocumentation(false);
$test->addFile(APPPATH."/controllers/gds.php");
$test->addURLToClass("GDS", $this->site);
$test->ignoreMethod(array("GDS"=>"GDS"));
$test->ignoreMethod(array("GDS"=>"accessCheck"));
$test->createWSDL();
$test->printWSDL(true); // print with headers
}
到此为止,您的一切都完成了。 顺便说一句,我在 php5+ 中使用 SoapServer 和 SoapClient
关于php - 使用 PHP 的 native SOAP 类时生成 WSDL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/568916/