Success! eBaySOAP class almost ready
After a Titanic struggle, I have managed to make a successful SOAP call to eBay using PEAR::SOAP. I’m in the process of cleaning up my code, but once it’s all nice, I’ll release version 0.1 of eBaySOAP.
Right now PHP 5 is a requirement, since I ended up aggregating the SOAP client inside a PHP class to make things easier for developers. For some reason, PEAR::SOAP isn’t setting a namespace for our parameters, so I need to intercept any parameters and create SOAP_Value objects for them with the proper namespace. If I use __call(), I can step in and do this transparently and you’re none the wiser.
I bet I can backport this to PHP 4, if I use the overload extension. It shouldn’t be too hard, especially as I’m using the PHP 4 version of PEAR::SOAP.
I also had to make a small patch to PEAR::SOAP. Right now, if PEAR::SOAP sees a namespace with a colon (:) in it, it presumes it’s a qualified name (qname for short) of the format prefix:localpart. In eBay’s case, we have a namespace of urn:ebay:API:eBayAPI. This isn’t a qname, but PEAR::SOAP thinks it is and incorrectly breaks it apart. My patch checks to see if the namespace beings with urn: and tells PEAR::SOAP to ignore it.
I need to do some digging to see exactly why PEAR::SOAP does this and why it doesn’t break namespaces that look like URLs also.
So, next steps:
- Clean up code and release eBaySOAP.
- Submit patch to PEAR::SOAP.
- Backport eBaySOAP to work with PHP 4.
- Investigate PHP 5 version of PEAR::SOAP.
- Investigate ext/SOAP extension in greater detail. I’ve done some preliminary work here, but I’m finding bugs and they’re hard to fix at work since I’m using Windows.
- Look to patch PEAR::SOAP to automatically add the correct namespace to parameters, so I don’t need to do it myself.
- Write up an article, so everyone can learn how cool eBaySOAP is.
- Profit!
If you’re interested in this topic, please add your feedback below, so I can use it to guide my to do list.