使用 PHP 的本机 SOAP 类时生成 WSDL? [英] Generating WSDL when using PHP's native SOAP class?

查看:36
本文介绍了使用 PHP 的本机 SOAP 类时生成 WSDL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 PHP 5 中使用原生 SOAP 类,因为原生类更快(而且 NuSOAP 开发似乎已经停止),所以从 NuSOAP 改变了.然而,PHP 5 SOAP 缺乏生成 WSDL 的能力.

I'm using the native SOAP class in PHP 5, having changed from NuSOAP as the native class is faster (and NuSOAP development seems to have ceased). However the PHP 5 SOAP lacks the ability to generate WSDL.

有没有人在 PHP 中生成 WSDL 的经验?如果是这样,请推荐您的首选方法.

Has anyone experience of generating WSDL in PHP? If so, please recommend your preferred method.

谢谢.

推荐答案

Stuart,

如果您或其他任何人正在寻找解决此问题的方法,这就是我所做的.

If you or anyone else is looking for a solution to this problem here's what I did.

首先得到这个脚本:http://www.phpclasses.org/browse/download/zip/package/3509/name/php2wsdl-2009-05-15.zip

然后查看它的示例文件.之后,我只是按照我需要的方式对其进行切片,因为我使用的是 codeigniter:

Then look at its example files. After that I just sliced it the way I needed because I'm using 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

That it, your all done. Btw, I'm using SoapServer and SoapClient in php5+

这篇关于使用 PHP 的本机 SOAP 类时生成 WSDL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆