Generating WSDL when using PHP's native SOAP class?

前端 未结 4 1870
不知归路
不知归路 2020-12-30 03:17

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 lac

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-30 03:50

    Stuart,

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

    First get this script: http://www.phpclasses.org/browse/download/zip/package/3509/name/php2wsdl-2009-05-15.zip

    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
     }
    

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

提交回复
热议问题