jaq ([info]jaq) wrote,
@ 2006-07-11 09:29:00
Previous Entry  Add to memories!  Tell a Friend  Next Entry
Entry tags:geekery, rails, work

rails xml service
I was quite pleased with myself last week because I managed to sneak some Rails into work, and the boss thought what I'd done was useful.

Our Bingo game uses an XML-over-HTTP interface to communicate with some of our clients' customer and financial systems. So for example, when someone tries to buy Bingo tickets, our server makes a call out to the client's server requesting that the amount of money gets transferred to us, and similarly if they win a prize, we make a call transferring money back.

There have been some problems with this communication, so I've been tasked with improving the error handling and reporting. There are a couple of parts to this: one is improving the player's experience, and the other is ensuring there is a clear record of any financial transactions that don't finish correctly.

It turned out that for our test systems the communication mechanism was stubbed out as a Java class. None of the 'external calls' were actually making network calls in testing, they just call in to this class. So it seemed like we weren't really testing the full stack properly.

Enter the Rails... In about a day's work I was able to duplicate the parts of the external API we're using, in a Rails application that accepts XML requests, parses them, tracks users and transactions, and returns the right XML responses. Despite not having done any XML work with Rails before. So then I could use the real HTTP communication classes in Bingo, and point them at my test service, instead of using the stub class.

In another half day I set up a system of 'error filters', where I can choose an error from a list in my Rails system, and it simulates that error occurring when the Bingo game talks to it. This has been invaluable for my testing, and has helped me tighten up the error handling in Bingo, especially in the low level HTTP handling class which was being stubbed out before.

In the meantime I've learned a bit about dynamic file and class loading in Rails which will be handy for one of my own projects :-)




Create an Account
Forgot your login or password?
Login w/ OpenID
English • Español • Deutsch • Русский…