{"id":44,"date":"2008-01-29T23:39:51","date_gmt":"2008-01-30T04:39:51","guid":{"rendered":"http:\/\/steve.vinoski.net\/blog\/2008\/01\/29\/ruby-and-ws\/"},"modified":"2008-01-29T23:39:51","modified_gmt":"2008-01-30T04:39:51","slug":"ruby-and-ws","status":"publish","type":"post","link":"https:\/\/steve.vinoski.net\/blog\/2008\/01\/29\/ruby-and-ws\/","title":{"rendered":"Ruby and WS"},"content":{"rendered":"<p>Via <a href=\"http:\/\/www.innoq.com\/blog\/st\/2008\/01\/ruby-and-ws.html\">Stefan Tilkov<\/a>: <a href=\"http:\/\/blog.labnotes.org\/2008\/01\/28\/ruby-in-practice-rest-soap-websphere-mq-and-salesforce\/\">Assaf Arkin talks about his upcoming book<\/a>, <em><a href=\"http:\/\/manning.com\/mcanally\/\">Ruby in Practice<\/a><\/em>. I don&#8217;t know anything about the book, but it sounds interesting.<\/p>\n<p>Assaf talks about having a nice Ruby interface for WS, and also talks about wrapping Websphere MQ with Ruby. It reminded me of some work I was doing about a year and a half ago, when I still worked for IONA: developing a Ruby wrapper for <a href=\"http:\/\/www.iona.com\/products\/artix\/\">Artix<\/a>. I left there before it ever saw the light of day, so I doubt anyone will ever see it, but it was pretty cool. It was implemented using only customer-visible C++ APIs, and it afforded at least an order of magnitude reduction in the number of lines of code required to get anything done. It used <a href=\"http:\/\/www.ruby-doc.org\/stdlib\/libdoc\/wsdl\/rdoc\/index.html\">WSDL4R<\/a> to interpret a WSDL definition at runtime and dynamically generate accessor functions for the service, i.e., there was no up-front static code generation. You could point the client at the service, and if the service supported access to its WSDL (typically via a <code>?wsdl<\/code> query string added to the service URI), the client could download the WSDL and dynamically generate everything required to access that service. I wrote about how to develop such Ruby extensions in my <a href=\"http:\/\/dsonline.computer.org\/portal\/pages\/dsonline\/2006\/10\/w5tow.html\">Sep\/Oct 2006 IC column<\/a>.<\/p>\n<p>I remember presenting an example of the system in an internal sales engineering meeting where the original C++ and Java code required 70-80 lines of code while the equivalent Ruby code was only 7 lines. It wasn&#8217;t 7 lines of obfuscated expert-only Ruby, either; it was quite easy to read and understand. The SEs, most of whom worked only in Java and C++, kept looking at it and scratching their heads. They&#8217;d say, &#8220;Hey, you forgot to do this!&#8221; and I&#8217;d say, no, that happens right here. And they&#8217;d say something similar about another required action, and the answer was always the same: no, it&#8217;s in there. Basically, Ruby allowed me to hide a bunch of crufty, verbose, uninteresting but required boilerplate and focus only on service interactions. Waaay nicer than the equivalent Java and C++, for sure.<\/p>\n<p>On a related note, just prior to that project, I did some work with <a href=\"http:\/\/incubator.apache.org\/cxf\/\">Apache CXF<\/a> to develop a <a href=\"http:\/\/dsonline.computer.org\/portal\/pages\/dsonline\/2006\/06\/w3tow.html\">server-side JavaScript and E4X JAX-WS capability<\/a>. Since I no longer work in the middleware or WS worlds, I haven&#8217;t kept track of that code, so I don&#8217;t know if CXF still supports it or not. But either way, given the fact that <a href=\"http:\/\/jruby.codehaus.org\/\">JRuby<\/a> now exists, there&#8217;s no reason that someone couldn&#8217;t take that work and redo it in JRuby. It would be pretty straightforward.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Via Stefan Tilkov: Assaf Arkin talks about his upcoming book, Ruby in Practice. I don&#8217;t know anything about the book, but it sounds interesting. Assaf talks about having a nice Ruby interface for WS, and also talks about wrapping Websphere MQ with Ruby. It reminded me of some work I was doing about a year [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,13,29,62,7,8,48],"tags":[65,64,63,158,170,144,165],"class_list":["post-44","post","type-post","status-publish","format-standard","hentry","category-code-generation","category-dynamic-languages","category-productivity","category-ruby","category-services","category-ws","category-wsdl","tag-artix","tag-cxf","tag-dynamism","tag-productivity","tag-ruby","tag-ws","tag-wsdl"],"_links":{"self":[{"href":"https:\/\/steve.vinoski.net\/blog\/wp-json\/wp\/v2\/posts\/44","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/steve.vinoski.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/steve.vinoski.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/steve.vinoski.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/steve.vinoski.net\/blog\/wp-json\/wp\/v2\/comments?post=44"}],"version-history":[{"count":0,"href":"https:\/\/steve.vinoski.net\/blog\/wp-json\/wp\/v2\/posts\/44\/revisions"}],"wp:attachment":[{"href":"https:\/\/steve.vinoski.net\/blog\/wp-json\/wp\/v2\/media?parent=44"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/steve.vinoski.net\/blog\/wp-json\/wp\/v2\/categories?post=44"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/steve.vinoski.net\/blog\/wp-json\/wp\/v2\/tags?post=44"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}