About the Author

author photo

Adam Trachtenberg is the Director of the LinkedIn Developer Network, where he oversees developer relations and marketing for the LinkedIn Platform. Before LinkedIn, Adam worked at eBay in platform product management and marketing. Even earlier, he co-founded Student.Com and TVGrid.com. Adam is the author of PHP Cookbook and Upgrading to PHP 5. He lives in San Francisco.

See All Posts by This Author

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:

  1. Clean up code and release eBaySOAP.
  2. Submit patch to PEAR::SOAP.
  3. Backport eBaySOAP to work with PHP 4.
  4. Investigate PHP 5 version of PEAR::SOAP.
  5. 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.
  6. Look to patch PEAR::SOAP to automatically add the correct namespace to parameters, so I don’t need to do it myself.
  7. Write up an article, so everyone can learn how cool eBaySOAP is.
  8. Profit!

If you’re interested in this topic, please add your feedback below, so I can use it to guide my to do list.

Post a Response