|
|||||||
New to SitePoint Forums? Register here for free!
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Grumpy Mole Man
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jan 2001
Location: Lawrence, Kansas
Posts: 2,190
|
A new XML-RPC library for PHP
Hi all,
I've released the first version of my XML-RPC library for PHP. There are plenty of others out there but none of them really worked for me (they were either too complicated or didn't work well with PHP 4) so I wrote my own. It's designed to make XML-RPC queries and implementing a full XML-RPC servers as easy as possible - the code handles all type conversions between PHP and XML-RPC transparently meaning XML-RPC calls and responses are almost as simple as makign native PHP function calls. You can check out the library here: http://scripts.incutio.com/xmlrpc/ It's pseudo-OOP (it uses classes but they aren't particularly well abstracted) but as XML-RPC is a concrete standard I saw no reason to make the code any more modular than it had to be. I'm pretty pleased with it so far - it needs a bit more work (<date> support and better error handling mainly) but it's ready for use now - in fact I'm already using it as part of my new PingBack system. Feedback and suggestions welcome - here, or through the contact form on my blog ![]() Thanks, Simon |
|
|
|
|
|
#2 |
|
SitePoint Wizard
![]() ![]() Join Date: Nov 2000
Location: Switzerland
Posts: 2,898
|
That's looking good. Nice use of variable reflection. If I can dare to make one suggestion: would be good to seperate the HTTP client as a seperate object from the XML-RPC client.
There's a good HTTP client class here: http://www.phpclasses.org/browse.html/package/3.html The client still needs one or two things, namely SSL connections (using Curl perhaps or with PHP 4.3 fsockopen can access SSL sites if OpenSSL is compiled with PHP) and HTTP Basic Authentication. Also on the server side, would be great if there was a mechanism build in HTTP Authentication headers (again as a seperate class) - there's an Authentication class here: http://sourceforge.net/projects/httpauthplus/ The reason is there's not a single XML-RPC class yet that handles HTTP fully. There's hardly even a complete PHP HTTP client to work with either. May be the ISO8601 types can be spotted in the strtotime() function? Also system.multicall would be good, as an in built mechansim (http://www.xmlrpc.com/discuss/msgReader$1208) and a means to build in introspection automatically. Sorry man You asked. Reckon if you can do it all, you'll have the #1 XML-RPC library. Anyway great start! |
|
|
|
|
|
#3 |
|
Grumpy Mole Man
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jan 2001
Location: Lawrence, Kansas
Posts: 2,190
|
Wow, that's exactly the kind of feedback I was after. Thanks
![]() /me starts reading |
|
|
|
|
|
#4 |
|
Grumpy Mole Man
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jan 2001
Location: Lawrence, Kansas
Posts: 2,190
|
I can't find the specification for the suggested XML-RPC introspection methods anywhere. Any ideas?
|
|
|
|
|
|
#5 | |
|
SitePoint Wizard
![]() ![]() Join Date: Nov 2000
Location: Switzerland
Posts: 2,898
|
Seems Useful seem to be slowly "losing" their documentation (could be cause they want SOAP to take off). The introspection stuff should be here: http://xmlrpc.usefulinc.com/doc/reserved.html
But anyway, this is what I have form the Useful library documentation (comes with their classes); Quote:
Will see if can come up with some more info later. |
|
|
|
|
|
|
#6 |
|
Grumpy Mole Man
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jan 2001
Location: Lawrence, Kansas
Posts: 2,190
|
Thanks - I eventually found their documentation in the Google cache
![]() I've taken the liberty of quoting your comments almost in their entirity on my blog, as it turns out people who aren't logged in to the forums can't view threads on the Advanced PHP forum (doh!). Hope you don't mind: http://www.bath.ac.uk/~cs1spw/blog/a...9/02/#feedback Cheers, Simon |
|
|
|
|
|
#7 |
|
will code HTML for food
![]() ![]() ![]() ![]() Join Date: Sep 2000
Location: Corsica
Posts: 552
|
Now all we need is that you code the same for SOAP someday
![]() (it would be just great to have that kind of library work with both SOAP and XMLRPC with just a switch between protocols needed, as it would dramatically reduce web-services development time) |
|
|
|
|
|
#8 |
|
SitePoint Wizard
![]() ![]() Join Date: Nov 2000
Location: Switzerland
Posts: 2,898
|
That does exist. It's the native XML-RPC PHP extension - it's capable of receiving and sending SOAP 1.1 messages. If it gets a SOAP message, it tries to convert it to PHP variables (works most of the time). It's pretty well hidden (like here) but basically here's an example;
PHP Code:
Code:
<?xml version='1.0' encoding="iso-8859-1" ?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:si="http://soapinterop.org/xsd" xmlns:ns6="http://testuri.org" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <system.methodHelp> <xsd:string>system.listMethods</xsd:string> </system.methodHelp> </SOAP-ENV:Body> </SOAP-ENV:Envelope> PHP Code:
Code:
<?xml version='1.0' encoding="iso-8859-1" ?> <methodCall> <methodName>system.methodHelp</methodName> <params> <param> <value> <string>system.listMethods</string> </value> </param> </params> </methodCall> ).The other general option for transforming XML-RPC to SOAP is with XSLT - for a starter, try this: http://www.xmlrpc.com/discuss/msgReader$559. Course XSLT requires the Sablotron extension to PHP (haven't found any XSL parser written in PHP) |
|
|
|
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 21:09.










).


Linear Mode
