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 = SOAP::WSDLDriverFactory.new(WSDL_FILE).create_rpc_driver 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 dev.ctor.org/http-access2 or install the gem with:
$ gem install http-access –source http://dev.ctor.org/download/
ADDITIONAL SOAP4R RESOURCES
- Slides for the SOAP4R Presentation by Emil — Good overview of Rails RPC options
- SOAP4R Google Group — Search for answers about specific error messages
- SOAP4R Trac Site – Scroll down to the “HowTo” section for solutions to specific problems