Is it necessary to have a wsdl file for the creation of a webservice in php?

php, web-services, wsdl

Solution

I would like to know, if it is neccasary to have a wsdl file for the creation off a webservice

No, it is not necessary (at least, not in PHP) : it helps others know how to access your webservice (which methods, objects, ... should be used), but a WS can be called even if it doesn't export a WSDL

For PHP, yes, it is a bit difficult to get a WSDL (many classes don't generated them :-( ) ; still, you can generatd it with another tool (there are tools in Eclipse to write WSDL files, for example).

There was `PEAR::Soap` that was able to generate WSDL from PHP code (but you had to write down many lines of code to get it right) -- considering there is a class included in PHP 5 to work with SOAP, I wouldn't recommend using this one, anyway.

For more informations, you can have a look at :

- `SoapServer` ; especially, if you look at the documentation of `SoapServer::__construct`, you will notice it can work both in WSDL and non-WSDL mode

- `Zend_Soap`

Problem

My question is needed for some basic understanding of webservices and more specificly in conjunction with php I would like to know, if it is necessary to have a wsdl file for the creation of a webservice or is that just something that is usefull to third party's that want to access the webservice? Also, it's generated automaticly in .net environments, but for php it's a bit more difficult. What are my options? The thing I am after is to create a jm2ee application on my mobile that sends data to the webservice from time to time. I read somewhere that you have to supply the arguments when there is no wsdl file. What is meant by that? and/or what are the implications of that? Thanks in advance, Richard

Original source