There are many classes available to generate a WSDL file from PHP. But I wanted to create PHP classes out of a WSDL file. SOAP allows passing complex data around and to write a SOAP client, I need to have classes defined in PHP for these complex data. I did not want to manually go through WSDL and create different data types based on SOAP declarations. As a matter of fact, I wanted something that will create a SOAP Server stub for me out of the WSDL (not just a client!)
Now I did not find something that will create a SOAP Server, but I found two implementations that create a SOAP Client out of WSDL. This is still a good start, and I can do some further hacks to create a SOAP server.
Here are these two approaches:
- WSDLInterpreter – WSDLInterpreter is a library that creates PHP 5 classes based on a WSDL document. It creates a SOAPClient via XSLT transformations. Unlike other wsdl2php solutions, WSDLInterpreter utilizes the WSDL document as its source of information, as opposed to the native SoapClient interpretation of the WSDL document. This allows for proper class inheritance, naming convention correction, and method overloading with proper method signature verification using strict type checking.
- wsdl2php – wsdl2php is a very simple tool for PHP 5 to generate client code against a WSDL-file. It uses DOM to parse the WSDL and generates PHP code out of it.
Both approaches generate similar output. And are a great start if you want to use a third party web service in your PHP code.
Hi,
Can WSDLInterperter or WSDL2PHP generate a SOAP client from a WSDL? If yes, would you please tell me how do i do this. I have read the instructions, but couldn’t get these to work.
I try to release a PHP WSDL BPEL engine, base on PHP CLI application server.
Any help would be appreciated.
http://code.google.com/p/ezerphp/
Hello!
I would like to recommend wsdl2phpgenerator(http://code.google.com/p/wsdl2phpgenerator/). It has support for PHP5.3 and can be used as a cli application or used directly in your PHP code as a code library.
hello i’m a .net developer and i have a client that want to generate stub classes using the wsdl.
the webservice was developed by me so i need to gave him suport but i realy don’t understand nothing about php.
can you provide me some samples. how can i pass a wsdl url and get the stub classes?
best regards
I suggest your client get a PHP developer. It won’t be easy to deploy a web service without someone who knows PHP. Someone who’s done some PHP work, can easily use any of the tools I mentioned in the blog and generate stub class.
Alternatively, you can create a client in C# and ask the client to rewrite it in PHP. The syntax and logic is quite similar between C# and PHP.
HTH.
Is there a way to use the wsdl to generate the web server stubs instead of the client stubs. We have a need to build identical web services. One of them needs to be done in PHP. We already have one to use as a template that is written in .NET
I have been using wsdl2php and I really like how it is working. Saved me a lot of boring work.
I wrote this small tutorial how to use wsdl2php:
http://itworkarounds.blogspot.com/2011/10/simple-soap-client-with-wsdl2php-using.html
For some reason I did not get the desire results out of the wsdl generators I found, you can take a look at my version here
http://code.google.com/p/wsdl2php/
just enter the url of the site in a simple web page, and the code is generated.
Hi,
I jutst finished my own Wsdl To Php generator. This package allows to programmatically send request to a SOAP service using PHP classes. In order to that, this class generates each class for each request and each request parameters and each request response. Each class is stored in a hierarchical folder/sub-folder. The SOAP client is then abstracted and you only deal with objects representing the WSDL.
It uses eZ Components, ezcPhpGenerator, in order to generate php files.
Feel free to test it and comme back to me if it’s buggued 😉 : https://sourceforge.net/projects/wsdltophp/
@Mikaelcom: awesome work dude. Going to test this one. Well done
You can find my library on Github here : https://github.com/mikaelcom/WsdlToPhp with lots of examples !
best regards
Hi,
Just so you know I created a website to use the library I developped, follow this link http://www.wsdltophp.com,
regards