Invoking OpenX api from Flex

For the last several months I was playing with OpenX, an open source ad server written in PHP.  You can interact with OpenX in two ways: first by using the admin graphical interface, second by using API calls – most of the UI functionality can be programmatically reproduced.

OpenX is exposing its API through XML-RPC and they have a couple of examples on their website how to invoke the API from PHP, Java and Ruby. In my case I was trying to display some statistics without going through a middleware, so I started to investigate how can I do it from Flex. It turned out to be quite easy – one can use the AS3 RPC written by Akeem Philbert, with a small modification. The following steps should be done:

a) download the source code of the library from this location (

b) you have to fix a small issue in the class com.ak33m.rpc.xmlrpc. XMLRPCObject  (compatibility issue between SDK’s). The overloaded methods setCredentials and setRemoteCredentials should receive another parameter, called charset.

c)create the objects mapping the OpenX structures (advertiser, campaign, zone etc) and invoke the exposed methods

I did these steps and I created this Flash Builder project – you can import it into your workspace and change the file accordingly.

In my example I have just a couple of operations like login, displaying and creating advertisers. It can easily be extended in order to support the whole OpenX api.

Next post on OpenX will be about displaying the ads on your website, from Flash and HTML.

2 thoughts on “Invoking OpenX api from Flex

  1. Hi Cornel,

    I enjoyed reading your blog post and I’d love to learn more about your next steps in exploring the OpenX API for your Flex development.

    Regards, Erik Geurts – OpenX specialist

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>