My new favorite PHP 5 SOAP feature is the classmap option. By default, ext/soap converts complexTypes into stdClass objects. However, that’s only useful for reading the data.
Using the classmap option, you can specify how ext/soap should map complexTypes to PHP classes. This allows me to write methods to implement iterators and pretty-printing of objects.
I hope I can construct a series of model classes (similar to what Services_Ebay), so if you have an User object from populated from the output of, say, GetUser, you’ll be able to call a GetFeedback method on that object, and have it make a GetFeedback API call and fill in the necessary data based on what’s already stored within the object as properties.
Ideally, I’ll be able to do some magic
__call() overloading, so I don’t even need to explicitly define these methods, but I can just write one magic base class. I’m not sure if that will work, but it’s my weekend hacking project.
Also, while I’m at it, I’m having problems getting the compression option to work. I get a nasty SoapClient::__doRequest(): SSL: fatal protocol error when I try. It looks as if zlib is enabled, so I don’t know if SSL and Gzip don’t play nicely together, or if my SOAP server is busted, or what. I’ll work on debugging this, but if anyone else has something to share, I’d be happy to hear it.
Popularity: 4% [?]