NYCPHP Meetup

NYPHP.org

[nycphp-talk] WSDL conversion to PHP classes

Rob Marscher rmarscher at beaffinitive.com
Mon Nov 26 13:32:50 EST 2007


On Nov 25, 2007, at 3:23 PM, Gary Mort wrote:
> I've been looking around and I see a number of frameworks and  
> standalone apps where you can give it the WSDL(sp?) definition file  
> for an XML/RPC type application and it will generate a bunch of stub  
> classes for you to send/receive requests and automatically parse the  
> xml responses into objects or arrays.
>
> Anyone used any of them, and if so what's your favorite time saver?

I recently used php's built-in SoapClient class.  You need to  
configure with --enable-soap.  It was great.  I couldn't believe how  
easy it was:

$client = new SoapClient("http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl 
");
var_dump($client->__getFunctions());
var_dump($client->__getTypes());

SimpleXML can be used to parse XML responses from the Soap service.

You asked for XML/RPC though... so then use Zend Framework's  
Zend_XmlRpc_Client class.  You can use the getProxy() method to get an  
object that lets you make the XML/RPC calls like their methods of that  
object.  It seems that if the server support introspection, you can  
use the getIntrospector() method as well.

PHP5 is the bomb for working with these remote services.  All the  
heavy lifting is already done.

-Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20071126/7d4273a6/attachment.html>


More information about the talk mailing list