webservices: connecting joomla! with other programs
DESCRIPTION
Webservices: connecting Joomla! with other programs.XML-RPC, SOAP and REST with Joomla!TRANSCRIPT
![Page 1: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/1.jpg)
Webservices
Herman Peeren June 1st 2010
connecting Joomla! with the rest
![Page 2: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/2.jpg)
Webservice:• data-exchange with a webserver• often in XML-format
![Page 3: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/3.jpg)
Alternative: ODBCdirectly calling the database from client-application
“normal”, indirect call, e.g. via webpage or webservice:
direct call to database, ODBC:
![Page 4: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/4.jpg)
now: Webservices
![Page 5: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/5.jpg)
Joomla! as a system on its own
![Page 6: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/6.jpg)
connecting Joomla!
![Page 7: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/7.jpg)
connecting Joomla!
![Page 8: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/8.jpg)
connecting Joomla! to: • desktop applications
(RIAs), Java, Flex, Delphi, VS, Titanium, MS Office, etc.
• other webapplications: as a server or client
• browser: Ajax, Flash
• any other computer program...
![Page 9: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/9.jpg)
Example uses:
• connecting to multiple Joomla!-sites for backup and upgrading. (e.g.: Akeeba Remote)
• using external services (e.g. Google Docs, Amazon S3, etc.)
• bridges with other applications (e.g. MageBridge)
![Page 10: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/10.jpg)
Protocols:
• your own... • a binary protocol like AMF• using some XML or JSON (Ajax)• one way XML: feed (Atom/RSS)
• XML-RPC• SOAP• REST
when we talk about webservices we mostly talk about those 3 ways
}
![Page 11: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/11.jpg)
![Page 12: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/12.jpg)
![Page 13: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/13.jpg)
Remote Procedure Calls (XML-RPC and SOAP)
• call a method on the server• DO something (procedure, verb)
vs REST• get/put/post/delete a resource on the server
• resource (object, noun)
![Page 14: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/14.jpg)
XML-RPC
• define I/O types• phpxmlrpc-library• in Joomla!: as a plugin...• better: use MVC• changed in J! 1.6
![Page 15: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/15.jpg)
Webservice and MVC• model: is the “heart” of application(use same model for webservice)
• controller decides what to do based on the input
• view: renders the output
![Page 16: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/16.jpg)
XML-RPC in Joomla! 1.6
• no plugin anymore• new JController (might use a strategy pattern?)
• controllername.xmlrpc.php• idem: controllername.json.php• index.php?....&protocol=xmlrpc • http://docs.joomla.org/Xml-rpc
![Page 17: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/17.jpg)
SOAP
• evolved from XML-RPC• heavily used in .NET• meta-data: WSDL and SOAP-envellope
• SOAP-header: a.o. for authentication
• WSDL: description in XML-format
![Page 18: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/18.jpg)
SOAP-envellope:
![Page 19: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/19.jpg)
WSDL:
• description of a webservice• automatic code generation!• easy to use in e.g. Delphi, Flex, etc.
![Page 20: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/20.jpg)
sample SOAP-calls and WSDL
![Page 21: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/21.jpg)
importing WSDL in Delphi 2010:
![Page 22: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/22.jpg)
importing WSDL in Flex Builder 3:
![Page 23: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/23.jpg)
SOAP in Joomla!, some possibilities:• JMSOAP and com_connector: J!1.0 (vBulletin-connection)
• VM SOA: SOAP for VirtueMart• other PHP libraries and Frameworks: NuSoap, PearSoap, Zend, PHP5 SOAP module...
• JSOAP coming soon! (based on PHP5-SOAP)
require_once(“nusoap.php”); $server = new soap_server;
![Page 24: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/24.jpg)
REST
• “representational state transfer”• architecture, not a protocol• linking to recourses, not methods• resource = object + URI• stateless communication• uniform interface (CRUD)• using HTTP-headers and methods
![Page 25: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/25.jpg)
![Page 26: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/26.jpg)
REST in Nooku Framework:
• KControllerBread + KRequest works out of the box!
• authentication and http status messa-ges not yet 100% (planned for 0.9)
Joomla! RESTful thoughts:
• www.alltogetherasawhole.org/profiles/blogs/restful-api-for-joomla
![Page 27: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/27.jpg)
Authentication/Authorization
• with XML/RPC credentials are para-meters in the remote procedure call.
• with SOAP credentials are in the SOAP-header.
• with REST the credentials are in HTTP-headers.
![Page 28: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/28.jpg)
SSL or other encrypting
• SSL (https://) can be used to encrypt the credentials (and data)
• or you can define encryption of cre-dentials (and data) yourself: - basic (base64: no real encryption) - digest - WSSE, OAuth, your own variation
![Page 29: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/29.jpg)
Get Joomla! connected
• providing standard, easy to use con-nections is essential for further deve-lopment of Joomla!
• let’s provide XML/RPC, SOAP and REST within the MVC framework in a uniform way (Zend has it all, why not we too?)
![Page 30: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/30.jpg)
let’s connect Joomla!
![Page 31: Webservices: connecting Joomla! with other programs](https://reader033.vdocument.in/reader033/viewer/2022042601/54b9853f4a7959b5058b4583/html5/thumbnails/31.jpg)
let’s connect Joomla!