我在PHP5中使用原生SOAP类,由于原生类更快(而且NuSOAP开发似乎已经停止),所以从NuSOAP更改了原生SOAP类。但是,PHP5SOAP缺乏生成WSDL的能力。
有没有用PHP生成WSDL的经验?如果是这样,请推荐您首选的方法。
谢谢。
发布于 2010-10-12 23:23:13
斯图尔特
如果你或其他任何人正在寻找这个问题的解决方案,这里是我所做的。
首先获取这个脚本: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
发布于 2009-02-20 12:42:32
动态生成WSDL并不是经常发生的事情-它可能会引发一些关于服务稳定性的问题!
Zend Studio可以从PHP类生成WSDL,还有其他一些类似的工具。
如果您确实需要动态生成WSDL,请查看Zend Framework库:Zend_Soap_AutoDiscover
发布于 2014-04-02 05:09:07
您可以尝试以下选项:
https://code.google.com/p/php-wsdl-creator/ (GPLv3) https://github.com/piotrooo/wsdl-creator/ (GPLv3)http://www.phpclasses.org/package/3509-PHP-Generate-WSDL-from-PHP-classes-code.html (类似BSD)
如果许可适合您的项目,第一个可能是您最好的选择。
https://stackoverflow.com/questions/568916
复制相似问题