SOAP/Ruby on Rails/MiniFAQ — Part 1

OK – first, this is a China blog. The China angle here is that it’s impossible to find PHP programmers in China. Fortunately, RoR (Ruby on Rails) is taking off like the Shanghai stock market, and unlike the local exchange this one’s not a bubble! There are tens of thousands of Java developers here in China and many of them are rapidly running to Rails! Sure helps my life 🙂

I’ve got a little integration project to connect with Dynamic AX (Formerly Known as Axapta), a product that provides MSFT Web Services. If the integration is developed properly, it should be possible to run the SalesOrderCreation methods in Real Time, and fall back to a bullet proof batch mode whenever murphy kicks in.

BASIC AUTHENTICATION The first trick in getting connected from Ruby to MSFT Web Services is the authentication factor. MSFT forces the NTLM authentication method, and it seems that in the latest versions of IIS (at least), this method is only compatible with Microsoft Internet Explorer on Windows as the HTTP client. If you can’t even connect to it in FireFox, you’re going to be had pressed to connect to it with libcurl or similar. Simply replace the NTLM authentication method on the IIS server with the HTTP BASIC auth method and you should have no problem getting a connection to the service.

SOAP4R AND BASIC AUTH If you read the SOAP4R documentation, you will see that basic auth is easily supported. Code just like the following should work just fine.

ws = ws.wiredump_dev = STDOUT ws.options[‘protocol.http.basic_auth’] << [‘Some Realm’, ‘MyUsername’, ‘MyPassword’]

should work just fine… Famous last words. If your situation is anything like mine, it doesn’t work at all. Turns out that SOAP4R BASIC AUTH requires http-access2. http-access2 is a replacement for net/http that offers significantly more functionality. You can download it from or install the gem with:

$ gem install http-access –source


  1. Slides for the SOAP4R Presentation by Emil — Good overview of Rails RPC options
  2. SOAP4R Google Group — Search for answers about specific error messages
  3. SOAP4R Trac Site – Scroll down to the “HowTo” section for solutions to specific problems



Technorati Tags: , , ,

4 thoughts on “SOAP/Ruby on Rails/MiniFAQ — Part 1”

  1. Sweet blog! I found it while browsing on Yahoo News. Do you have any tips on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Many thanks

Leave a Reply

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