Thursday, February 28, 2008

WSDL to PHP Classes

If you look at the PHP SOAP mailing list, most of user problems are related to complex types in WSDL. One big usability drawback of PHP SOAP extension is it does not have good tools to generate PHP classes from the WSDL at hand (contract first approach). Now, you no longer need to worry about it, as WSF/PHP team is working on a static code generation tool [More info in PHP WS blog]. Good news is that it comes to you free of charge. I think this will greatly enhance user experience with PHP Web Services. They are planning to have an initial cut of the tool in version 1.2.1. Nightly builds and svn should give you an snapshot of it. With the pace of development going on with WSF/PHP, there is a high possibility of having it as a standard PHP extension in the near future.

7 comments:

Mikaël DELSOL said...

Hello,


I would suggest you to test this library delvelopped on my own :http://sourceforge.net/projects/wsdltophp/, also available here : https://github.com/mikaelcom/WsdlToPhp

Best regards

Mikaël DELSOL said...
This comment has been removed by the author.
Mikaël DELSOL said...

Hi,
If you're always interested by this subject, you may visite www.wsdltophp.com which is the online tool to use the library WsdlToPhp,

Regards

Anonymous said...

Within this generated class ...
class UATServiceLogin extends UATWsdlClass

I had to change this ...
$this->setResult(self::getSoapClient()->Login($_UATStructLogin->getUsername(),$_UATStructLogin->getPassword(),$_UATStructLogin->getPartnerCode()));

to this ...
$this->setResult(self::getSoapClient()->__soapCall('Login', array($_UATStructLogin)));

in order to make it work. Any ideas why it would not work the way it was generated?

Mikaël DELSOL said...

Maybe because options are available to customize the way classes are generated and the way calls are sent. In your case, it seems that the option that send the request as an array has been disabled. Can you tell me more about the package, where does it come from, etc?

Anonymous said...

Here is the wsdl I'm working with: https://manageruat.flexnetoperations.com/service/snetmgr/services/SubscribeNet/wsdl/SubscribeNet.wsdl. I've been able to Login (with the changes mentioned). But I'm having a heck of a time initializing the SubscribeNetObjectReference properly and doing a simple Find call.

Mikaël DELSOL said...

Fell free to send me more informations on https:www.wsdltophp.com/Contact so I'll be able to help you more ;)