tags:

views:

1897

answers:

4

Hello,

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.

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

Thanks.

+1  A: 

Generating a WSDL on the fly is not something that happens very often - it would tend to raise a few questions about the stability of your service!

Zend Studio can generate a WSDL from a PHP class, and there are a few other similar tools.

If you do need to generate the WSDL dynamically, take a look at Zend_Soap_AutoDiscover

Ciaran McNulty
+1  A: 

I decided easier just to try myself. After trying a couple, I easily managed to get http://www.schlossnagle.org/~george/blog/index.php?/archives/234-WSDL-Generation.html to generate the WSDL for me.

A: 

Hi Stuart,

We've since stopped using SOAP altogether but when I was working on the project I used NuSOAP to handle the SOAP layer, including generating the WSDL (those are a pain in the ass).

P.S. Please accept an answer (even if it's your own) so this question isn't considered "unanswered". Thanks. :)

Jay Paroline
A: 

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+

daynier